History log of /frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
05a4e8f45dbcc7ff52b2c4a5095f655657da0a7e 30-May-2017 Amith Yamasani <yamasani@google.com> Fix #62169466 bug report sharing options empty

Was caused by a new requirement to not offer to show
non-exported intent handlers as options. For first
time warning dialog, don't show a chooser activity.

Change-Id: Ibada9a7a14b77ec0670bf35ba0944f369d42bf69
Fixes: 62169466
Test: manual
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
(cherry picked from commit 1d6e1759d2337240627b9dd30d221390843cbb4d)
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
22291dde0a639d1ede614455f45b44cd67e1035e 24-May-2017 Makoto Onuki <omakoto@google.com> Working around bugreport crash issues

Overall we need more synchronization, but I'm taking a safe approach
here for oc-dev for now.

Bug: 62043115
Test: adb shell am instrument -w com.android.shell.tests
Change-Id: I0e22c5160cb96ce51dc1775237f01b7bf5c97a17
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
6483b86a929f33ef34753cb4678f623c54ff483c 23-May-2017 Bryce Lee <brycelee@google.com> Add new task flag when starting chooser activity in bug report.

This flag is required whenever starting an activity from a
non-activity context.

Change-Id: Ia77e6e7801d712a20d407bc2ac92e543bc287010
Fixes: 62016780
Test: Click on generated bug report notification
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
c6cf2b807281c82d9cf7d018b703b2f21388f7a5 21-Apr-2017 Makoto Onuki <omakoto@google.com> Only show progress log every 10%

Bug: 37501913
Test: manual
Change-Id: Ib7d14da0af33d39aa29b0b58c63c51e1059e0ada
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
ca3d5434e8bc02a8e95ceef343f734d1d6e4b52a 17-Mar-2017 Naveen Kalla <mrnaveen@google.com> Add API to request Bug Report with a certain title and description

ActivityManagerService will send the details to dumpstate and
BugreportProgressService will get the details from dumpstate and use
that for the notification.

Bug: 33561517
Test: Modify TelephonyMonitor to use this API and ensure that the
notification uses that the title and description sent as arguments
to the API. File a bug using betterBug and ensure that the
information gets populated automatically.

Change-Id: I455f1df2278e5d569dd19c74245a0704dcf5a321
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
ce42134828da4794042112204e854d3a61c78672 13-Mar-2017 Dmitri Plotnikov <dplotnikov@google.com> Enabling bugreport notifications on TV

Bug: 36175844
Test: by generating a bugreport (long-press DPAD_CENTER + BACK)
Test: verified that BugreportProgressServiceTest still passes
Change-Id: If5bf53512c60a359838aa76dc61b90d4e67a45df
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
f631ef769ad718f9ce52955d67623fa67a942cd5 24-Feb-2017 Jorim Jaggi <jjaggi@google.com> Fix sharing bugreports from lockscreen

When launching ChooserActivity from lockscreen, we will start it
in stopped state because lockscreen is still showing, meaning that
the activity goes through start -> resume -> pause -> stop
immediately after it was launched, and will be later resumed once
Keyguard actually goes away.

However, ResolverActivity finished itself in onStop. We add a
private extra to change this behavior for sharing bugreports.

Test: Take bugreport, double tap on it on lockscreen
Test: com.android.shell.BugreportReceiverTest$1
Bug: 33009364
Change-Id: I973b2c71587950499b7c88b16af9cf1387795e17
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
92aaaa21ee9178e7bd52fb465449566a5e1d9da7 16-Feb-2017 Felipe Leme <felipeal@google.com> Moved bugreport intents to the com.android.internal namespace.

Change-Id: I5ad53668b9393188cee4d8b0382f9c303ff95777
Fixes: 35275802
Test: manual verification
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
ccb258d001bd6b09a0e4fbbdb4ecd8951961e3e8 14-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Added more logging on BugreportProgressService."
ec60e5f40c3041247be4549bbca0a384bb363d14 11-Feb-2017 Felipe Leme <felipeal@google.com> Added more logging on BugreportProgressService.

BUG: 35010191
BUG: 35077822

