From 7f09ce1a238ad5a647da913e275fd637ac75ab49 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Thu, 8 Jun 2017 13:20:08 -0700 Subject: [PATCH] Fixed a bug where systemui could crash while cloning Because cloning wasn't synchronized, the notification could become a non-root temporarily which in turn could lead to a crash. 1. We're now properly synchronizing the cloning, such that this can't happen anymore 2. We're now only cloning the old statusbar notification lightly instead of heavily to avoid this altogether Test: manual, update decoratedcustomview notifications really fast Change-Id: Ia6525eec64ad9a26956ca2198e20198f55b2173c Fixes: 62181033 --- core/java/android/widget/RemoteViews.java | 2 +- .../src/com/android/systemui/statusbar/NotificationData.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index e534233432d23..7117137ce2f86 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -2342,7 +2342,7 @@ public class RemoteViews implements Parcelable, Filter { } - public RemoteViews clone() { + public synchronized RemoteViews clone() { Preconditions.checkState(mIsRoot, "RemoteView has been attached to another RemoteView. " + "May only clone the root of a RemoteView hierarchy."); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 58844ad6851ab..c0691c11a2866 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -438,7 +438,7 @@ public class NotificationData { final int N = mEntries.size(); for (int i = 0; i < N; i++) { Entry entry = mEntries.valueAt(i); - final StatusBarNotification oldSbn = entry.notification.clone(); + final StatusBarNotification oldSbn = entry.notification.cloneLight(); final String overrideGroupKey = getOverrideGroupKey(entry.key); if (!Objects.equals(oldSbn.getOverrideGroupKey(), overrideGroupKey)) { entry.notification.setOverrideGroupKey(overrideGroupKey);