diff options
| author | 2015-11-18 16:43:54 +0000 | |
|---|---|---|
| committer | 2015-11-18 16:43:54 +0000 | |
| commit | 1e39a15d97e70fddc811140c3444dfcd319a6632 (patch) | |
| tree | 455d7281e79b067d345b7f06fc0fce6175aeed67 | |
| parent | d8df11baeae41982ad972c6b95691ee2a5165fa9 (diff) | |
| parent | 6b53135736c597dfbadcb5127de61be4f9b19ce5 (diff) | |
Merge "Cache notifications less aggressively."
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index 4328e24aa5eb..83dbde5eb742 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -105,36 +105,29 @@ public class NotificationData { } public boolean cacheContentViews(Context ctx, Notification updatedNotification) { - boolean cached = false; + boolean applyInPlace = false; if (updatedNotification != null) { final Notification.Builder updatedNotificationBuilder = Notification.Builder.recoverBuilder(ctx, updatedNotification); final RemoteViews newContentView = updatedNotificationBuilder.makeContentView(); - if (!compareRemoteViews(cachedContentView, newContentView)) { - cachedContentView = newContentView; - cached |= true; - } final RemoteViews newBigContentView = updatedNotificationBuilder.makeBigContentView(); - if (!compareRemoteViews(cachedBigContentView, newBigContentView)) { - cachedBigContentView = newBigContentView; - cached |= true; - } final RemoteViews newHeadsUpContentView = updatedNotificationBuilder.makeHeadsUpContentView(); - if (!compareRemoteViews(cachedHeadsUpContentView, newBigContentView)) { - cachedHeadsUpContentView = newHeadsUpContentView; - cached |= true; - } final Notification updatedPublicNotification = updatedNotification.publicVersion; final RemoteViews newPubContentView = (updatedPublicNotification != null) ? Notification.Builder.recoverBuilder( ctx, updatedPublicNotification).makeContentView() : null; - if (!compareRemoteViews(cachedPublicContentView, newPubContentView)) { - cachedPublicContentView = newPubContentView; - cached |= true; - } + + applyInPlace = compareRemoteViews(cachedContentView, newContentView) + && compareRemoteViews(cachedBigContentView, newBigContentView) + && compareRemoteViews(cachedHeadsUpContentView, newHeadsUpContentView) + && compareRemoteViews(cachedPublicContentView, newPubContentView); + cachedPublicContentView = newPubContentView; + cachedHeadsUpContentView = newHeadsUpContentView; + cachedBigContentView = newBigContentView; + cachedContentView = newContentView; } else { final Notification.Builder builder = Notification.Builder.recoverBuilder(ctx, notification.getNotification()); @@ -150,9 +143,9 @@ public class NotificationData { = Notification.Builder.recoverBuilder(ctx, publicNotification); cachedPublicContentView = publicBuilder.makeContentView(); } - cached = true; + applyInPlace = false; } - return cached; + return applyInPlace; } // Returns true if the RemoteViews are the same. |