diff options
author | 2021-09-28 05:39:27 +0000 | |
---|---|---|
committer | 2023-04-25 22:55:53 +0000 | |
commit | c324562b6a45689ab2aac604c21d456bfad5f65a (patch) | |
tree | a3ad53f50bf605e927969d69d51e2ec260f2984f /packages/Shell/src | |
parent | 697d6d2e8197d935bd309f332a4e2efbee78d6c5 (diff) |
Display WearBugreportWarningActivity on Wear after bugreport is done
Display WearBugreportWarningActivity as the bug report warning dialog
after bugreport is done on Wear. WearBugreportWarningActivity is defined
in ClockworkShell.
Bug: 190226948
Test: manual test
Take bugreport on Wear, verify that WearBugreportWarningActivity can
be displayed when user choose to display warning dialog:
screenshot.googleplex.com/4udFJuu6M9JmXE4,
screenshot.googleplex.com/4GFT9G5EMHMkwVm
also verify that no warning dialog will be displayed on future
bugreports when user choose "Don't show again" from warning dialog
https://screenshot.googleplex.com/BzyxTJ8siUTA6Xs
(cherry picked from commit 0402d0b12d61f72ee8628b6ef9efad4e74e18fcd)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:470cbee933a650ec239f9300bdcbe95f8f3fe874)
Merged-In: I81cfae4e79f0904b6ca18889fcca65b647c3db4b
Change-Id: I81cfae4e79f0904b6ca18889fcca65b647c3db4b
Diffstat (limited to 'packages/Shell/src')
-rw-r--r-- | packages/Shell/src/com/android/shell/BugreportProgressService.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index e069a9ac776b..42952de1b2b9 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -1212,13 +1212,31 @@ public class BugreportProgressService extends Service { private void maybeShowWarningMessageAndCloseNotification(int id) { if (!hasUserDecidedNotToGetWarningMessage()) { - Intent warningIntent = buildWarningIntent(mContext, /* sendIntent */ null); + Intent warningIntent; + if (mIsWatch) { + warningIntent = buildWearWarningIntent(); + } else { + warningIntent = buildWarningIntent(mContext, /* sendIntent */ null); + } warningIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(warningIntent); } NotificationManager.from(mContext).cancel(id); } + /** + * Build intent to show warning dialog on Wear after bugreport is done + */ + private Intent buildWearWarningIntent() { + Intent intent = new Intent(); + intent.setClassName(mContext, getPackageName() + ".WearBugreportWarningActivity"); + if (mContext.getPackageManager().resolveActivity(intent, /* flags */ 0) == null) { + Log.e(TAG, "Cannot find wear bugreport warning activity"); + return buildWarningIntent(mContext, /* sendIntent */ null); + } + return intent; + } + private void shareBugreport(int id, BugreportInfo sharedInfo) { shareBugreport(id, sharedInfo, !hasUserDecidedNotToGetWarningMessage()); } |