summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJulia Reynolds <juliacr@google.com>2019-11-11 15:21:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-11-11 15:21:51 +0000
commit44223a285180b96d4a07fc307fea1dc2f9efd96d (patch)
tree83a248140ed8708ad8c5f82eb3e7eeba3e7ed360 /core/java
parent379f81b2e98a38c445b8a259b8ce059fc4c40ba9 (diff)
parent1d9b8054097558cfe72d53f43371145d1d87d137 (diff)
Merge "Fix a missing synchronization to Notification"
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Notification.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 47118a81632e..2931f33e4cc4 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -2576,10 +2576,12 @@ public class Notification implements Parcelable
PendingIntent.setOnMarshaledListener(
(PendingIntent intent, Parcel out, int outFlags) -> {
if (parcel == out) {
- if (allPendingIntents == null) {
- allPendingIntents = new ArraySet<>();
+ synchronized (this) {
+ if (allPendingIntents == null) {
+ allPendingIntents = new ArraySet<>();
+ }
+ allPendingIntents.add(intent);
}
- allPendingIntents.add(intent);
}
});
}
@@ -2587,8 +2589,10 @@ public class Notification implements Parcelable
// IMPORTANT: Add marshaling code in writeToParcelImpl as we
// want to intercept all pending events written to the parcel.
writeToParcelImpl(parcel, flags);
- // Must be written last!
- parcel.writeArraySet(allPendingIntents);
+ synchronized (this) {
+ // Must be written last!
+ parcel.writeArraySet(allPendingIntents);
+ }
} finally {
if (collectPendingIntents) {
PendingIntent.setOnMarshaledListener(null);