diff options
Diffstat (limited to 'core/java/android/app/Notification.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); |