Test: manual verification
Test: BugreportReceiverTest passes
Change-Id: Iaa37f633c6415127a3efa07c166f5a771a13ff5a
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
17d9e9c36d789061782592a83e20144e991cd0cb 11-Feb-2017 Felipe Leme <felipeal@google.com> Dismiss keyguard before displaying bugrepot details dialog.

Fixes: 27494228
Test: manual verification
Test: BugreportReceiverTest passes

Change-Id: I7755fc2d3d4f1f9b55301c65f7a58c9374e93664
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
ff329c43299db1e45a42bb927713cf17a3436115 05-Jan-2017 Makoto Onuki <omakoto@google.com> Bugreport sharing is now work profile aware

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
fa26a0ed08fe3f14fe5be708ec6a9d9c30ecbff7 28-Oct-2016 Felipe Leme <felipeal@google.com> Refactored Shell to use IDumpstateListener.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
383db5ebcc3a4a615faf249bf4f126f42e80b82e 22-Jun-2016 Tamas Berghammer <tberghammer@google.com> Update package names to work with the proto3 compiler

Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
1a83dede85a0ad6e973174dc011e460db846ffc1 21-Sep-2016 Felipe Leme <felipeal@google.com> Use a system property to call different bugreport types.

Currently, we define 4 hardcoded init services to launch dumpstate with
different command-line options (since dumpstate must be launched by
root):

- bugreport
- bugreportplus
- bugreportwear
- bugreportremote

This approach does not scale well; a better option is to have just one
service, and let the framework pass the extra arguments through a system
property.

BUG: 31649719

Test: manual
Change-Id: I1d627a73bfbdd9930c605fa4468c15282a23bb65
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
034bcf425a0d8ac9032853b1a929fcb7bdc42229 09-Aug-2016 Felipe Leme <felipeal@google.com> Cancel dialog before stopping service.

Fixes: 30746086

Change-Id: Iea8a197a2785259dd80aa8130d79ded484562826
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
da1fbdd6f27534edd458b682409592da8415abd6 04-Aug-2016 Felipe Leme <felipeal@google.com> Enable name text field when re-using the details dialog.

Change-Id: I10671fc00ea918da901f36f122641e646057888c
Fixes: 30642226
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
ca5002f6bde51c0dc80281a821650ab28f36b39c 03-Aug-2016 Felipe Leme <felipeal@google.com> Fixed BugreportReceiverTest failures:

- 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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
b4027a01e3b5bfbee42153cb86624c9dd2a5d3d8 29-Jul-2016 Felipe Leme <felipeal@google.com> Use SurfaceControl.screenshot() instead of screencap for screenshots.

*** cherrypick of 8cfc23f ***

Change-Id: I5a9e7bbc5f3ae176ac5ae7209a133526992e92d4
Fixes: 30429392
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
91699af8c6dae2a3ca703abc410fc00c0ab5de59 29-Jul-2016 Felipe Leme <felipeal@google.com> Always use chooser for Share Bug Report intent.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
213b94ee1ae3725ccebc2084dae6fcc5152d4e05 19-Jul-2016 Wei Liu <luciferleo@google.com> Merge \\"Use the Shell app to show the bugreport notification on Wear.\\" into nyc-mr1-dev am: 1dfbf794b5
am: bc3c068189

Change-Id: I4555c232c5fc9d10a9b9d9cd0d64ac80720e30e9
9f3554176019543e654be7dba5410de2bbe3b55f 13-Jul-2016 Wei Liu <luciferleo@google.com> Use the Shell app to show the bugreport notification on Wear.

b/30041885

Change-Id: I998aa1606eb12f74a407fbafd9abc11c9454fb66
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
a86a3012ef689af659261b209da86f2e24ac21ec 15-Jul-2016 Felipe Leme <felipeal@google.com> Close details dialog when bugreport is canceled by user.

BUG: 30158896
Change-Id: I0eab22586f6b431f2abe837088d48a655e03d213
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
c6905cfb1133627dfd500491c60b6528a3e593e0 17-May-2016 Ben Lin <linben@google.com> Register change Uri and notify changes in bugreportServices.

