From 22f2ee567dd1b1a42432251229bcb2f05c1c4700 Mon Sep 17 00:00:00 2001 From: Christoph Studer Date: Tue, 29 Jul 2014 22:57:21 +0200 Subject: [PATCH] SysUI: Reset background treatment when re-using Entries Bug: 16220667 Change-Id: I8fd2770fa5ea554728eb8cd70ce4a6171e28ece5 --- .../systemui/statusbar/ActivatableNotificationView.java | 6 ++++++ .../com/android/systemui/statusbar/BaseStatusBar.java | 13 ++++++++----- .../systemui/statusbar/ExpandableNotificationRow.java | 2 ++ .../com/android/systemui/statusbar/NotificationData.java | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java index 944a40797201..4d7698a4a866 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java @@ -660,6 +660,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView mOnActivatedListener = onActivatedListener; } + public void reset() { + setTintColor(0); + setShowingLegacyBackground(false); + setBelowSpeedBump(false); + } + public interface OnActivatedListener { void onActivated(ActivatableNotificationView view); void onActivationReset(ActivatableNotificationView view); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 48fc4ec2b824..dff3f555e081 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -1025,7 +1025,7 @@ public abstract class BaseStatusBar extends SystemUI implements hasUserChangedExpansion = row.hasUserChangedExpansion(); userExpanded = row.isUserExpanded(); userLocked = row.isUserLocked(); - row.reset(); + entry.reset(); if (hasUserChangedExpansion) { row.setUserExpanded(userExpanded); } @@ -1369,10 +1369,6 @@ public abstract class BaseStatusBar extends SystemUI implements updateNotifications(); } - private void addNotificationViews(StatusBarNotification notification, RankingMap ranking) { - addNotificationViews(createNotificationViews(notification), ranking); - } - /** * @return The number of notifications we show on Keyguard. */ @@ -1615,6 +1611,13 @@ public abstract class BaseStatusBar extends SystemUI implements } else { if (DEBUG) Log.d(TAG, "rebuilding update in place for key: " + key); oldEntry.notification = notification; + final StatusBarIcon ic = new StatusBarIcon(notification.getPackageName(), + notification.getUser(), + notification.getNotification().icon, + notification.getNotification().iconLevel, + notification.getNotification().number, + notification.getNotification().tickerText); + oldEntry.icon.set(ic); inflateViews(oldEntry, mStackScroller, wasHeadsUp); updateNotifications(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 34108347f406..e042a538c4d9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -62,7 +62,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { /** * Resets this view so it can be re-used for an updated notification. */ + @Override public void reset() { + super.reset(); mRowMinHeight = 0; mRowMaxHeight = 0; mExpandable = false; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java index ed3ebf52cc2a..a1ab7ec52ad6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java @@ -72,6 +72,22 @@ public class NotificationData { public boolean hasInterrupted() { return interruption; } + + /** + * Resets the notification entry to be re-used. + */ + public void reset() { + // NOTE: Icon needs to be preserved for now. + // We should fix this at some point. + expanded = null; + expandedPublic = null; + expandedBig = null; + autoRedacted = false; + legacy = false; + if (row != null) { + row.reset(); + } + } } private final ArrayList mEntries = new ArrayList(); -- 2.11.0