summaryrefslogtreecommitdiff
path: root/packages/Shell/tests/src/com
Commit message (Collapse)AuthorAgeFilesLines
* Returns immediately if the bugreport file already existsRhed Jao2020-12-101-0/+13
| | | | | | | | | | | 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-1/+14
| | | | | | | | Calls onError function when bugreport is finished and file is empty. Bug: 174314124 Test: atest BugreportReceiverTest Change-Id: I4542568fd2d2ad1c75c7c3b223accca4995938a3
* Fixes BugreportReceiverTest failedRhed Jao2020-12-101-3/+4
| | | | | | | | | Instead of sending INTENT_BUGREPORT_REQUESTED, invoke BugreportRequestedReceiver instance directly. Bug: 174832302 Test: atest BugreportReceiverTest Change-Id: I99a052d74b71d503a655a769064a74246da150e5
* Merge "Update language to comply with Android's inclusive language guidance" ↵Treehugger Robot2020-09-281-1/+1
|\ | | | | | | | | | | | | | | 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-1/+1
| |\
| | * Update language to comply with Android's inclusive language guidanceAlice Kuo2020-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference #inclusivefixit Bug: 162536543 Change-Id: I468147a439c1a60488def7db3e44bfc361bddbe4
* | | Fix BugreportReceiverTestRhed Jao2020-06-182-394/+305
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | Remove legacy-flow no-op variables: max, realMax and realProgressAbhijeet Kaur2020-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Remove unused broadcasts/functions/variables from ShellAbhijeet Kaur2019-10-221-2/+4
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Migrate frameworks/base/packages/Shell to androidx.testKOUSHIK PANUGANTI2019-03-202-35/+34
| | | | | | | See go/jetpack-test-android-migration Test: mmma frameworks/base/packages/Shell Change-Id: I26076b3ad1871dde3ef6b206bf5502648d1a0cbb
* Only require that system UIDs tag their sockets.Jeff Sharkey2017-06-271-1/+1
| | | | | | | | | | | | | Apps with a normal UID are typically isolated enough to not require socket tagging; we're mostly interested in tracking down internal UIDs that have lots of code sharing the same UID. Also fix up everyone doing manual string checks of Build.TYPE, since we now have first-class fields for those. Bug: 38126076 Test: builds, boots Change-Id: I3a40348196bd8459289f2b9355d9783a07f1e7dd
* Fixed assertions on bugreport share notification.Felipe Leme2017-05-241-13/+19
| | | | | | | Fixes: 36698286 Test: mmm -j32 frameworks/base/packages/Shell && adb install -r -g ${OUT}/data/app/ShellTests/ShellTests.apk && adb shell am instrument -e class com.android.shell.BugreportReceiverTest$1 -w com.android.shell.tests/android.support.test.runner.AndroidJUnitRunner Change-Id: I0f3586309103a07afca5be3d1e3073d8a5dd04ec
* Set package name on bugreport intents.Felipe Leme2017-02-101-0/+2
| | | | | | BUG: 35257764 Test: BugreportReceiverTest passes Change-Id: Ia6ff03b2a12ab9987f5b36fa1da88e9c77af18a2
* Bugreport sharing is now work profile awareMakoto Onuki2017-01-051-0/+351
| | | | | | | | | | | | | | | Now we look at work profile too, if available, when looking for a preferred email address. TODO: The chooser activity should default to work profile too, but it seems to require a lot more work, so not done yet. Test: manual tests Test: adb shell am instrument -w -e class com.android.shell.BugreportProgressServiceTest com.android.shell.tests Bug 30865666 Change-Id: I9b4776d53455a23bfdc4960da25e98bd1dc1b2a1
* Refactored Shell to use IDumpstateListener.Felipe Leme2016-11-111-3/+8
| | | | | | | | | | | | | | BugreportProgressService used to poll system properties to get the progress of the underlying dumpstate process, but now dumpstate provides a IDumpstateListener and IDumpstateToken binder objects for the same purpose. Test: BugreportReceiverTest passes Test: manual verification BUG: 31636879 Change-Id: I81d551781a511cb1cc218a27452875b0bb267f7a
* Collapses status bar on teardown so it does not affect other tests.Felipe Leme2016-10-112-3/+8
| | | | | | | | BUG: 30639703 Test: mmm -j32 frameworks/base/packages/Shell && adb install -r -g ${ANDROID_PRODUCT_OUT}/data/app/ShellTests/ShellTests.apk && adb shell am instrument -e class com.android.shell.BugreportReceiverTest -w com.android.shell.tests/android.support.test.runner.AndroidJUnitRunner Change-Id: I2635439ac0c033d1ad6b4ba545b8d751f5576b72
* Migrate BugreportReceiverTest to JUnit 4.Felipe Leme2016-08-121-9/+54
| | | | | | BUG: 30839080 Change-Id: I4af0d9ba26eb07dd78f1eef26c4edb7d3e03f582
* Kill service before trying to cancel notifications.Felipe Leme2016-08-081-0/+24
| | | | | BUG: 30639703 Change-Id: Ib564371797e31e1dde37416efdb89641fb3024b1
* Enable name text field when re-using the details dialog.Felipe Leme2016-08-031-0/+2
| | | | | Change-Id: I10671fc00ea918da901f36f122641e646057888c Fixes: 30642226
* Fixed BugreportReceiverTest failures:Felipe Leme2016-08-032-52/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | - testProgress_changeJustDetailsTouchingNotification was failing because the notification mechanism changed and now provides a way to expand and collapse the actions bar, and the test was collapsing it instead of opening the details dialog. It was fixed by tapping the notification content instead of the notification title. - Similarly, openProgressNotification() was refactored to use the bugreport name instead of id. - Uses getObject() (instead of getVisibleObject()) to get the activity from the intent chooser. - Removed the redundant call to back to dismiss the keyboard, which was causing some tests to fail due to an accessibility bug. - Retry a few times in case the bugreport name system property assertion fails, since the property is set by a background thread. - Improved how notifications are canceled. - Created a sleep() helper. Besides the test case improvements, it also removed a redundant call to setCancelable() in the main code. BUG: 30641229 BUG: 30639703 Change-Id: Icd79fada22d0b8e4be034068c3e9143ef0134eed
* Always use chooser for Share Bug Report intent.Felipe Leme2016-07-282-43/+12
| | | | | | | | | When using startActivity(intent), the platform allows the user to pick the same activity for the intent, which can be a problem for sharing bug reports when the device has personal and work profiles. Change-Id: I1fd66905feb5d894307bbe5656c2aec705a59ab7 Fixes: 22115530
* Close details dialog when bugreport is canceled by user.Felipe Leme2016-07-182-7/+54
| | | | | BUG: 30158896 Change-Id: I0eab22586f6b431f2abe837088d48a655e03d213
* Don't opt-out of warning dialog by default on user builds.Felipe Leme2016-04-251-1/+9
| | | | | BUG: 28341946 Change-Id: I9ce6bf52a02a14055d4ded41aac50c79abdb4ee9
* Set BugreportProgressService to run on foreground.Felipe Leme2016-04-201-41/+1
| | | | | | | | | | | | BugreportProgressService do not persist the user-provided information (like details and screenshot paths), so if it's killed by the framework, that info is lost. Running it as foreground mitigates the changes of it being killed. BUG: 27431998 BUG: 28291423 Change-Id: I2f58507beb38309628f2f19d3f7f950d07eca16f
* Merge "Remove initial screenshot on interactive bugreport." into nyc-devTreeHugger Robot2016-04-181-7/+9
|\
| * Remove initial screenshot on interactive bugreport.Felipe Leme2016-04-181-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the changes in the 'interactive bugreport' bugreport workflow introduced on N is that the initial screenshot was taken right away (by Shell, not dumpstate). Unfortunately, such initial screenshot is often delayed when the system is overload. Also, if the user is not interested in a screenshot, it would be adding more load on the system unnecessarily. Given these issues, and the fact that the user can still easily take an initial screenhsot by selecting the proper notification action, the initial screenshot is being removed. BUG: 28167977 Change-Id: I2cf6616ce3124102b62ec9a36dc5a0ce6455a909
* | Fix first-time usage.Felipe Leme2016-04-152-16/+25
|/ | | | | | | | | When tests run for the first time, the list of activities that can handle ACTION_SEND_MULTIPLE might not be scrollable, which was cause the scrollForward() method to fail. BUG: 27431998 Change-Id: I5992bc9fec6291c74c4af7887ee66eb4f96e87c0
* Merge "Revert warning logic so it has a "don't show again" message." into ↵TreeHugger Robot2016-04-131-15/+46
|\ | | | | | | nyc-dev
| * Revert warning logic so it has a "don't show again" message.Felipe Leme2016-04-131-15/+46
| | | | | | | | | | | | BUG: 28140003 Change-Id: I93e7b1494a0f4c5ca080fbe9dd94dc2168092ffa
* | Removed redundant notification title.Felipe Leme2016-04-121-17/+4
|/ | | | | | | | | When a bugreport is finished with a pending notification, it already display a subtext explaining the situation - not only the extra title is redundant, but it's too large. BUG: 27583025 Change-Id: I8d8171faf7b8b86b34f6d860555839918be10550
* "Temporarily" removed progress check.Felipe Leme2016-04-111-20/+15
| | | | | | | | | | | | The code that asserts the right progress is displayed was based on the percentage text displayed in the system notification, but such text is gone. Since UIObject doesn't easily expose the underlying ProgressBar, such checks were temporarily disabled. BUG: 28114251 Change-Id: Idb64fe97cf84f5f73e08e293b8fd0384bc8b70d6
* Changed logic when dumpstate's max progress increases.Felipe Leme2016-03-222-5/+28
| | | | | | | | | | | | | | | | | | | | | When dumpstate starts, it estimates its maximum duration and sends it through an extra on BUGREPORT_STARTED; as it progress, it sets a system property with its current progress and if the progress value overflows the estimated max, it increases the max as well. Shell uses the max/progress to display the progress % in the system notification, and need to handle the scenario where the max changes. The initial implementation would recalculate the progress, with makes it swing back and forth as dumpstate increases the max. This CL changes the Shell logic so the progress never go back, just forward. The drawback of this approach is that if dumpstate underestimate the maximum, the progress might get stuck in a high value (99%) early on, but such issue will be addressed in the long term by tuning the estimated max value. BUG: 26354314 Change-Id: I3a5416acaffaaa43fd28d2f1f8ec8ea12aa0d91e
* Minor UI improvements and code cleanup:Felipe Leme2016-03-141-13/+18
| | | | | | | | | | | | - Removed initial selection of name field. - Set notification type as system. - Refactored some notification code. - Removed initial focus on details UI. BUG: 26906985 BUG: 27494227 Change-Id: I5aab95c06830da3850331a2dba09abae88cf59fc
* Warn user when bugreport is finished but screenshot is pending.Felipe Leme2016-03-091-6/+18
| | | | | BUG: 27524556 Change-Id: Iaecdd01605dc4b01cdf669baf443eaee7fb20f6f
* Make bugreport details dialog confirm to Material Guidelines for Dialogs.Felipe Leme2016-02-291-4/+4
| | | | | | | | | | | | | | | Changes: - Removed hints. - Added TextViews for field labels. - Added padding for inner dialog - Adedd autoCorrect and capSentences to title and summary - Changed strings. - Set name to be selectAllOnFocus initially. Also improved some logging statements. BUG: 26324085 Change-Id: I32597a7c2839ca706dbbcf13660e976469ab8dd0
* Open bugreport info when touching notification (as well as DETAILS button).Felipe Leme2016-02-251-6/+45
| | | | | | | Also added test case for CANCEL button on system notification. BUG: 26906985 Change-Id: I92eac2e5ec18a8d1d4412f5c1832a52705caf3b3
* Reset UI fields when dialog is reused, otherwise it might contain fieldsFelipe Leme2016-02-251-11/+93
| | | | | | | from a previous bug report. BUG: 26524513 Change-Id: If9d176806b28120b57dddeb62b636065f8ff7cf6
* Final (?) fixes on id / pid split.Felipe Leme2016-02-251-57/+63
| | | | | | | | | | | | | | | | | | The main goal of this CL was to change the test cases to send an EXTRA_ID instead of EXTRA_PID, but in changing that it was revealed 2 minor bugs: - When setting the name property, it was using id instead of pid (which is what dumpstate expects). - When the pid is replaced by the name in the screenshots, it would be replaced twice if the pid was small enough (because the call to String.replace() would also replace the counter). This CL fixes these issues, and removes the temporary assignment of id = pid when the former is missing. BUG: 27076108 Change-Id: I70e7ce7d145019438272594686ac0d4d5dbe1723
* Add pid on main bugreport notifications.Felipe Leme2016-02-081-35/+44
| | | | | | | | Showing the pid is useful in many cases, like when one bug report is finished and another one is in progress. BUG: 26906985 Change-Id: Ib8ae462c85246b99234f8dac63edb608d1eafeb0
* Fixed check for empty title.Felipe Leme2016-01-291-9/+28
| | | | | | | | Otherwise, if user entered "Details" but not "Summary", the ACTION_SEND_MULTIPLE subject would be empty. BUG: 26768595 Change-Id: I955ab5e8f05eba9fbfa6fe65eabb6a8a8e28c5b4
* Send broadcasts as foreground, otherwise test might fail when runningFelipe Leme2016-01-261-0/+2
| | | | | | | after reboot. BUG: 26805230 Change-Id: I05dcf9871c9b4c4c9a465466d60ebe9a1ac63e51
* Save bugreport info on share intent.Felipe Leme2016-01-131-11/+111
| | | | | | | | | | | | | | | | | | When a bugreport is finished, BugreportProgressService sends a INTENT_BUGREPORT_SHARE intent containing the bugreport pid; then when the user clicks the share notification, BugreportProgressService uses the pid to retrieve the bugreport info. The problem with this approach is that if the service dies before the user clicks the notification, the bugreport won't be shared. This change fix this scenario by saving the bugreport info in the share intent. BUG: 26513652 Also added more logging statements. Change-Id: Iba86d06369f843ad88194fb1dad0c8b69764df78
* Include title and description on bugreport.zipFelipe Leme2016-01-061-20/+75
| | | | | | | | | | | | | | | | | Prior to this change, the user-provide title and description were only used in the ACTION_SEND_MULTIPLE intent, which was fine for the cases where the user share the bug report with an app that used intent extras (like an email app). But if the app did not use the extras, or if the user did not share the bug report right away, the info supplied by the user would be lost. With this change, such info will be saved into 2 new zip entries, title.txt and description.txt BUG: 26403310 Change-Id: I888364d14d67fb4e2f2c26cb66b21576d7ce13b4
* Fixed corner-case scenario where a screenshot is finished after the shareFelipe Leme2016-01-061-9/+31
| | | | | | | | | | | | | | | | notification is sent. Prior to this change, if a screenshot finished after the share notification was sent, it would replace the share notification with a progress notification, and the share notification would never be sent again. Also improved the test cases that automatically generate a screenshot but don't use it to wait for the screenshot to finish before proceeding, otherwise it could cause a future test to fail (if the screenshot is finished after the initial test is completed). Change-Id: I6e2a6549ebb48e5bebf5aa78d1bda94404c1812b
* Handle bugreport screenshots on Shell.Felipe Leme2015-12-211-17/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the bugreport screenshots are taken by dumpstate and passed to Shell as a path on BUGREPORT_RECEIVED; this change not only delegates the screenshot taking to Shell, but also allows user to take more screenshots while the bugreport is being generated. As a result of this change, the final ACTION_SEND_MULTIPLE intent might contain multiple screenshot attachments, all of them named "screenshot-PREFIX-NUMBER.png", where PREFIX is the bugreport name (either initial date provided by dumpstate or a name entered by the user) and NUMBER is the sequential number of the screenshot as taken by the user. The screenshot is taken using screencap, which not only is simpler than using Framework APIs, but also faster and less intrusive. The only drawback is that it might fail if an OEM is not providing screencap; if that happens in the field, we'll need to add fallback option to do it using such APIs. Prior to this change, all work done on BugreportProgressService was executed in one single thread (through the ServiceHandler class) but the code was guarded by unnecessary synchronization. Now there is another thread (ScreenshotHandler) that will be used just for taking the screenshot (so it doesn't handle the main thread). Despite the addition of a new thread, the code was simplified to remove most synchronization locks, excepted for the areas touched by both threads. Once this change is submitted, the bugreport service will be changed so it does not ask dumpstate to take a screenshot. BUG: 26274653 Change-Id: I1df883e3c0ca6e3e3cad2522a6a99585f71abb75
* Allows users to add details about a bugreport in progress.Felipe Leme2015-12-163-6/+226
| | | | | | | | | | | | | | | | | | | | The "bugreport in progress" notification now have a "DETAILS" button that when clicked opens a dialog window displaying the following fields: - Name: short name for the bugreport, will be used as part of the final files (and by default is the timestamp sent by dumpstate) - Title: a 1-line title for the bugreport, will be used as the subject in the final message. - Description: a detailed description for the bug. The main advantage of such dialog is that it allows users to enter more info about a bugreport while it's being generated, rather then when the bugreport is finished (since of the user doesn't remember what the context was when the problem happened). BUG: 25794470 BUG: 10676443 Change-Id: I0d1dba2a94ad989e541415a2a59475619a2e3d13
* Merge "Fixed ActivityChooser logic for the initial case."Felipe Leme2015-12-141-11/+10
|\
| * Fixed ActivityChooser logic for the initial case.Felipe Leme2015-12-111-11/+10
| | | | | | | | | | | | | | | | When ActionSendMultipleConsumerActivity is not the default action, it just need to be selected, without clicking 'Just Once' BUG: 25752530 Change-Id: I111063aa0dbba37e0cac8f0572f43a48c659e975
* | Merge "Cleaned up unit tests."Felipe Leme2015-12-121-47/+89
|\ \ | |/ |/|
| * Cleaned up unit tests.Felipe Leme2015-12-111-47/+89
| | | | | | | | | | | | | | | | This refactoring will make it easier to add new test cases for the upcoming bugreport details notification. BUG: 25794470 Change-Id: I0bf6ab54a7b4aa1dfa51ad0354682e5764b8a209