Bug: 28767380
Change-Id: Ia4d1f5a2e44881d300f2869c628d4990406caf40
(cherry picked from commit 6c9ff513c6d7d3de7ab8920d88111c2b1dc1bb1f)
(cherry picked from commit 93fafd67a6127a35ba9b7a0f7de3a0b54309d4c2)
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
93fafd67a6127a35ba9b7a0f7de3a0b54309d4c2 17-May-2016 Ben Lin <linben@google.com> Register change Uri and notify changes in bugreportServices.

Bug: 28767380
Change-Id: Ia4d1f5a2e44881d300f2869c628d4990406caf40
(cherry picked from commit 6c9ff513c6d7d3de7ab8920d88111c2b1dc1bb1f)
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
45a905bbafcbcbf89933e9b9226977995bae1afa 22-Apr-2016 Felipe Leme <felipeal@google.com> Show a toast when details cannot be added to zip file.

BUG: 28291423
Change-Id: I7febf66ef23f38b41fb1909324ee2260444518f6
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
69c53e65b941235a8d2e193d5b9a783f7787af0d 15-Apr-2016 Felipe Leme <felipeal@google.com> Set BugreportProgressService to run on foreground.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
03046888822d07ec020eb7a2f685be4f7bcded31 20-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Only try to add details to zip once." into nyc-dev
51a4ede593b1bba96d7cc14fca54e8e5f02850e0 20-Apr-2016 Felipe Leme <felipeal@google.com> Only try to add details to zip once.

When the user enters details (title or description) to the bugreport,
Shell tries to add a title.txt (and/or description.txt) to the zip and
uses 2 instance variables (addedDetailsToZip and addingDetailsToZip) to
control its state.

The problem with the current approach is that if there is a failure
adding the entries (for example, if the entries already exist), these
variables are not updated and hence when the user taps Share, it will
try to add the entries again, which most likely would fail.

BUG: 28291423
Change-Id: I56a71256be4f8de15f8126b815334277319e8e8a
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
65a9c6760ef6cf1c8e1762a271aa43c626d27048 19-Apr-2016 Felipe Leme <felipeal@google.com> Show "Android System" instead of "Shell" on notifications.

BUG: 26517701
Change-Id: If2543b8db0fdd913365df6f69cf26146d32d4b15
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
079f89614c49364bb907783b008827fbc306dd73 18-Apr-2016 Felipe Leme <felipeal@google.com> Remove initial screenshot on interactive bugreport.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
7fd1cbd49d0ace00c65229f65252136902aedaf3 13-Apr-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Revert warning logic so it has a "don't show again" message." into nyc-dev
fcca68dfb137c061952d23e1873e995e6bcf172d 12-Apr-2016 Felipe Leme <felipeal@google.com> Revert warning logic so it has a "don't show again" message.

BUG: 28140003

Change-Id: I93e7b1494a0f4c5ca080fbe9dd94dc2168092ffa
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
a43d139359346ad57604e8335d92de57f3d47171 13-Apr-2016 Felipe Leme <felipeal@google.com> Removed redundant notification title.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
e1b1ce77da273da6fc89d04a9c8ec09d0d8adca1 12-Apr-2016 Felipe Leme <felipeal@google.com> Merge "Minor improvements useful for debugging." into nyc-dev
bc3b0458bf4281a92f65dc98d87ad6ff40c92f98 06-Apr-2016 Selim Cinek <cinek@google.com> Fixed the contentinfo api usage in the bugreport

Removed the percentage shown in the header and
migrated the name to the subtext as contentinfo
was deprecated.

Change-Id: Ifd79a67cad8958049bd29b8eb4c9bcbb4822688b
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
abeab723d10b56302b86b1929ea994cf4a861fd0 04-Apr-2016 Felipe Leme <felipeal@google.com> Minor improvements useful for debugging.

- Better dump of received intents by displayed the relevant extras.
- Gracefully handles the case where the bugreport file URI is invalid
during development.

BUG: 27996121
Change-Id: I97a48d1e9641142a43c66c1dded2f7f322dc66aa
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
1ae5a69bc495154d0baf504caa95d7eddbc7177c 23-Mar-2016 Felipe Leme <felipeal@google.com> Proper handle of duplicated BUGREPORT_STARTED.

When Shell receives a BUGREPORT_STARTED intent for a process it's
already monitoring, it should completely ignore it, but current it's
taking an extra screenshot.

