119 Commits

Author SHA1 Message Date
Naveen Kalla
ca3d5434e8 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
2017-03-23 12:06:04 +00:00
Dmitri Plotnikov
ce42134828 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
2017-03-14 08:19:13 -07:00
Jorim Jaggi
f631ef769a 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
2017-02-24 17:37:08 +00:00
Felipe Leme
92aaaa21ee Moved bugreport intents to the com.android.internal namespace.
Change-Id: I5ad53668b9393188cee4d8b0382f9c303ff95777
Fixes: 35275802
Test: manual verification
2017-02-15 16:08:53 -08:00
TreeHugger Robot
ccb258d001 Merge "Added more logging on BugreportProgressService." 2017-02-14 01:01:31 +00:00
Felipe Leme
ec60e5f40c Added more logging on BugreportProgressService.
BUG: 35010191
BUG: 35077822

Test: manual verification
Test: BugreportReceiverTest passes
Change-Id: Iaa37f633c6415127a3efa07c166f5a771a13ff5a
2017-02-10 17:41:18 -08:00
Felipe Leme
17d9e9c36d Dismiss keyguard before displaying bugrepot details dialog.
Fixes: 27494228
Test: manual verification
Test: BugreportReceiverTest passes

Change-Id: I7755fc2d3d4f1f9b55301c65f7a58c9374e93664
2017-02-10 16:20:02 -08:00
Makoto Onuki
ff329c4329 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
2017-01-05 14:14:51 -08:00
Felipe Leme
326336d14c Fixed obsolete comment.
Bug:32906084
Test: not needed
Change-Id: I0c79e4ffb66405a30d3c83d2e7654cbef413f6e1
2016-11-15 11:24:42 -08:00
Felipe Leme
fa26a0ed08 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
2016-11-11 15:50:21 -08:00
Tamas Berghammer
383db5ebcc Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:09 +00:00
Tomasz Mikolajewski
219fa882d1 Remove support for archives from External and Bugreport providers.
Change-Id: Ia281fe05a0a6a5dd6ff1b66d7197312cf4391793
Test: Compiles.
Bug: 31783726
2016-09-28 11:32:59 +09:00
Felipe Leme
1a83dede85 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
2016-09-21 11:50:44 -07:00
Ben Lin
663e0e97d5 Push delete notification when Bug reports are deleted. am: 86805aa3af am: 64146c5d24
am: b01be62d58

Change-Id: I8e1b6dc42e44307feef1ba912a3465c2d25594e1
2016-08-31 04:37:16 +00:00
Ben Lin
86805aa3af Push delete notification when Bug reports are deleted.
Bug: 28768706
Change-Id: I6d3e91fe7d12be44918f97cef12c99d936401270
2016-08-29 14:08:32 -07:00
Felipe Leme
034bcf425a Cancel dialog before stopping service.
Fixes: 30746086

Change-Id: Iea8a197a2785259dd80aa8130d79ded484562826
2016-08-08 18:07:44 -07:00
TreeHugger Robot
5f48b026f0 Merge "Enable name text field when re-using the details dialog." 2016-08-04 02:15:53 +00:00
Felipe Leme
da1fbdd6f2 Enable name text field when re-using the details dialog.
Change-Id: I10671fc00ea918da901f36f122641e646057888c
Fixes: 30642226
2016-08-03 17:45:43 -07:00
TreeHugger Robot
1b5eb1e3cd Merge "Fixed BugreportReceiverTest failures:" 2016-08-04 00:31:27 +00:00
Felipe Leme
ca5002f6bd 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
2016-08-03 16:09:35 -07:00
Felipe Leme
6dd4e88210 Fixed year on copyright notice.
BUG: 30429392
Change-Id: If6477ccde5820dd118ad92bb5d4f74d938cf0d83
2016-08-03 10:05:54 -07:00
Felipe Leme
cec3844b6d Removed unused imports and fixed copyright notice.
BUG: 30429392
Change-Id: I3c849e507437ef733b04954af68bd47d00dc5165
2016-08-03 10:03:30 -07:00
Felipe Leme
b4027a01e3 Use SurfaceControl.screenshot() instead of screencap for screenshots.
*** cherrypick of 8cfc23f ***

Change-Id: I5a9e7bbc5f3ae176ac5ae7209a133526992e92d4
Fixes: 30429392
2016-08-02 17:33:48 -07:00
Felipe Leme
aba9743643 Use SurfaceControl.screenshot() instead of screencap for screenshots.
Change-Id: I5a9e7bbc5f3ae176ac5ae7209a133526992e92d4
Fixes: 30429392
2016-07-28 17:31:45 -07:00
Felipe Leme
91699af8c6 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
2016-07-28 15:29:17 -07:00
Wei Liu
213b94ee1a Merge \\"Use the Shell app to show the bugreport notification on Wear.\\" into nyc-mr1-dev am: 1dfbf794b5
am: bc3c068189

