summaryrefslogtreecommitdiff
path: root/packages/Shell/src/com/android/shell/BugreportProgressService.java
Commit message (Collapse)AuthorAgeFilesLines
* Secure REMOTE_BUGREPORT_DISPATCHRubin Xu2022-03-221-4/+15
| | | | | | | | | | | | | | | | | | | | | | In remote bugreport collection, Shell sends REMOTE_BUGREPORT_DISPATCH to DevicePolicyManagerService which in turn notifies Device Owners that a bug report is ready for collection. There existed a threat where a malicous user could spoof the REMOTE_BUGREPORT_DISPATCH broadcast via ADB to send a crafted bugreport to the Device Owner. Securing REMOTE_BUGREPORT_DISPATCH is not as easy as it appears: putting a permission on REMOTE_BUGREPORT_DISPATCH does not work since both the legitimate sender and the malicious user are UID_SHELL. Instead, we introduces a nonce which was sent from DPMS to Shell when bugreport is triggered, and DPM will only accept REMOTE_BUGREPORT_DISPATCH when a matching nonce is seen. Ignore-AOSP-First: security fix Bug: 171495100 Test: atest DeviceOwnerTest#testRemoteBugreportWithTwoUsers Test: atest DeviceOwnerTest#testAdminActionBookkeeping Test: atest BugreportManagerTest Change-Id: I7649b4f22b74647d152d76bb46d5ca70bfa3617d
* Clean <plurals> in BugreportProgressServiceCalvin Pan2022-01-261-3/+9
| | | | | | Bug: 199230228 Test: make Change-Id: I888c65c8819eb5443178ddfc2097d3519b89cefb
* Merge "update bug report notification title"Josh Yang2022-01-111-4/+6
|\
| * update bug report notification titleAbhijit Nukalapati2021-11-161-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the existing notification style sets maxLines to 2, the title was being truncated and the percentage was thus not visible to the user. As recommended by UX, we are updating the string so that it is no longer truncated and the percentage text is visible. Screenshots: Before - https://screenshot.googleplex.com/9U6RKuMcnECQ3pV After - https://screenshot.googleplex.com/8U9NCJHhR5qkRCD BUG: 198747050 Change-Id: I2b94cc65e2b9c3af860dd35532e1060814f6a68e (cherry picked from commit 262e835016e340e5fd7b5eb00b7ac6579ca127ae)
* | Merge "Support adding System Traces to Wear Bugreports"Josh Yang2022-01-111-3/+41
|\ \
| * | Support adding System Traces to Wear BugreportsYeabkal Wubshit2021-11-161-3/+41
| |/ | | | | | | | | | | | | | | | | | | | | System Traces collected with the native System Tracing App (Traceur) are now added under a separate directory (systraces) for Wear bugreports. Note that this change is functionally no-op for non-Wear form-factors (changes only one log's wordings for non-Wear form-factors). Bug: 183239853 Test: manual Change-Id: Id6b9aa0d38a0d465b763ec86fb1192875379431c (cherry picked from commit 7111510c691ccf20baf372dab5cea2ac30ae0c23)
* / Share Wear bugreport right after it is takenYeabkal Wubshit2021-11-241-30/+134
|/ | | | | | | | | | | | | | | | | | | | | In rvc-wear-dev, bugreports were not shared to phone until user tapped on the bugreport-complete notification. Now, we are sending bugreports to phones immediately after bugreport is taken. We still retain the bugreport-complete notification. The bugreport-complete notification will have an action button that leads the user to a bugreport-warning screen as long as the user has not opted out from seeing the warning. If the user chooses not to see that message again (which they can do in the warning screen), there will not be any action button on the bugreport-complete notification, and the user can just swipe to delete it. Refer to the look of the notification when no warning message is to be displayed (https://screenshot.googleplex.com/JStqotLwCaTXeL9) and when a warning message is to be displayed (https://screenshot.googleplex.com/AdGKWFqbky8Ad8s) Note: this change does NOT affect the functionality of the BugreportProgressService for any other device except Wear devices. Bug: 163083307 Test: the described feature tested with salmon running rvc-wear-dev Change-Id: If6890ef8cada60e454c9232d402bbdb8a1b0315e
* Merge "Fix missing fields when parceling the BugreportInfo" am: 2042ea04aa ↵Rhed Jao2021-01-071-2/+8
|\ | | | | | | | | | | | | | | | | | | am: 77d5168388 am: ffcba92063 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1540911 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ifa5d63a7d7951bb9fcf337e859df786688ac2c6a
| * Merge "Fix missing fields when parceling the BugreportInfo"Rhed Jao2021-01-071-2/+8
| |\
| | * Fix missing fields when parceling the BugreportInfoRhed Jao2021-01-071-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shell app exception resulted from two missing fields in BugreportInfo when it's parceling. Application ran into the duplicate logic to send notification and start foreground service then caused the exception. Bug: 176624074 Test: Request a bugreport; kill the com.android.shell; \ tap the share notification Change-Id: Ia80f5e77f5486addf9ea7822f566c3fd7d75f42a
| * | Returns immediately if the bugreport file already existsRhed Jao2020-12-211-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a case that BugreportProgressService is invoked twice quickly, and both services create the same bugreport file name. The later one may delete current running bugreport file in its clean function, when it detects another bugreport is running. Bug: 174314124 Bug: 175287931 Test: atest BugreportReceiverTest Change-Id: I5e1802c5912f4414f1ad3b8bdaf7c7420332b9d6 Merged-In: I5e1802c5912f4414f1ad3b8bdaf7c7420332b9d6
| * | Fixes an error handling in BugreportProgressServiceRhed Jao2020-12-211-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calls onError function when bugreport is finished and file is empty. Bug: 174314124 Bug: 175287931 Test: atest BugreportReceiverTest Change-Id: I4542568fd2d2ad1c75c7c3b223accca4995938a3 Merged-In: I4542568fd2d2ad1c75c7c3b223accca4995938a3
| * | Fix BugreportReceiverTestRhed Jao2020-12-211-12/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Implements a local binder and #onBind in the service to return the service instance. - Mocks BugreportManager in the service to avoid service interacting with the dumpstate. - Fixes dialog name field did not disable after service is finished. - Fixes screenshot did not remove if the name is empty. - Extends screenshot delay timeout in tests. - Fine tune the UiBot to fit new bugreport notification. - Removes obsolete cases in the tests. Bug: 143130523 Bug: 175287931 Test: atest BugreportReceiverTest Change-Id: Iae89206da1d08a10891503869bbbf1ce18d4e31f Merged-In: Iae89206da1d08a10891503869bbbf1ce18d4e31f
| * | Do not buzzing for each progress of bugreport notificationRhed Jao2020-12-211-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | Only alert bugreport notification at the begining and end. Bug: 146135200 Bug: 175287931 Test: Manually changing the notification settings to default from silent. Change-Id: Ie955266ad8a7a27a9dc74743e276b5e9c7a2d6fb Merged-In: Ie955266ad8a7a27a9dc74743e276b5e9c7a2d6fb
| * Replace broadcast with adding a method in BugreportCallbackPaul Chang2020-11-231-0/+3
| | | | | | | | | | | | | | | | BUG: 154298410 Test: BetterBug can work normally in bug report shortcut flow Change-Id: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9 Merged-In: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9 (cherry picked from commit ec91d7700d9316ba09d639ab55ce94fb72d0f8ec)
* | Returns immediately if the bugreport file already existsRhed Jao2020-12-101-4/+11
| | | | | | | | | | | | | | | | | | | | | | There's a case that BugreportProgressService is invoked twice quickly, and both services create the same bugreport file name. The later one may delete current running bugreport file in its clean function, when it detects another bugreport is running. Bug: 174314124 Test: atest BugreportReceiverTest Change-Id: I5e1802c5912f4414f1ad3b8bdaf7c7420332b9d6
* | Fixes an error handling in BugreportProgressServiceRhed Jao2020-12-101-4/+5
| | | | | | | | | | | | | | | | Calls onError function when bugreport is finished and file is empty. Bug: 174314124 Test: atest BugreportReceiverTest Change-Id: I4542568fd2d2ad1c75c7c3b223accca4995938a3
* | Replace broadcast with adding a method in BugreportCallbackPaul Chang2020-11-141-0/+3
| | | | | | | | | | | | BUG: 154298410 Test: BetterBug can work normally in bug report shortcut flow Change-Id: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9
* | Add immutability flag to PendingIntentsGavin Corkery2020-10-281-2/+2
| | | | | | | | | | | | | | | | | | | | Explicitly set FLAG_IMMUTABLE for all PendingIntents in BugreportProgressService. Test: Builds Bug: 170165227 Bug: 171830604 Change-Id: Iae1489b9c8fa323448e60615e99ad96aee1cd1d7
* | Apply FLAG_IMMUTABLE to various PendingIntents.Jeff Sharkey2020-10-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some careful spot-checking has revealed common cases where it's reasonable to blanket apply the new FLAG_IMMUTABLE option to newly created PendingIntents. Specifically these situations: -- Simple notification content clicks are immutable; there's no need to communicate customized data back to the creator -- Simple notification action clicks are immutable; there's no need to communicate customized data back to the creator -- Broadcast intents sent by AlarmManager are immutable; the system dispatches them without customization. Bug: 170165227, 170424283, 170425388, 170425877 Bug: 169791183, 170771965, 170226088, 170224928, 170767530 Test: none Change-Id: I5ed68710d2ccad4635a30fd91136a9e6ad76a01d
* | Merge "Update language to comply with Android's inclusive language guidance" ↵Treehugger Robot2020-09-281-2/+2
|\| | | | | | | | | | | | | | | am: 986e49df72 am: 21e5a00fb3 am: bc3cef1dce am: 91d640572f am: 58ebc4f303 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382481 Change-Id: I23744e158143a09d887e0ff1de912f687ffd0ded
| * Merge "Update language to comply with Android's inclusive language guidance"Treehugger Robot2020-09-281-2/+2
| |\
| | * Update language to comply with Android's inclusive language guidanceAlice Kuo2020-08-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference #inclusivefixit Bug: 162536543 Change-Id: I468147a439c1a60488def7db3e44bfc361bddbe4
* | | Fix BugreportReceiverTestRhed Jao2020-06-181-12/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Implements a local binder and #onBind in the service to return the service instance. - Mocks BugreportManager in the service to avoid service interacting with the dumpstate. - Fixes dialog name field did not disable after service is finished. - Fixes screenshot did not remove if the name is empty. - Extends screenshot delay timeout in tests. - Fine tune the UiBot to fit new bugreport notification. - Removes obsolete cases in the tests. Bug: 143130523 Test: atest BugreportReceiverTest Change-Id: Iae89206da1d08a10891503869bbbf1ce18d4e31f
* | | Do not buzzing for each progress of bugreport notificationRhed Jao2020-06-091-0/+2
|/ / | | | | | | | | | | | | | | | | Only alert bugreport notification at the begining and end. Bug: 146135200 Test: Manually changing the notification settings to default from silent. Change-Id: Ie955266ad8a7a27a9dc74743e276b5e9c7a2d6fb
* | Merge "Take interactive bugreports on Android TV" into rvc-devRobin Lee2020-05-221-4/+6
|\ \
| * | Take interactive bugreports on Android TVRobin Lee2020-05-211-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to take a screenshot immediately, not after dumpsys finished. This also gives the user some feedback that we took a screenshot when they were paying attention, whereas the notification might go under the radar if posted the 30-90 seconds later it will be shown otherwise. Also gives us the progress notification in the Android TV notification tray, which helps the user keep track of what is going on and how long it is expected to take. Previously either no feedback was shown at all on key press, or a simple Toast was shown on selecting the bugreport option from the TV Settings app. Test: Press DPAD_CENTER + BACK, observe screenshot and progress. Fix: 151865303 Change-Id: I78753697a7867042d28364a6b6d61fdb96f8bc96
* | | Delete empty bugreport files onErrorAbhijeet Kaur2020-04-061-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 152839953 Test: Take another bugreport, while one is in progress. Without this change: bugreport files for the second bugreport can be seen in /bugreports With this change: no file for the second bugreport can be seen. This is the expected behavior. Change-Id: I45c1f66f3a52ba9a31413cf9748bc5504eaa65d0
* | | Merge "Follow best practices for Atomic variables" into rvc-devTreeHugger Robot2020-04-031-11/+11
|\ \ \
| * | | Follow best practices for Atomic variablesAbhijeet Kaur2020-04-021-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make Atomic variables final so it can never be re-assigned to a null object and hence avoid NPE. * Set the value of the variables instead of re-assigning the object. Test: Manual Bug: 152479372 Change-Id: I58279d589d6247c53155755223fd8863f1049257
* | | | Track bugreports immediately after triggering a bugreportAbhijeet Kaur2020-04-021-11/+9
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove an old hack that was put in place as bugreport ID was updated a bit later in the bugreport generation phase. This change removes the race condition around triggering bugreports almost instantly. Bug: 152292912 Test: Trigger consecutive bugreports from ActivityManager WAI. (Fails without this change) Change-Id: Ib08bc2c7d8ae765894998e5bfa0d9b6f3efa088b
* | | Merge "Delete bugreport file on bugreport cancel" into rvc-devTreeHugger Robot2020-03-311-0/+9
|\ \ \
| * | | Delete bugreport file on bugreport cancelAbhijeet Kaur2020-03-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: bugreport Cancel is not the same as bugreport onError. Files are not deleted onError, as it still has some information before the bugreport crashed/stopped. Bugreport Cancel is triggered by the user, hence clean up all the files. Bug: 146994281 Test: Cancel interactive bugreport from UI, deletes the current bugreport files Change-Id: I2606e491cbaa20eaa60980e98af56a194bae2280
* | | | Merge "Initialize progress and lastProgress AtomicIntegers" into rvc-devTreeHugger Robot2020-03-271-2/+2
|\ \ \ \ | |_|/ / |/| | |
| * | | Initialize progress and lastProgress AtomicIntegersAbhijeet Kaur2020-03-261-2/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | This is essential for bugreports that do not send progress updates. Bug: 152343458 Test: Take and share full bugreport Change-Id: Id634afd82a92c02d1cf96ffd719fff8670fb8709
* / / Show predefined title and description in finished notificationAbhijeet Kaur2020-03-251-3/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | shareTitle and shareDescription is passed by the caller of the bugreport. Show these in the finished bugreport notification. Pre-set shareTitle takes precedence over user modified title. shareDescription and description are not related/dependant on each other in any way. Bug: 150333444 Test: Manual (by passing EXTRA_TITLE and EXTRA_DESCRIPTION from ActivityManagerService when trigerring a bugreport) Change-Id: I2bfd080aeee677cdc8d0af339d7ad4a29451c3e0
* | Clean up code in BugreportProgressServiceAbhijeet Kaur2020-03-181-87/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make fields (progress, lastUpdate and finished) atomic to make them thread safe and also reduce getters/setters. * Make lastProgress a private field in BugreportInfo. * Move deleteScreenshots to BugreportInfo class. * Make fields with lock protected getters/setters as private. * Make fields that should not be changed as final. Bug: 147033613 Test: manual Merged-In: I8f0fb4865c1b7c5d62bebca3e250eee59b4e71f4 Change-Id: I8f0fb4865c1b7c5d62bebca3e250eee59b4e71f4 (cherry picked from commit fe7d1ab0cbcb6455a5760a092cfb50606f48d4b7)
* | Clean up code of starting bug reportPaul Chang2020-02-281-8/+21
| | | | | | | | | | | | | | | | | | - Let screenshot fd be null if Shell doesn't want to take default screenshot when bug report is triggered. BUG:149525300 Test: Flash and test interactive/full bugreports generated using Shell, and Shell flow does not break during tests Change-Id: I50908af63d74ed66156354ec0b5a237f7131061a Merged-In: I50908af63d74ed66156354ec0b5a237f7131061a
* | Merge "Add synchronization locks to shared objects"Abhijeet Kaur2020-02-171-89/+192
|\ \
| * | Add synchronization locks to shared objectsAbhijeet Kaur2020-02-141-89/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make methods that read/write mBugreportInfos lock protected and add "Locked" suffix to the method name. BugreportInfo objects are read/write in different functions, to keep the code clean, add lock protected getter/setter methods. Bug: 142217059 Test: Takes interactive/full bugreports as expected Change-Id: Iaadd6c9dce5009e40dd015e3b62bcd6e36966e00
* | | Refactor bugreport files creation and getfd methodsAbhijeet Kaur2020-02-141-28/+27
|/ / | | | | | | | | | | | | | | | | | | Handle Exceptions around file creation/open fd more gracefully inside BugreportInfo class. This is communicated to the caller of BugreportInfo by returning null for getFd() methods. Test: builds Change-Id: Ie241dce0810645e04b2492dc8b1bcbc3e9f8f664
* | Remove duplicate directory variables with the same valueAbhijeet Kaur2020-02-071-49/+73
| | | | | | | | | | | | | | | | | | | | | | | | Bugreport files and screenshot files are saved in the same directory. Use common variable for consistency and to avoid duplicacy. Move bugreport file and default screenshot file creation to the constructor as for each bugreportInfo object a bugreportFile must exist. Bug:123617758 Test: Takes interactive/full bugreports as expected Change-Id: I338e852c543e63b403536cd852518b6601ea32f0
* | Remove legacy-flow no-op variables: max, realMax and realProgressAbhijeet Kaur2020-01-261-52/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Legacy onProgress aidl listener callback function used to take 2 params: progress and max. So, the client had to calculate the percentage progress. This legacy onProgress method is removed. Now dumpstate sends the actual progress in percentage without requiring the client to calculate it. Bug: 123617758 Test: Takes interactive bugreport as expected. And shows progress notification as expected. Change-Id: Ic5a355cc886e51b964f73c227f5f657173e99420
* | Merge "Move heap dump sharing to SHELL." am: c29b5cba29 am: 2cdf2d5ad7Kweku Adams2019-10-301-1/+1
|\| | | | | | | | | | | am: 215d92f880 Change-Id: Ic092f2d5c0c0a1497c19e73417c68b8e8616cc63
| * Move heap dump sharing to SHELL.Kweku Adams2019-10-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The system shouldn't be granting read URI permissions as itself. This means that heap dumps aren't successfully shared. Moving the heap dump sharing mechanism to SHELL, which already has the permission to dump heaps so that dumps can be shared properly. The ActivityManagerService changes are submitted separately. Bug: 126885951 Bug: 135150619 Test: collect a heap dump and confirm it's successfully shared with an app Test: do manual test on a secondary user & confirm it's not available to other user Change-Id: I6fad69280b5124c8ec2d3b4bef0f7dddb6a9422c
* | Remove unused broadcasts/functions/variables from ShellAbhijeet Kaur2019-10-221-430/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bugreport is now triggered using API and not via broadcasts from dumpstate. As migration to API flow is stable, we can remove methods and broadcasts that were used in non-API bugreport flow. Now, callbacks are used for communication between dumpsate and Shell instead of broadcasts. * Remove BugreportReceiver.java as it used to handle BUGREPORT_STARTED and BUGREPORT_FINISHED intents which are not required by Shell anymore to track bugreports. * Remove RemoteBugreportReceiver.java as it used to handle REMOTE_BUGREPORT_FINISHED intent which is not required by Shell anymore. * Remove methods that were being used when processing these broadcasts. * Remove pid as that is not used anymore. * Since Shell owns the file now, don't need mTempName, mSavedName, onFocusListener and disable file name after the bugreport is finished. File name can be sanitized and updated even after bugreport finished. Bug: 136066578 Test: Build and flash. Interactive/Full bugreports from Settings/Power button. Test: Rename workflow for interactive bugreports works as expected. Test: * Build and flash * Install TestDPC * Make it device owner * Take a remote bugreport. Works as expected Change-Id: I5e0f829631cb63074c41c914236e78abe95ba162
* | Read screenshot file from screenshotFiles arrayAbhijeet Kaur2019-10-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | Regression from merge issue that was created when merging ag/9489200 and ag/9502526. Previously, before saving the screenshot file in the array, it had to be created each time it was required. Bug: 123617758 Test: manual Change-Id: I2dc2924aa20609d2445af00025580b2752935903
* | Add synchronized locks to bugreport callback methodsAbhijeet Kaur2019-10-071-67/+88
| | | | | | | | | | | | | | | | | | | | | | | | BugreportCallbackImpl class methods modify (read/write) the private variable mInfo. Add synchronized locks for consistency. Make other methods static to be thread-safe, and operate only on its arguments. Bug: 123617758 Test: Build and flash. Takes bugreport as expected Change-Id: I237fd940f5ccd4833d053558cf1b014883d59791
* | Fix bugreport rename in API workflowAbhijeet Kaur2019-10-071-72/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current implementation of API flow of bugreport, renaming bugreports works fine but it changes the entire name. In legacy flow, the user is only able to rename the suffix of the file. The prefix of the name (bugreport-deviceName-buildID) remains unchanged. Also, wifi and telephony bugreports have the type of the bugreport specified explicitly in the name. Fix Shell's rename implementation to follow legacy logic. Also stop setting name property in the API flow since it's a functional no-op anyway, and we want all communications to dumpstate be through the API when possible. No need to call trackInfoWithId() for remote bugreports as Shell does not process any notification related to it. Bug: 123617758 Test: * Take interactive bugreport, rename and save. (work as expected) Test: Corner case: * Take interactive bugreport, rename and save. * Click on the progress notification again and keep the edit box open. * Wait for bugreport to finish, filename edit box would be disabled and autofilled with last saved rename. You will still be able to edit title and summary. (works as expected) Change-Id: I0016ef4fc1e80fb792712c45439e2b0d348f5249
* | Merge "Handle legacy broadcasts from dumpstate logic in onFinished() callback"Abhijeet Kaur2019-09-261-8/+132
|\ \