BUG: 27804637
Change-Id: I733cacfee5e9c82646a3295b50c3856b6e0352c3
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
3fc44b9a6274254e8d3a53b6b1e245c5f9177229 22-Mar-2016 Felipe Leme <felipeal@google.com> Changed logic when dumpstate's max progress increases.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
f3a65fd31798f8c7ecfa0f3db292d115c10c3dbc 16-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Minor UI improvements and code cleanup:" into nyc-dev
213e355c77993c718298c89bc04908a0d6c5addd 15-Mar-2016 Felipe Leme <felipeal@google.com> Handle AccountManager failures so Shell doesn't crash.

BUG: 27665208
Change-Id: Iccb6ce810c8e1c93bded58871d7ec220b7d14ba9
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
208b1881ae924cd0c2bed326555e4aa18424d927 15-Mar-2016 Felipe Leme <felipeal@google.com> Minor UI improvements and code cleanup:

- 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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
bded63d9c9a01c73d3f41d5883b24b93a4816e41 12-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Don't log metrics for initial screenshot." into nyc-dev
52ca701cd4e1363d562b0f418d45b3420e207a6b 11-Mar-2016 Felipe Leme <felipeal@google.com> Don't log metrics for initial screenshot.

BUG: 26759986
Change-Id: Ie1ff6626bb3174efa12c7cefe14782f4c18fb6d2
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
010859739552709ae2f0e51472bf5a650967280e 09-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Warn user when bugreport is finished but screenshot is pending." into nyc-dev
509d407e308079e562663608473fc7ee9c009382 09-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Vibrate after a screenshot is taken, not before." into nyc-dev
5ee846dd18022307341c9808c9aacded2b2f60fd 09-Mar-2016 Felipe Leme <felipeal@google.com> Warn user when bugreport is finished but screenshot is pending.

BUG: 27524556
Change-Id: Iaecdd01605dc4b01cdf669baf443eaee7fb20f6f
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
aa00f2d909dcc48b61b9338cd2ab7c33850a69d9 09-Mar-2016 Felipe Leme <felipeal@google.com> Vibrate after a screenshot is taken, not before.

BUG: 27389320
Change-Id: I383b4252a80ae2f1d820a97b9deb930dccf50313
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
d06e5afd6fef030e731d6c92166dbff70844f88f 08-Mar-2016 Felipe Leme <felipeal@google.com> Merge "Minor improvements on BugreportProgressService:" into nyc-dev
4f663f6c25488a83a438a01dfef8372aa4e6b2aa 08-Mar-2016 Felipe Leme <felipeal@google.com> Minor improvements on BugreportProgressService:

- Removed unnecessary ContextWrapper used to get files dir.
- Immproved logging.

BUG: 27548183
BUG: 27524556
Change-Id: Ia04c6b7640969e0013ae282efbb1142fc0fc5695
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
0f2daaf2f7f0f9a35512e452231fd34e743ddc51 08-Mar-2016 Felipe Leme <felipeal@google.com> Call stopSelfWhenDone() *after* canceling the notification.

When a bugreport is shared it's necessary to remove its system notification and
stop the service if there is no more pending bugreports. Since the
service will might be killed as a result, to call to cancel the
notification must be done prior to calling stopSelf().

BUG: 27524556
Change-Id: Iae9a263b6cee0e4a0a7df3e52621e56b50983fec
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
2552f8aec44d03aa001759a0376c25411ec62c28 04-Mar-2016 Michal Karpinski <mkarpinski@google.com> Do not re-define remote bugreport constants defined in DevicePolicyManager

Bug: 26226230
Change-Id: Ib26d8ba872b1ebdf24b43312daa1d04b90a7f393
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
bbd91e58444f092e1080f5a0a746fcd4b21ce113 27-Feb-2016 Felipe Leme <felipeal@google.com> Make bugreport details dialog confirm to Material Guidelines for Dialogs.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
1e33af88edf3109bc8e6484c5f66e259a247cd01 26-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Open bugreport info when touching notification (as well as DETAILS button)." into nyc-dev
db31363aa9670dbbc5837af7a04bdd8012493fd7 26-Feb-2016 Felipe Leme <felipeal@google.com> Open bugreport info when touching notification (as well as DETAILS button).

