diff options
| author | Julia Reynolds <juliacr@google.com> | 2019-11-11 15:21:51 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-11-11 15:21:51 +0000 |
| commit | 44223a285180b96d4a07fc307fea1dc2f9efd96d (patch) | |
| tree | 83a248140ed8708ad8c5f82eb3e7eeba3e7ed360 /core/java | |
| parent | 379f81b2e98a38c445b8a259b8ce059fc4c40ba9 (diff) | |
| parent | 1d9b8054097558cfe72d53f43371145d1d87d137 (diff) | |
Merge "Fix a missing synchronization to Notification"
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/Notification.java | 14 |
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); |
