diff options
author | 2024-11-13 14:26:27 +0000 | |
---|---|---|
committer | 2024-11-13 14:54:53 +0000 | |
commit | b20ff4b9c869573cbd32b9a16a2c3797eedf0bf0 (patch) | |
tree | b709a5397958dbd572eda86953c157ea36ba8963 /packages/Shell/src | |
parent | 1d0cc963b822476953dc279ea742d4530340837f (diff) |
Send broadcast when bugreport aborted due to error.
Flag: EXEMPT minor bugfix
Test: manual test
BUG=367625300
Change-Id: I876830e0cda3dce7660d15559637e671798d67be
Diffstat (limited to 'packages/Shell/src')
-rw-r--r-- | packages/Shell/src/com/android/shell/BugreportProgressService.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java index 7c478ac78a29..7f25b51e35ca 100644 --- a/packages/Shell/src/com/android/shell/BugreportProgressService.java +++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java @@ -153,6 +153,10 @@ public class BugreportProgressService extends Service { static final String INTENT_BUGREPORT_FINISHED = "com.android.internal.intent.action.BUGREPORT_FINISHED"; + // Intent sent to notify external apps that bugreport aborted due to error. + static final String INTENT_BUGREPORT_ABORTED = + "com.android.internal.intent.action.BUGREPORT_ABORTED"; + // Internal intents used on notification actions. static final String INTENT_BUGREPORT_CANCEL = "android.intent.action.BUGREPORT_CANCEL"; static final String INTENT_BUGREPORT_SHARE = "android.intent.action.BUGREPORT_SHARE"; @@ -174,6 +178,8 @@ public class BugreportProgressService extends Service { static final String EXTRA_INFO = "android.intent.extra.INFO"; static final String EXTRA_EXTRA_ATTACHMENT_URIS = "android.intent.extra.EXTRA_ATTACHMENT_URIS"; + static final String EXTRA_ABORTED_ERROR_CODE = + "android.intent.extra.EXTRA_ABORTED_ERROR_CODE"; private static final ThreadFactory sBugreportManagerCallbackThreadFactory = new ThreadFactory() { @@ -404,6 +410,7 @@ public class BugreportProgressService extends Service { @Override public void onError(@BugreportErrorCode int errorCode) { synchronized (mLock) { + sendBugreportAbortedBroadcastLocked(errorCode); stopProgressLocked(mInfo.id); mInfo.deleteEmptyFiles(); } @@ -460,6 +467,13 @@ public class BugreportProgressService extends Service { onBugreportFinished(mInfo); } } + + @GuardedBy("mLock") + private void sendBugreportAbortedBroadcastLocked(@BugreportErrorCode int errorCode) { + final Intent intent = new Intent(INTENT_BUGREPORT_ABORTED); + intent.putExtra(EXTRA_ABORTED_ERROR_CODE, errorCode); + mContext.sendBroadcast(intent, android.Manifest.permission.DUMP); + } } private void sendRemoteBugreportFinishedBroadcast(Context context, |