Also added test case for CANCEL button on system notification.

BUG: 26906985
Change-Id: I92eac2e5ec18a8d1d4412f5c1832a52705caf3b3
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
17fc60e13c2a3b78c0f613d46355e23664fd69f3 26-Feb-2016 Felipe Leme <felipeal@google.com> Merge "Using Message.obtain() to decrease number of Messages allocated." into nyc-dev
8648a15406d43c8af12e9cfe2355b1eee201d479 26-Feb-2016 Felipe Leme <felipeal@google.com> Using Message.obtain() to decrease number of Messages allocated.

BUG: 26906985
Change-Id: Ide8c6e308dcc83e9627ec775a4d977d17cd2f0a9
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
5d9000aa45c19de0e7ec4131c1aca3d366e9a793 25-Feb-2016 Felipe Leme <felipeal@google.com> Removed toast messsage sent after screenshot is taken.

That toast was kind of reduntant (since the phone already vibrates
before taking a screenshot) and often useless (because it was displayed
seconds after requested).

BUG: 26577203
Change-Id: I0ba6f974eefd473d158f7fefb12f6a5d2a50b772
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
262887834c7938b7a7bbbd7ef026b5965d6412fc 25-Feb-2016 Felipe Leme <felipeal@google.com> Reset UI fields when dialog is reused, otherwise it might contain fields
from a previous bug report.

BUG: 26524513
Change-Id: If9d176806b28120b57dddeb62b636065f8ff7cf6
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
85ae3cf46ad66d71e5a29a93e89a0f569d74288b 25-Feb-2016 Felipe Leme <felipeal@google.com> Final (?) fixes on id / pid split.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
510e922e47fec69839dd48c5473540f93d79a508 23-Feb-2016 Felipe Leme <felipeal@google.com> Created counter (tron_varz_dumpstate_duration) for dumpstate duration.

BUG: 26759986
Change-Id: I18534c127b35776a03e31b9d5cd190d864dff9e6
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
6605bd89c53494b59717a826f9a17641bc32da41 23-Feb-2016 Felipe Leme <felipeal@google.com> Initial implementation of logging metrics for bugreport.

This change logs the following user actions:

- Interactive bug report initiated from power menu.
- Full bug report initiated from power menu.
- Bug report canceled using system notification.
- Bug report details screen open using system notification.
- Additional Bug report screen shot taken using system notification.
- User changed bug report name using the details screen.
- User changed bug report title using the details screen.
- User changed bug report description using the details screen.
- Changes made on bug report details screen were saved by user.
- Changes made on bug report details screen were canceled by user.

BUG: 26759986
Change-Id: I1aae98b87a4dea66a1030a024dd799b97c25dd6d
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
1eee1996f5d57b42d4beed2790321480fbe03a4c 16-Feb-2016 Felipe Leme <felipeal@google.com> Cancel notifications when user tap on Details or Take Screenshot after
service died.

There are scenarios when the user is running low on resources and it
kills Shell after it start monitoring a dumpstate process, in which case
the BugreportInfo is not available anymore when the user tap a
notification action.

We could add a mechanism to recover that info (like persistenting the
user-provided values in a shared preference), but would incur in more
costs when the device is already in a resource-constrained state, so
it's better to just stop monitoring and switch back to the traditional
model where the user is notified after the bugreport finishes (the
drawback is that all user-provided information will be lost).

Also improved how info.name is checked to avoid crash in similar cases.

BUG: 27186542
BUG: 27203559
Change-Id: I57076b098a3fce493e1a27121b6e070366808668
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
fd8ea077c0ded14002c32ee346df4fa22a30625a 09-Feb-2016 Felipe Leme <felipeal@google.com> Split bugreport identifier into id and pid.

Although 'pid' is more useful when diagnosing problems with the
bugreport workflow, it could be confusing to the end user. Hence, a
sequential id (started at 1 after a reboot) would be more useful, and this CL changes Shell to accommodate such id (dumpstate will be changed separately).

