summaryrefslogtreecommitdiff
path: root/packages/Shell/src
diff options
context:
space:
mode:
author Abhijit Nukalapati <abhijitnuk@google.com> 2022-02-11 13:29:21 -0800
committer Abhi Nukalapati <abhijitnuk@google.com> 2022-02-24 20:59:18 +0000
commita6774f8f5e9d5e13daaf2e1dbe04c59c60ec1626 (patch)
tree03371553b5649b01b1af91b082e668814136f595 /packages/Shell/src
parent081fef3d5e0a68702a449041357d3682f003592b (diff)
remove redundant share intent for Wear bug report
In ag/13068228, we amended the bug report functionality for Wear to include a share intent (ACTION_SEND_MULTIPLE) which would be sent once a bug report is complete. However, this intent is not required as Wear sends the bug report directly to WCS via TriggerBugReportService in ClockworkShell. TriggerBugReportService listens for the bug report finished action "com.android.internal.intent.action.BUGREPORT_FINISHED" and sends the bugreport files to WCS. A chooser activity is not launched on Wear. This issue surfaced due to a silent FileNotFoundException in the logs. This occurs because the bug report files are consumed and deleted by TriggerBugReportService in the standard Wear bug repot flow. By the time this share intent is read, the files no longer exist, leading to the exception. Most of the flow is illustrated in the following screenshot: https://screenshot.googleplex.com/8kjMkirzvPyFHg7 The changes here does two things: - remove code that introduced the share intent - remove redundant code after above change - add missing break statement BUG: 208822859 Change-Id: I38d1ee961caf2eead105acb9e84101eef45df9b0
Diffstat (limited to 'packages/Shell/src')
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java71
1 files changed, 11 insertions, 60 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 0b8bd9784b7d..3fdd8c851733 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -570,6 +570,7 @@ public class BugreportProgressService extends Service {
break;
case INTENT_BUGREPORT_DONE:
maybeShowWarningMessageAndCloseNotification(id);
+ break;
case INTENT_BUGREPORT_CANCEL:
cancel(id);
break;
@@ -840,16 +841,11 @@ public class BugreportProgressService extends Service {
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
}
- @GuardedBy("mLock")
- private void stopProgressLocked(int id) {
- stopProgressLocked(id, /* cancelNotification */ true);
- }
-
/**
* Finalizes the progress on a given bugreport and cancel its notification.
*/
@GuardedBy("mLock")
- private void stopProgressLocked(int id, boolean cancelNotification) {
+ private void stopProgressLocked(int id) {
if (mBugreportInfos.indexOfKey(id) < 0) {
Log.w(TAG, "ID not watched: " + id);
} else {
@@ -859,12 +855,10 @@ public class BugreportProgressService extends Service {
// Must stop foreground service first, otherwise notif.cancel() will fail below.
stopForegroundWhenDoneLocked(id);
- if (cancelNotification) {
- Log.d(TAG, "stopProgress(" + id + "): cancel notification");
- NotificationManager.from(mContext).cancel(id);
- } else {
- Log.d(TAG, "stopProgress(" + id + ")");
- }
+
+ Log.d(TAG, "stopProgress(" + id + "): cancel notification");
+ NotificationManager.from(mContext).cancel(id);
+
stopSelfWhenDoneLocked();
}
@@ -1109,30 +1103,7 @@ public class BugreportProgressService extends Service {
return;
}
- if (mIsWatch) {
- // Wear wants to send the notification directly and not wait for the user to tap on the
- // notification.
- triggerShareBugreportAndLocalNotification(info);
- } else {
- triggerLocalNotification(info);
- }
- }
-
- /**
- * Responsible for starting the bugerport sharing process and posting a notification which
- * shows that the bugreport has been taken and that the sharing process has kicked-off.
- */
- private void triggerShareBugreportAndLocalNotification(final BugreportInfo info) {
- boolean isPlainText = info.bugreportFile.getName().toLowerCase().endsWith(".txt");
- if (!isPlainText) {
- // Already zipped, share it right away.
- shareBugreport(info.id, info, /* showWarning */ false,
- /* cancelNotificationWhenStoppingProgress */ false);
- sendBugreportNotification(info, mTakingScreenshot);
- } else {
- // Asynchronously zip the file first, then share it.
- shareAndPostNotificationForZippedBugreport(info, mTakingScreenshot);
- }
+ triggerLocalNotification(info);
}
/**
@@ -1246,16 +1217,14 @@ public class BugreportProgressService extends Service {
}
private void shareBugreport(int id, BugreportInfo sharedInfo) {
- shareBugreport(id, sharedInfo, !hasUserDecidedNotToGetWarningMessage(),
- /* cancelNotificationWhenStoppingProgress */ true);
+ shareBugreport(id, sharedInfo, !hasUserDecidedNotToGetWarningMessage());
}
/**
* Shares the bugreport upon user's request by issuing a {@link Intent#ACTION_SEND_MULTIPLE}
* intent, but issuing a warning dialog the first time.
*/
- private void shareBugreport(int id, BugreportInfo sharedInfo, boolean showWarning,
- boolean cancelNotificationWhenStoppingProgress) {
+ private void shareBugreport(int id, BugreportInfo sharedInfo, boolean showWarning) {
MetricsLogger.action(this, MetricsEvent.ACTION_BUGREPORT_NOTIFICATION_ACTION_SHARE);
BugreportInfo info;
synchronized (mLock) {
@@ -1304,7 +1273,7 @@ public class BugreportProgressService extends Service {
}
synchronized (mLock) {
// ... and stop watching this process.
- stopProgressLocked(id, cancelNotificationWhenStoppingProgress);
+ stopProgressLocked(id);
}
}
@@ -1359,7 +1328,7 @@ public class BugreportProgressService extends Service {
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE))
.setDeleteIntent(newCancelIntent(mContext, info));
} else {
- // Device is a watch.
+ // Device is a watch
if (hasUserDecidedNotToGetWarningMessage()) {
// No action button needed for the notification. User can swipe to dimiss.
builder.setActions(new Action[0]);
@@ -1430,24 +1399,6 @@ public class BugreportProgressService extends Service {
}
/**
- * Zips a bugreport, shares it, and sends for it a bugreport notification.
- */
- private void shareAndPostNotificationForZippedBugreport(final BugreportInfo info,
- final boolean takingScreenshot) {
- new AsyncTask<Void, Void, Void>() {
- @Override
- protected Void doInBackground(Void... params) {
- Looper.prepare();
- zipBugreport(info);
- shareBugreport(info.id, info, /* showWarning */ false,
- /* cancelNotificationWhenStoppingProgress */ false);
- sendBugreportNotification(info, mTakingScreenshot);
- return null;
- }
- }.execute();
- }
-
- /**
* Zips a bugreport file, returning the path to the new file (or to the
* original in case of failure).
*/