summaryrefslogtreecommitdiff
path: root/packages/Shell/src/com/android/shell
AgeCommit message (Collapse)Author
2021-05-12Don't allow non-system window overlays for bug report warnings.Varun Shah
Bug: 175614079 Test: test PoC app Change-Id: Ie4543c95a6b2d7de47360737b82a6dadde704053
2021-01-07Merge "Fix missing fields when parceling the BugreportInfo" am: 2042ea04aa ↵Rhed Jao
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
2021-01-07Merge "Fix missing fields when parceling the BugreportInfo"Rhed Jao
2021-01-07Fix missing fields when parceling the BugreportInfoRhed Jao
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
2020-12-21Returns immediately if the bugreport file already existsRhed Jao
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
2020-12-21Fixes an error handling in BugreportProgressServiceRhed Jao
Calls onError function when bugreport is finished and file is empty. Bug: 174314124 Bug: 175287931 Test: atest BugreportReceiverTest Change-Id: I4542568fd2d2ad1c75c7c3b223accca4995938a3 Merged-In: I4542568fd2d2ad1c75c7c3b223accca4995938a3
2020-12-21Fix BugreportReceiverTestRhed Jao
- 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
2020-12-21Do not buzzing for each progress of bugreport notificationRhed Jao
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
2020-12-10Returns immediately if the bugreport file already existsRhed Jao
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
2020-12-10Fixes an error handling in BugreportProgressServiceRhed Jao
Calls onError function when bugreport is finished and file is empty. Bug: 174314124 Test: atest BugreportReceiverTest Change-Id: I4542568fd2d2ad1c75c7c3b223accca4995938a3
2020-11-23Replace broadcast with adding a method in BugreportCallbackPaul Chang
BUG: 154298410 Test: BetterBug can work normally in bug report shortcut flow Change-Id: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9 Merged-In: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9 (cherry picked from commit ec91d7700d9316ba09d639ab55ce94fb72d0f8ec)
2020-11-14Replace broadcast with adding a method in BugreportCallbackPaul Chang
BUG: 154298410 Test: BetterBug can work normally in bug report shortcut flow Change-Id: Ibc1a5a8ac308c303399d28eb8c177096b805fdf9
2020-11-11Add FLAG_IMMUTABLE to heap dump notification PendingIntent.Kweku Adams
Bug: 171987666 Test: Android builds Change-Id: I0be6f837e7948db8d7a50c5ef6497aeb1854acde
2020-10-28Add immutability flag to PendingIntentsGavin Corkery
Explicitly set FLAG_IMMUTABLE for all PendingIntents in BugreportProgressService. Test: Builds Bug: 170165227 Bug: 171830604 Change-Id: Iae1489b9c8fa323448e60615e99ad96aee1cd1d7
2020-10-20Apply FLAG_IMMUTABLE to various PendingIntents.Jeff Sharkey
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
2020-09-28Merge "Update language to comply with Android's inclusive language guidance" ↵Treehugger Robot
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
2020-09-28Merge "Update language to comply with Android's inclusive language guidance"Treehugger Robot
2020-08-06Remove rotation and use flag useIdentityTransform for screenshots.chaviw
There's a lot of confusing logic where 90 and 270 rotation values need to be flipped to ensure the screenshot is taken the correct orientation. There's also confusion what useIdentityTransform means, especially if a non 0 rotation value is sent. The cases screenshot cares about is the following: 1. Take screenshot in current display orientation 2. Take screenshot with 0 rotation so the caller can handle rotating the screenshot themselves. With these two cases in mind, remove the rotation value passed in for screenshots. If useIdentityTransform is true, it will rotate the screenshot so it's in the 0 orientation. If useIdentityTransform is false, it will use the current display rotation. This simplifies the caller logic since they no longer have to find the current display rotation to ensure the screenshot is taken in the current rotation. The callers can just request the screenshot with useIdentityTransform set to false. Test: adb shell screencap Test: Power + volume screenshot Test: Screen rotation Fixes: 135942984 Change-Id: I3435ee8b5dac05e910ec1e695f398c5dcdcff9e9
2020-08-03Update language to comply with Android's inclusive language guidanceAlice Kuo
See https://source.android.com/setup/contribute/respectful-code for reference #inclusivefixit Bug: 162536543 Change-Id: I468147a439c1a60488def7db3e44bfc361bddbe4
2020-06-18Fix BugreportReceiverTestRhed Jao
- 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
2020-06-09Do not buzzing for each progress of bugreport notificationRhed Jao
Only alert bugreport notification at the begining and end. Bug: 146135200 Test: Manually changing the notification settings to default from silent. Change-Id: Ie955266ad8a7a27a9dc74743e276b5e9c7a2d6fb
2020-05-22Merge "Take interactive bugreports on Android TV" into rvc-devRobin Lee
2020-05-21Take interactive bugreports on Android TVRobin Lee
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
2020-05-19Revert "Add a null home activity to Shell.apk"Isaac Chen
This reverts commit 6b1c4a9e09ea096d06351358d731290a11a1e337. Bug: 149226068 Bug: 149307007 Bug: 149780604 Test: $ lunch aosp_crosshatch-userdebug; m # flash and boot on a crosshatch # Settings -> Apps & notifications -> Default apps -> Home apps # Only Quickstep home is there; no Shell home any more $ lunch csi_arm64-userdebug; m # flash the resulted system.img on a crosshatch and boot $ atest DeviceHealthTests # all passed Change-Id: I927b7dae779da25589f2198e0480c0f2a788a7e4 Merged-In: I927b7dae779da25589f2198e0480c0f2a788a7e4 (cherry picked from commit 539298c1b9e1c0a42d041cbc845501cef289abf7)
2020-05-18Merge "Revert "Add a null home activity to Shell.apk"" into rvc-devTreeHugger Robot
2020-05-08Revert "Add a null home activity to Shell.apk"Isaac Chen
This reverts commit 6b1c4a9e09ea096d06351358d731290a11a1e337. Bug: 149226068 Bug: 149307007 Bug: 149780604 Test: $ lunch aosp_crosshatch-userdebug; m # flash and boot on a crosshatch # Settings -> Apps & notifications -> Default apps -> Home apps # Only Quickstep home is there; no Shell home any more $ lunch csi_arm64-userdebug; m # flash the resulted system.img on a crosshatch and boot $ atest DeviceHealthTests # all passed Change-Id: I927b7dae779da25589f2198e0480c0f2a788a7e4
2020-04-06Delete empty bugreport files onErrorAbhijeet Kaur
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
2020-04-03Merge "Follow best practices for Atomic variables" into rvc-devTreeHugger Robot
2020-04-02Follow best practices for Atomic variablesAbhijeet Kaur
* 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
2020-04-02Track bugreports immediately after triggering a bugreportAbhijeet Kaur
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
2020-03-31Merge "Delete bugreport file on bugreport cancel" into rvc-devTreeHugger Robot
2020-03-30Delete bugreport file on bugreport cancelAbhijeet Kaur
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
2020-03-27Merge "Initialize progress and lastProgress AtomicIntegers" into rvc-devTreeHugger Robot
2020-03-26Initialize progress and lastProgress AtomicIntegersAbhijeet Kaur
This is essential for bugreports that do not send progress updates. Bug: 152343458 Test: Take and share full bugreport Change-Id: Id634afd82a92c02d1cf96ffd719fff8670fb8709
2020-03-25Show predefined title and description in finished notificationAbhijeet Kaur
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
2020-03-18Clean up code in BugreportProgressServiceAbhijeet Kaur
* 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)
2020-02-28Clean up code of starting bug reportPaul Chang
- 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
2020-02-17Merge "Add synchronization locks to shared objects"Abhijeet Kaur
2020-02-14Add synchronization locks to shared objectsAbhijeet Kaur
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
2020-02-14Refactor bugreport files creation and getfd methodsAbhijeet Kaur
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
2020-02-07Merge "Remove duplicate directory variables with the same value"Abhijeet Kaur
2020-02-07Remove duplicate directory variables with the same valueAbhijeet Kaur
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
2020-02-07Merge "Add a null home activity to Shell.apk" am: fd2ba540df am: 24f93a2b48 ↵Automerger Merge Worker
am: 26f49e7b75 Change-Id: I77be28465d8fe8439877859e3e630103efe69c4f
2020-02-07Add a null home activity to Shell.apkIsaac Chen
In configurations where AOSP Settings.apk is not included, there might not be any home activity. E.g. CSI doesn't have Settings.apk. This CL adds a null home activity to Shell.apk, which is in CSI, so the framework can be in a sane state. Without such null home activity in CSI, package manager fails to install any APKs. Bug: 148044842 Test: $ lunch csi_arm64-userdebug; m -j # Flash CSI to a Pixel (with AVB disabled) and reboot $ m DeviceHealthChecks $ adb install $OUT/testcases/DeviceHealthTests/arm64/DeviceHealthTests.apk Performing Streamed Install Success Change-Id: I87999e30298bbe42af64f28e88fc6dc5975f1ca3
2020-01-26Remove legacy-flow no-op variables: max, realMax and realProgressAbhijeet Kaur
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
2019-10-30Merge "Move heap dump sharing to SHELL." am: c29b5cba29 am: 2cdf2d5ad7Kweku Adams
am: 215d92f880 Change-Id: Ic092f2d5c0c0a1497c19e73417c68b8e8616cc63
2019-10-29Move heap dump sharing to SHELL.Kweku Adams
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
2019-10-22Remove unused broadcasts/functions/variables from ShellAbhijeet Kaur
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
2019-10-10Read screenshot file from screenshotFiles arrayAbhijeet Kaur
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
2019-10-07Add synchronized locks to bugreport callback methodsAbhijeet Kaur
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