summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-09-24 15:43:26 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-09-24 15:43:26 +0000
commit6ed6ceddac4fd88a1d0b83a4891ad22e65150ec7 (patch)
treea890745a28a3bce29ea108b25a60efc49d7477f0
parent7b198b32178ada8dbf8153e4b88b20e7b7126332 (diff)
parentee72fa19a97f2b0677a130204e3527bc3233e4d9 (diff)
Merge "Synchronize access to sNotificationBundle."
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index ec35b3df73c9..2530abc765da 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -44,6 +44,7 @@ import java.util.zip.ZipOutputStream;
import libcore.io.Streams;
+import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.ChooserActivity;
import com.android.internal.logging.MetricsLogger;
@@ -234,6 +235,7 @@ public class BugreportProgressService extends Service {
*/
private boolean mTakingScreenshot;
+ @GuardedBy("sNotificationBundle")
private static final Bundle sNotificationBundle = new Bundle();
private boolean mIsWatch;
@@ -1059,10 +1061,12 @@ public class BugreportProgressService extends Service {
}
private static Notification.Builder newBaseNotification(Context context) {
- if (sNotificationBundle.isEmpty()) {
- // Rename notifcations from "Shell" to "Android System"
- sNotificationBundle.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
- context.getString(com.android.internal.R.string.android_system_label));
+ synchronized (sNotificationBundle) {
+ if (sNotificationBundle.isEmpty()) {
+ // Rename notifcations from "Shell" to "Android System"
+ sNotificationBundle.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
+ context.getString(com.android.internal.R.string.android_system_label));
+ }
}
return new Notification.Builder(context, NOTIFICATION_CHANNEL_ID)
.addExtras(sNotificationBundle)