BUG: 27076108
Change-Id: I5c42dc49a100b43266787d4f79698a22a4e533a9
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
e86b63bd17da3d347b9392f897e361919655edd6 08-Feb-2016 Felipe Leme <felipeal@google.com> Add pid on main bugreport notifications.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
af6fd4086c8f24e8b70a810fe83081b67e5db236 30-Jan-2016 Felipe Leme <felipeal@google.com> Added extra sanity checks.

BUG: 26795255
BUG: 26805503
Change-Id: Ib95b337e54a174f178f70205f9d108223f192a62
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
c8e2b6092c0fbf87e71f81fd2cffbb29ff8d9039 29-Jan-2016 Felipe Leme <felipeal@google.com> Fixed check for empty title.

Otherwise, if user entered "Details" but not "Summary", the
ACTION_SEND_MULTIPLE subject would be empty.

BUG: 26768595
Change-Id: I955ab5e8f05eba9fbfa6fe65eabb6a8a8e28c5b4
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
18b5892950b7f21e66c9268129323cbc0e865699 29-Jan-2016 Felipe Leme <felipeal@google.com> Added entries to zip file before sending the share notification.

BUG: 26616935
Change-Id: I072d57456b2090c7c5e75eea7834d3cdce44ed4a
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
2758d5d93970f26867d778c944605371e55b751e 19-Jan-2016 Felipe Leme <felipeal@google.com> Updates notification while bugreport zip is being changed.

BUG: 26616935

Change-Id: I3bcbaf30621c23541f2c568355948b6faa578e06
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
b9d598c47b69406174b015ec9f064448e4b3b8b5 19-Jan-2016 Felipe Leme <felipeal@google.com> Skip zip regeneration when user didn't provide extra info.

If the user provides a title or description, it's necessary to create a
new zip file with the contents of the old file plus the new entries,
which takes time.

Hence, if the user didn't provide more info (title or description), we
should skip that step.

BUG: 26616935
Change-Id: Ice14f88b5763d463d8db2f942e823797e80bfde9
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
c4f6467702e308844ef0769ba17dcb7b7b32a9e6 13-Jan-2016 Felipe Leme <felipeal@google.com> Save bugreport info on share intent.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
226940ed8550c02875a987f7e46699e6003ec1c0 15-Dec-2015 Michal Karpinski <mkarpinski@google.com> Modifying Shell to accomodate remote bugreports

After receiving android.intent.action.REMOTE_BUGREPORT_FINISHED
in newly created RemoteBugreportReceiver, Shell will generate URI
to the bugreport zip file and send the broadcast
android.intent.action.REMOTE_BUGREPORT_DISPATCH.

Bug: 26152603
Change-Id: I058d626e021b488c9347b45467a4e3505134e79c
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
4967f737d9906e3d5c9bf3a0584a7b7cf83b5a8c 06-Jan-2016 Felipe Leme <felipeal@google.com> Include title and description on bugreport.zip

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
2288129d5208cd26ab41191db69a418d15ead9ee 06-Jan-2016 Felipe Leme <felipeal@google.com> Fixed corner-case scenario where a screenshot is finished after the share
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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
d1e0f12979441733753b538611f6d73e5527c43c 19-Dec-2015 Felipe Leme <felipeal@google.com> Handle bugreport screenshots on Shell.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
bc73ffc06fd2b5b30802cc7e8874a986626b897d 12-Dec-2015 Felipe Leme <felipeal@google.com> Allows users to add details about a bugreport in progress.

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
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
a5d3cfa9837e63486ed63ef7ad76b5bcac565f1e 11-Dec-2015 Felipe Leme <felipeal@google.com> Merge "Unhardcoded file paths."
a0bf0336f0b6ff39cd90aabe0eb48b022d008ed6 11-Dec-2015 Felipe Leme <felipeal@google.com> Unhardcoded file paths.

Also added a sanity check when deleting old files to avoid a runtime
exception in the AsyncTask when the file doesn't exist.

BUG: 25752530
Change-Id: Ic4a118ae7cc5750cc96c2ac82f2c7dcc6a0cb506
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
46d47911ea8bbbe0b8d7a6029b80da6b1eb94393 09-Dec-2015 Felipe Leme <felipeal@google.com> Refactored what happens when a BUGREPORT_FINISHED is received.