Change-Id: I4555c232c5fc9d10a9b9d9cd0d64ac80720e30e9
2016-07-19 17:29:50 +00:00
Wei Liu
9f35541760 Use the Shell app to show the bugreport notification on Wear.
b/30041885

Change-Id: I998aa1606eb12f74a407fbafd9abc11c9454fb66
2016-07-18 13:56:25 -07:00
Felipe Leme
a86a3012ef Close details dialog when bugreport is canceled by user.
BUG: 30158896
Change-Id: I0eab22586f6b431f2abe837088d48a655e03d213
2016-07-18 13:29:46 -07:00
Ben Lin
c6905cfb11 Register change Uri and notify changes in bugreportServices.
Bug: 28767380
Change-Id: Ia4d1f5a2e44881d300f2869c628d4990406caf40
(cherry picked from commit 6c9ff513c6d7d3de7ab8920d88111c2b1dc1bb1f)
(cherry picked from commit 93fafd67a6127a35ba9b7a0f7de3a0b54309d4c2)
2016-05-23 20:07:04 +00:00
Ben Lin
93fafd67a6 Register change Uri and notify changes in bugreportServices.
Bug: 28767380
Change-Id: Ia4d1f5a2e44881d300f2869c628d4990406caf40
(cherry picked from commit 6c9ff513c6d7d3de7ab8920d88111c2b1dc1bb1f)
2016-05-18 23:49:11 +00:00
Steve McKay
53a528bb4f Add archive support to Bug report docs provider.
Bug: 28386918
Change-Id: I2270324be3f020d73a68151002f885f70eb1449c
2016-04-27 16:46:16 -07:00
Felipe Leme
af096719c0 Don't opt-out of warning dialog by default on user builds.
BUG: 28341946
Change-Id: I9ce6bf52a02a14055d4ded41aac50c79abdb4ee9
2016-04-25 13:41:28 -07:00
Felipe Leme
45a905bbaf Show a toast when details cannot be added to zip file.
BUG: 28291423
Change-Id: I7febf66ef23f38b41fb1909324ee2260444518f6
2016-04-22 15:23:27 -07:00
Felipe Leme
69c53e65b9 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
2016-04-20 14:43:37 -07:00
TreeHugger Robot
0304688882 Merge "Only try to add details to zip once." into nyc-dev 2016-04-20 19:03:02 +00:00
Felipe Leme
51a4ede593 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
2016-04-20 10:25:12 -07:00
Felipe Leme
65a9c6760e Show "Android System" instead of "Shell" on notifications.
BUG: 26517701
Change-Id: If2543b8db0fdd913365df6f69cf26146d32d4b15
2016-04-19 09:49:18 -07:00
Felipe Leme
079f89614c 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
2016-04-18 12:06:58 -07:00
TreeHugger Robot
7fd1cbd49d Merge "Revert warning logic so it has a "don't show again" message." into nyc-dev 2016-04-13 17:56:34 +00:00
Felipe Leme
fcca68dfb1 Revert warning logic so it has a "don't show again" message.
BUG: 28140003

Change-Id: I93e7b1494a0f4c5ca080fbe9dd94dc2168092ffa
2016-04-13 09:36:24 -07:00
Felipe Leme
a43d139359 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
2016-04-12 17:28:06 -07:00
Felipe Leme
e1b1ce77da Merge "Minor improvements useful for debugging." into nyc-dev 2016-04-12 17:56:01 +00:00
Selim Cinek
bc3b0458bf 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
2016-04-06 12:18:53 -07:00
Felipe Leme
abeab723d1 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
2016-04-04 11:39:24 -07:00
Aga Wronska
774cc932fc Add menu option to show/hide internal storage.
This reverts commit 7c4395804e450533afb553ab992c47f737da8a9b.

Bug: 27683276
Change-Id: Id1a310b57ab7fa3c8c14b464786473f211eaf41f
2016-03-30 18:23:10 -07:00
Felipe Leme
f8cf395636 Removed FLAG_ADVANCED.
On M, internal storage such as bugreport files were only shown when user
selected the "Show internal storage", but such UI has changed on N.

BUG: 27862860
Change-Id: I1edf086a9f9345303595ee952e4646764709d36d
2016-03-28 13:02:04 -07:00
Felipe Leme
1ae5a69bc4 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
2016-03-23 14:57:17 -07:00
Felipe Leme
9545d8e337 Merge "Changed logic when dumpstate's max progress increases." into nyc-dev 2016-03-22 17:21:20 +00:00
Felipe Leme
3fc44b9a62 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
2016-03-22 10:05:30 -07:00
Aga Wronska
1719b3555d Add config flag to show/hide internal storage.
Hide internal storage by default.

Revert "Always show intern storage."

This reverts commit 7c4395804e450533afb553ab992c47f737da8a9b.

Bug: 27683276

Change-Id: I04ea8b9a307babcea003f9bec200d41265a42c7f
2016-03-21 17:33:27 -07:00