Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22f2ee56 authored by Christoph Studer's avatar Christoph Studer
Browse files

SysUI: Reset background treatment when re-using Entries

Bug: 16220667
Change-Id: I8fd2770fa5ea554728eb8cd70ce4a6171e28ece5
parent 6c9eee87
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);
+8 −5
Original line number Diff line number Diff line
@@ -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();
                }
+2 −0
Original line number Diff line number Diff line
@@ -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;
+16 −0
Original line number Diff line number Diff line
@@ -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<Entry> mEntries = new ArrayList<Entry>();