Previously on 24: when a BUGREPORT_FINISHED was received,
BugreportProgressService would remove the watched BugreportInfo from its
map and if there was no info left, it would stop self and send the
SEND_MULTIPLE_ACTION intent.

Soon we're going to allow the user to enter more details (like a title
and description) for the bugreport, but if the service is stopped while
the user is still entering data, that window will be killed.

Hence, although this refactoring doesn't change the current logic, it
paves the way for such new feature.

BUG: 25794470

Change-Id: Ic5283ddc3e07d88ba2a9a925f9534426857e7606
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
4cc863338d5e43b6189e05498d7cb53ebba135e1 05-Dec-2015 Felipe Leme <felipeal@google.com> Changed ActivityManager.requestBugreport() to take a 'progress' parameter.

When progress is set to 'true', it calls the new, enhanced
'bugreportplus' service, while when 'false' it calls the regular
'bugreport' service.

'bugreportplus' is more user-friendly (it shows a system notification
with the progress, allow user to cancel, etc...), at the cost of
consuming more resources. As such, the "Take Bug Report" UI will be
changed to offer the user a combo with these 2 options, but for now it's
always going to be 'bugreportplus'

BUG: 26034608
Change-Id: I21a6b5b092a85614e91d523b8f4df1fb00e49b3b
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
923afa9fe1bbc9a5395309622e596ad03c3d8481 04-Dec-2015 Felipe Leme <felipeal@google.com> Refactoring: pulled ServiceHandler methods to its parent class.

Now ServiceHandler only have 2 methods:

- handleMessage(): part of its interface.
- poll(): delegates work to parent, but sends a delayed message
so it keeps polling.

Also changed hardcoded "N/A" to a resource.

BUG: 25794470
Change-Id: I486fff46c1532685bfd6f5903349d14e55059219
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
719aaae3c167c2b15525dbe5c7db514a2c0c8269 01-Dec-2015 Felipe Leme <felipeal@google.com> Changed workflow so max progress can be dynamically updated.

BUG: 25794470
Change-Id: I75dfdabf9febf54f2fb714441d48b339f8d3d293
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
9cadb75714bea7d435f34c8b7d06f698fa907a8d 30-Nov-2015 Felipe Leme <felipeal@google.com> Adds a notification action to cancel a bugreport in progress.

BUG: 25794470
Change-Id: I6f9c58fa7257f0826ab77007562cbff7db3e4cf0
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
69c0292affe8be51e10afb2dbf58f0133918a2c3 25-Nov-2015 Felipe Leme <felipeal@google.com> Created a new bug report workflow so user can keep track of its progress.

The old workflow was:

1. dumpstate starts.
2. When dumpstate finishes, it sends a BUGREPORT_FINISHED intent.
3. Shell's BugreportReceiver receives the BUGREPORT_FINISHED and issues a
system notification so user can share the bug report.

The new workflow is:

1. When dumpstate starts, it sends a BUGREPORT_STARTED with its pid and
the estimated total effort.
2. When Shell's BugreportReceiver receives the BUGREPORT_STARTED, it:
2.1 Issues a system notification so user can watch the
progresss (which is 0% initially).
2.2 Starts a service (BugreportProgressService) responsible for
polling the dumpstate progress (using system properties and the
pid) and updating the system notification.
3. As dumpstate progress, it updates the proper system property.
4. When dumpstate finishes, it sends a BUGREPORT_FINISHED event.
5. When Shell's BugreportReceiver receives the BUGREPORT_FINISHED, it:
5.1 Finishes the service if necessary.
5.2 Issues a system notification so user can share the bug report.

This CL handles the Shell changes only, the dumpstate changes will be
changed in a separate CL.

BUG: 25794470
Change-Id: Icbd0b42dd48e8db376b60544348b6818c6374338
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java
b9238b37838d653c38ce4e712421adb61978fc22 25-Nov-2015 Felipe Leme <felipeal@google.com> Refactored the BUGREPORT_RECEIVED logic into a new service.

Although this Change doesn't modify the workflow logic itself, it paves
the way for upcoming changes where the overall bug report progress will
be monitored by this service.

BUG: 25794470
Change-Id: Id0c867b04b595b5d31d11531405408f3423dd68b
/frameworks/base/packages/Shell/src/com/android/shell/BugreportProgressService.java