1# AAE BugReport App 2 3A test tool that is intended to show how to access Android Automotive OS bugreporting APIs. 4It stores all bugreports in user 0 context and then allows uploading them to GCS. 5 6## Flow 7 81. User long presses Notification icon 92. It opens BugReportActivity as dialog under current user (e.g. u10) 103. BugReportActivity connects to BugReportService and checks if a bugreporting is running. 114. If bugreporting is already running it shows in progress dialog 125. Otherwise it creates MetaBugReport record in a local db and starts recording audio message. 136. When the submit button is clicked, it saves the audio message in temp directory and starts 14 BugReportService. 157. If the drivers cancels the dialog, the BugReportActivity deletes temp directory and closes the 16 activity. 178. BugReportService running under current user (e.g. u10) starts collecting logs using dumpstate, 18 and when finished it updates MetaBugReport using BugStorageProvider. 199. BugStorageProvider is running under u0, it schedules UploadJob. 2010. UploadJob runs SimpleUploaderAsyncTask to upload the bugreport. 21 22Bug reports are zipped and uploaded to GCS. GCS enables creating Pub/Sub 23notifications that can be used to track when new bug reports are uploaded. 24 25## System configuration 26 27BugReport app uses `CarBugreportServiceManager` to collect bug reports and 28screenshots. `CarBugreportServiceManager` allows only one bug report app to 29use it's APIs, by default it's none. 30 31To allow AAE BugReport app to access the API, you need to overlay 32`config_car_bugreport_application` in `packages/services/Car/service/res/values/config.xml` 33with value `com.android.car.bugreport`. 34 35## App Configuration 36 37UI and upload configs are located in `res/` directory. Resources can be 38[overlayed](https://source.android.com/setup/develop/new-device#use-resource-overlays) 39for specific products. 40 41### Config 42 43Configs are defined in `Config.java`. 44 45### System Properties 46 47- `android.car.bugreport.force_enable` - set it `true` to enable bugreport app on **all builds**. 48 49### Upload configuration 50 51BugReport app uses `res/raw/gcs_credentials.json` for authentication and 52`res/values/configs.xml` for obtaining GCS bucket name. 53 54## Starting bugreporting 55 56The app supports following intents: 57 581. `adb shell am start com.android.car.bugreport/.BugReportActivity` 59 - generates `MetaBugReport.Type.INTERACTIVE` bug report, shows audio message dialog before 60 collecting bugreport. 612. `adb shell am start-foreground-service -a com.android.car.bugreport.action.START_SILENT com.android.car.bugreport/.BugReportService` 62 - generates `MetaBugReport.Type.SILENT` bug report, without audio message. It shows audio dialog 63 after collecting bugreport. 64 65## Testing 66 67### Manually testing the app using the test script 68 69Please follow these instructions to test the app: 70 711. Connect the device to your computer. 722. Make sure the device has Internet. 733. Start BugReport app; here is the list of possible ways to start: 74 * Long press HVAC (A/C) icon 75 * Long press Rear Defrost hardware button (hold up to 6 seconds) 76 * Long press notification icon 77 * Open BugReport app from launcher menu or external apps menu; and click Start Bug Report button. 78 * Using adb, see above instructions under `Starting bugreporting`. 794. Bug report collection might take up to 7 minutes to finish. 80 * It might fail to upload bugreport when time/time-zone is invalid. 81 * In rare cases it might not upload the bugreport, depending Android's 82 task scheduling rules. 83 * You should see progress bar in notification shade. 845. Pull collected zip files from the device: 85 * `adb pull /data/user/0/com.android.car.bugreport/bug_reports_pending/` 866. Please manually verify bug report contents. 87 * Images - the should contain screenshots of all the physical displays. 88 * Audio files - they should contain the audio message you recorded. 89 * Dumpstate (bugreport) - it should contain logs and other information. 907. In any case if bugreport app is not properly functioning, please take adb bugreport and share 91 the zip file with developers: `$ adb bugreport`. 92 93NOTE: `utils/bugreport_app_tester.py` is deprecated. 94