Revamp how changes are tracked in ShadeListBuilder

In general, we want to log whenever something changes between runs of
the ShadeListBuilder: when a notif is added, when a notif changes
sections, when it gets promoted to top-level, etc.

Knowing that something has changed (and how it has changed) is not
as easy to detect as it once was: a notif might be added early in the
pipeline but removed later on, resulting in no real change. A notif
might have a section assigned to it but have it set back to null
because its associated group gets destroyed later on. And so on.

To better track these changes, this CL packages up all of the "list
state" that we care about (parent, filter, section, etc) into a simple
object, ListAttachState. Every ListEntry has two attach states: the
current one and the previous one. Whenever we finish a run of the list
builder, we iterate over every ListEntry and check to see if its attach
state now differs from its previous attach state. If it does, we log the
differences.

Test: atest, manual
Bug: 112656837
Change-Id: I9f44ed05a455ebac2706c18bc1718a9697e805ce
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListAttachState.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListAttachState.kt
new file mode 100644
index 0000000..57f8a6a
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListAttachState.kt
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.notification.collection
+
+import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter
+import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifPromoter
+import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSection
+
+/**
+ * Stores the state that [ShadeListBuilder] assigns to this [ListEntry]
+ */
+data class ListAttachState private constructor(
+    /**
+     * Null if not attached to the current shade list. If top-level, then the shade list root. If
+     * part of a group, then that group's GroupEntry.
+     */
+    var parent: GroupEntry?,
+
+    /**
+     * The section that this ListEntry was sorted into. If the child of the group, this will be the
+     * parent's section. Null if not attached to the list.
+     */
+    var section: NotifSection?,
+    var sectionIndex: Int,
+
+    /**
+     * If a [NotifFilter] is excluding this entry from the list, then that filter. Always null for
+     * [GroupEntry]s.
+     */
+    var excludingFilter: NotifFilter?,
+
+    /**
+     * The [NotifPromoter] promoting this entry to top-level, if any. Always null for [GroupEntry]s.
+     */
+    var promoter: NotifPromoter?
+) {
+
+    /** Copies the state of another instance. */
+    fun clone(other: ListAttachState) {
+        parent = other.parent
+        section = other.section
+        sectionIndex = other.sectionIndex
+        excludingFilter = other.excludingFilter
+        promoter = other.promoter
+    }
+
+    /** Resets back to a "clean" state (the same as created by the factory method) */
+    fun reset() {
+        parent = null
+        section = null
+        sectionIndex = -1
+        excludingFilter = null
+        promoter = null
+    }
+
+    companion object {
+        @JvmStatic
+        fun create(): ListAttachState {
+            return ListAttachState(
+                    null,
+                    null,
+                    -1,
+                    null,
+                    null)
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java
index b5c81b2..0caf0dc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java
@@ -102,11 +102,11 @@
                     .append(")");
         }
 
-        if (entry.mNotifSection != null) {
+        if (entry.getNotifSection() != null) {
             sb.append(" sectionIndex=")
                     .append(entry.getSection())
                     .append(" sectionName=")
-                    .append(entry.mNotifSection.getName());
+                    .append(entry.getNotifSection().getName());
         }
 
         if (includeRecordKeeping) {
@@ -133,15 +133,15 @@
                         .append(" ");
             }
 
-            if (notifEntry.mExcludingFilter != null) {
+            if (notifEntry.getExcludingFilter() != null) {
                 rksb.append("filter=")
-                        .append(notifEntry.mExcludingFilter)
+                        .append(notifEntry.getExcludingFilter().getName())
                         .append(" ");
             }
 
-            if (notifEntry.mNotifPromoter != null) {
+            if (notifEntry.getNotifPromoter() != null) {
                 rksb.append("promoter=")
-                        .append(notifEntry.mNotifPromoter)
+                        .append(notifEntry.getNotifPromoter().getName())
                         .append(" ");
             }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java
index b048d03..837374f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListEntry.java
@@ -16,7 +16,8 @@
 
 package com.android.systemui.statusbar.notification.collection;
 
-import android.annotation.Nullable;
+
+import androidx.annotation.Nullable;
 
 import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSection;
 
@@ -27,13 +28,11 @@
 public abstract class ListEntry {
     private final String mKey;
 
-    @Nullable private GroupEntry mParent;
-    @Nullable private GroupEntry mPreviousParent;
-    @Nullable NotifSection mNotifSection;
-
-    private int mSection = -1;
     int mFirstAddedIteration = -1;
 
+    private final ListAttachState mPreviousAttachState = ListAttachState.create();
+    private final ListAttachState mAttachState = ListAttachState.create();
+
     ListEntry(String key) {
         mKey = key;
     }
@@ -51,27 +50,40 @@
     public abstract @Nullable NotificationEntry getRepresentativeEntry();
 
     @Nullable public GroupEntry getParent() {
-        return mParent;
+        return mAttachState.getParent();
     }
 
     void setParent(@Nullable GroupEntry parent) {
-        mParent = parent;
+        mAttachState.setParent(parent);
     }
 
     @Nullable public GroupEntry getPreviousParent() {
-        return mPreviousParent;
-    }
-
-    void setPreviousParent(@Nullable GroupEntry previousParent) {
-        mPreviousParent = previousParent;
+        return mPreviousAttachState.getParent();
     }
 
     /** The section this notification was assigned to (0 to N-1, where N is number of sections). */
     public int getSection() {
-        return mSection;
+        return mAttachState.getSectionIndex();
     }
 
-    void setSection(int section) {
-        mSection = section;
+    @Nullable public NotifSection getNotifSection() {
+        return mAttachState.getSection();
+    }
+
+    ListAttachState getAttachState() {
+        return mAttachState;
+    }
+
+    ListAttachState getPreviousAttachState() {
+        return mPreviousAttachState;
+    }
+
+    /**
+     * Stores the current attach state into {@link #getPreviousAttachState()}} and then starts a
+     * fresh attach state (all entries will be null/default-initialized).
+     */
+    void beginNewAttachState() {
+        mPreviousAttachState.clone(mAttachState);
+        mAttachState.reset();
     }
 }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 808e1b3..0377c090 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -105,18 +105,6 @@
     /** List of dismiss interceptors that are intercepting the dismissal of this notification. */
     final List<NotifDismissInterceptor> mDismissInterceptors = new ArrayList<>();
 
-    /** If this notification was filtered out, then the filter that did the filtering. */
-    @Nullable NotifFilter mExcludingFilter;
-
-    /**
-     * The NotifFilter, if any, that was active on this notification during the previous run of
-     * the list builder.
-     */
-    @Nullable NotifFilter mPreviousExcludingFilter;
-
-    /** If this was a group child that was promoted to the top level, then who did the promoting. */
-    @Nullable NotifPromoter mNotifPromoter;
-
     /**
      * If this notification was cancelled by system server, then the reason that was supplied.
      * Uncancelled notifications always have REASON_NOT_CANCELED. Note that lifetime-extended
@@ -283,6 +271,14 @@
         mDismissState = requireNonNull(dismissState);
     }
 
+    @Nullable public NotifFilter getExcludingFilter() {
+        return getAttachState().getExcludingFilter();
+    }
+
+    @Nullable public NotifPromoter getNotifPromoter() {
+        return getAttachState().getPromoter();
+    }
+
     /*
      * Convenience getters for SBN and Ranking members
      */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
index fbabb58..0a3b02c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java
@@ -58,6 +58,7 @@
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
@@ -314,8 +315,7 @@
 
         // Step 7: Lock in our group structure and log anything that's changed since the last run
         mPipelineState.incrementTo(STATE_FINALIZING);
-        logFilterChanges();
-        logParentingChanges();
+        logChanges();
         freeEmptyGroups();
 
         // Step 8: Dispatch the new list, first to any listeners and then to the view layer
@@ -325,7 +325,10 @@
         }
 
         // Step 9: We're done!
-        mLogger.logEndBuildList(mIterationCount, mReadOnlyNotifList.size());
+        mLogger.logEndBuildList(
+                mIterationCount,
+                mReadOnlyNotifList.size(),
+                countChildren(mReadOnlyNotifList));
         if (mIterationCount % 10 == 0) {
             mLogger.logFinalList(mNotifList);
         }
@@ -352,18 +355,13 @@
 
     private void resetNotifs() {
         for (GroupEntry group : mGroups.values()) {
-            group.setPreviousParent(group.getParent());
-            group.setParent(null);
+            group.beginNewAttachState();
             group.clearChildren();
             group.setSummary(null);
         }
 
         for (NotificationEntry entry : mAllEntries) {
-            entry.setPreviousParent(entry.getParent());
-            entry.setParent(null);
-
-            entry.mPreviousExcludingFilter = entry.mExcludingFilter;
-            entry.mExcludingFilter = null;
+            entry.beginNewAttachState();
 
             if (entry.mFirstAddedIteration == -1) {
                 entry.mFirstAddedIteration = mIterationCount;
@@ -590,10 +588,10 @@
      * filtered out during any of the filtering steps.
      */
     private void annulAddition(ListEntry entry) {
-        // TODO: We should null out the entry's section and promoter here. However, if we do that,
-        //  future runs will think that the section changed. We need a mPreviousNotifSection,
-        //  similar to what we do for parents.
         entry.setParent(null);
+        entry.getAttachState().setSectionIndex(-1);
+        entry.getAttachState().setSection(null);
+        entry.getAttachState().setPromoter(null);
         if (entry.mFirstAddedIteration == mIterationCount) {
             entry.mFirstAddedIteration = -1;
         }
@@ -606,8 +604,8 @@
             if (entry instanceof GroupEntry) {
                 GroupEntry parent = (GroupEntry) entry;
                 for (NotificationEntry child : parent.getChildren()) {
-                    child.mNotifSection = sectionWithIndex.first;
-                    child.setSection(sectionWithIndex.second);
+                    child.getAttachState().setSection(sectionWithIndex.first);
+                    child.getAttachState().setSectionIndex(sectionWithIndex.second);
                 }
                 parent.sortChildren(sChildComparator);
             }
@@ -621,39 +619,52 @@
         mGroups.values().removeIf(ge -> ge.getSummary() == null && ge.getChildren().isEmpty());
     }
 
-    private void logFilterChanges() {
+    private void logChanges() {
         for (NotificationEntry entry : mAllEntries) {
-            if (entry.mExcludingFilter != entry.mPreviousExcludingFilter) {
-                mLogger.logFilterChanged(
-                        mIterationCount,
-                        entry.getKey(),
-                        entry.mPreviousExcludingFilter,
-                        entry.mExcludingFilter);
-            }
+            logAttachStateChanges(entry);
+        }
+        for (GroupEntry group : mGroups.values()) {
+            logAttachStateChanges(group);
         }
     }
 
-    private void logParentingChanges() {
-        for (NotificationEntry entry : mAllEntries) {
-            if (entry.getParent() != entry.getPreviousParent()) {
-                mLogger.logParentChanged(
-                        mIterationCount,
-                        entry.getKey(),
-                        entry.getPreviousParent() == null
-                                ? null : entry.getPreviousParent().getKey(),
-                        entry.getParent() == null
-                                ? null : entry.getParent().getKey());
+    private void logAttachStateChanges(ListEntry entry) {
+
+        final ListAttachState curr = entry.getAttachState();
+        final ListAttachState prev = entry.getPreviousAttachState();
+
+        if (!Objects.equals(curr, prev)) {
+            mLogger.logEntryAttachStateChanged(
+                    mIterationCount,
+                    entry.getKey(),
+                    prev.getParent(),
+                    curr.getParent());
+
+            if (curr.getParent() != prev.getParent()) {
+                mLogger.logParentChanged(mIterationCount, prev.getParent(), curr.getParent());
             }
-        }
-        for (GroupEntry group : mGroups.values()) {
-            if (group.getParent() != group.getPreviousParent()) {
-                mLogger.logParentChanged(
+
+            if (curr.getExcludingFilter() != prev.getExcludingFilter()) {
+                mLogger.logFilterChanged(
+                        mIterationCount, prev.getExcludingFilter(), curr.getExcludingFilter());
+            }
+
+            // When something gets detached, its promoter and section are always set to null, so
+            // don't bother logging those changes.
+            final boolean wasDetached = curr.getParent() == null && prev.getParent() != null;
+
+            if (!wasDetached && curr.getPromoter() != prev.getPromoter()) {
+                mLogger.logPromoterChanged(
+                        mIterationCount, prev.getPromoter(), curr.getPromoter());
+            }
+
+            if (!wasDetached && curr.getSection() != prev.getSection()) {
+                mLogger.logSectionChanged(
                         mIterationCount,
-                        group.getKey(),
-                        group.getPreviousParent() == null
-                                ? null : group.getPreviousParent().getKey(),
-                        group.getParent() == null
-                                ? null : group.getParent().getKey());
+                        prev.getSection(),
+                        prev.getSectionIndex(),
+                        curr.getSection(),
+                        curr.getSectionIndex());
             }
         }
     }
@@ -700,8 +711,9 @@
     };
 
     private boolean applyFilters(NotificationEntry entry, long now, List<NotifFilter> filters) {
-        entry.mExcludingFilter = findRejectingFilter(entry, now, filters);
-        return entry.mExcludingFilter != null;
+        final NotifFilter filter = findRejectingFilter(entry, now, filters);
+        entry.getAttachState().setExcludingFilter(filter);
+        return filter != null;
     }
 
     @Nullable private static NotifFilter findRejectingFilter(NotificationEntry entry, long now,
@@ -719,16 +731,7 @@
 
     private boolean applyTopLevelPromoters(NotificationEntry entry) {
         NotifPromoter promoter = findPromoter(entry);
-
-        if (promoter != entry.mNotifPromoter) {
-            mLogger.logPromoterChanged(
-                    mIterationCount,
-                    entry.getKey(),
-                    entry.mNotifPromoter != null ? entry.mNotifPromoter.getName() : null,
-                    promoter != null ? promoter.getName() : null);
-            entry.mNotifPromoter = promoter;
-        }
-
+        entry.getAttachState().setPromoter(promoter);
         return promoter != null;
     }
 
@@ -747,18 +750,8 @@
         final NotifSection section = sectionWithIndex.first;
         final Integer sectionIndex = sectionWithIndex.second;
 
-        if (section != entry.mNotifSection) {
-            mLogger.logSectionChanged(
-                    mIterationCount,
-                    entry.getKey(),
-                    entry.mNotifSection != null ? entry.mNotifSection.getName() : null,
-                    entry.getSection(),
-                    section.getName(),
-                    sectionIndex);
-
-            entry.mNotifSection = section;
-            entry.setSection(sectionIndex);
-        }
+        entry.getAttachState().setSection(section);
+        entry.getAttachState().setSectionIndex(sectionIndex);
 
         return sectionWithIndex;
     }
@@ -780,6 +773,17 @@
         }
     }
 
+    private static int countChildren(List<ListEntry> entries) {
+        int count = 0;
+        for (int i = 0; i < entries.size(); i++) {
+            final ListEntry entry = entries.get(i);
+            if (entry instanceof GroupEntry) {
+                count += ((GroupEntry) entry).getChildren().size();
+            }
+        }
+        return count;
+    }
+
     private void dispatchOnBeforeTransformGroups(List<ListEntry> entries) {
         for (int i = 0; i < mOnBeforeTransformGroupsListeners.size(); i++) {
             mOnBeforeTransformGroupsListeners.get(i).onBeforeTransformGroups(entries);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
index 9ac40a1..aa10782 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/listbuilder/ShadeListBuilderLogger.kt
@@ -24,6 +24,8 @@
 import com.android.systemui.statusbar.notification.collection.GroupEntry
 import com.android.systemui.statusbar.notification.collection.ListEntry
 import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter
+import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifPromoter
+import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifSection
 import javax.inject.Inject
 
 class ShadeListBuilderLogger @Inject constructor(
@@ -36,12 +38,13 @@
         })
     }
 
-    fun logEndBuildList(iterationCount: Int, listLength: Int) {
+    fun logEndBuildList(iterationCount: Int, topLevelEntries: Int, numChildren: Int) {
         buffer.log(TAG, INFO, {
-            int1 = iterationCount
-            int2 = listLength
+            long1 = iterationCount.toLong()
+            int1 = topLevelEntries
+            int2 = numChildren
         }, {
-            "(Build $int1) Finished building shade list ($int2 top-level entries)"
+            "(Build $long1) Build complete ($int1 top-level entries, $int2 children)"
         })
     }
 
@@ -110,69 +113,90 @@
         })
     }
 
-    fun logParentChanged(buildId: Int, key: String, prevParent: String?, newParent: String?) {
+    fun logEntryAttachStateChanged(
+        buildId: Int,
+        key: String,
+        prevParent: GroupEntry?,
+        newParent: GroupEntry?
+    ) {
         buffer.log(TAG, INFO, {
             int1 = buildId
             str1 = key
-            str2 = prevParent
-            str3 = newParent
+            str2 = prevParent?.key
+            str3 = newParent?.key
         }, {
-            "(Build $int1) Parent change for $str1: $str2 -> $str3"
+            if (str2 == null && str3 != null) {
+                "(Build $int1) ATTACHED {$str1}"
+            } else if (str2 != null && str3 == null) {
+                "(Build $int1) DETACHED {$str1}"
+            } else {
+                "(Build $int1) MODIFIED {$str1}"
+            }
+        })
+    }
+
+    fun logParentChanged(buildId: Int, prevParent: GroupEntry?, newParent: GroupEntry?) {
+        buffer.log(TAG, INFO, {
+            int1 = buildId
+            str1 = prevParent?.key
+            str2 = newParent?.key
+        }, {
+            if (str1 == null && str2 != null) {
+                "(Build $int1)     Parent is {$str2}"
+            } else if (str1 != null && str2 == null) {
+                "(Build $int1)     Parent was {$str1}"
+            } else {
+                "(Build $int1)     Reparent: {$str2} -> {$str3}"
+            }
         })
     }
 
     fun logFilterChanged(
         buildId: Int,
-        key: String,
         prevFilter: NotifFilter?,
         newFilter: NotifFilter?
     ) {
         buffer.log(TAG, INFO, {
             int1 = buildId
-            str1 = key
-            str2 = prevFilter?.name
-            str3 = newFilter?.name
+            str1 = prevFilter?.name
+            str2 = newFilter?.name
         }, {
-            "(Build $int1) Filter changed for $str1: $str2 -> $str3"
+            "(Build $int1)     Filter changed: $str1 -> $str2"
         })
     }
 
     fun logPromoterChanged(
         buildId: Int,
-        key: String,
-        prevPromoter: String?,
-        newPromoter: String?
+        prevPromoter: NotifPromoter?,
+        newPromoter: NotifPromoter?
     ) {
         buffer.log(TAG, INFO, {
             int1 = buildId
-            str1 = key
-            str2 = prevPromoter
-            str3 = newPromoter
+            str1 = prevPromoter?.name
+            str2 = newPromoter?.name
         }, {
-            "(Build $int1) Promoter changed for $str1: $str2 -> $str3"
+            "(Build $int1)     Promoter changed: $str1 -> $str2"
         })
     }
 
     fun logSectionChanged(
         buildId: Int,
-        key: String,
-        prevSection: String?,
+        prevSection: NotifSection?,
         prevIndex: Int,
-        section: String,
-        index: Int
+        newSection: NotifSection?,
+        newIndex: Int
     ) {
         buffer.log(TAG, INFO, {
             long1 = buildId.toLong()
-            str1 = key
-            str2 = section
-            int1 = index
-            str3 = prevSection
-            int2 = prevIndex
+            str1 = prevSection?.name
+            int1 = prevIndex
+            str2 = newSection?.name
+            int2 = newIndex
         }, {
-            if (str3 == null) {
-                "(Build $long1) Section assigned for $str1: '$str2' (#$int1)"
+            if (str1 == null) {
+                "(Build $long1)     Section assigned: '$str2' (#$int2)"
             } else {
-                "(Build $long1) Section changed for $str1: '$str3' (#$int2) -> '$str2' (#$int1)"
+                "(Build $long1)     Section changed: '$str1' (#$int1) -> '$str2' (#$int2)"
             }
         })
     }
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
index f4fbd7b..43cf83f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java
@@ -57,7 +57,7 @@
 
         /* ListEntry properties */
         entry.setParent(mParent);
-        entry.setSection(mSection);
+        entry.getAttachState().setSectionIndex(mSection);
         return entry;
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
index d7c7279..3adc3d0 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java
@@ -417,8 +417,8 @@
         );
 
         // THEN each filtered notif records the NotifFilter that did it
-        assertEquals(preGroupFilter, mEntrySet.get(1).mExcludingFilter);
-        assertEquals(preGroupFilter, mEntrySet.get(3).mExcludingFilter);
+        assertEquals(preGroupFilter, mEntrySet.get(1).getExcludingFilter());
+        assertEquals(preGroupFilter, mEntrySet.get(3).getExcludingFilter());
     }
 
     @Test
@@ -447,8 +447,8 @@
         );
 
         // THEN each filtered notif records the filter that did it
-        assertEquals(filter1, mEntrySet.get(1).mExcludingFilter);
-        assertEquals(filter1, mEntrySet.get(3).mExcludingFilter);
+        assertEquals(filter1, mEntrySet.get(1).getExcludingFilter());
+        assertEquals(filter1, mEntrySet.get(3).getExcludingFilter());
     }
 
     @Test
@@ -471,7 +471,7 @@
         );
 
         // THEN each filtered notif records the filter that did it
-        assertEquals(filter1, mEntrySet.get(0).mExcludingFilter);
+        assertEquals(filter1, mEntrySet.get(0).getExcludingFilter());
     }
 
     @Test
@@ -502,8 +502,8 @@
         );
 
         // THEN each filtered notif records the filter that did it
-        assertEquals(filter1, mEntrySet.get(1).mExcludingFilter);
-        assertEquals(filter2, mEntrySet.get(2).mExcludingFilter);
+        assertEquals(filter1, mEntrySet.get(1).getExcludingFilter());
+        assertEquals(filter2, mEntrySet.get(2).getExcludingFilter());
     }
 
     @Test
@@ -541,8 +541,8 @@
         );
 
         // THEN each promoted notif records the promoter that did it
-        assertEquals(promoter, mEntrySet.get(2).mNotifPromoter);
-        assertEquals(promoter, mEntrySet.get(3).mNotifPromoter);
+        assertEquals(promoter, mEntrySet.get(2).getNotifPromoter());
+        assertEquals(promoter, mEntrySet.get(3).getNotifPromoter());
     }
 
     @Test
@@ -572,8 +572,8 @@
         verify(promoter2).shouldPromoteToTopLevel(mEntrySet.get(3));
 
         // THEN each promoter is recorded on each notif it promoted
-        assertEquals(promoter1, mEntrySet.get(2).mNotifPromoter);
-        assertEquals(promoter2, mEntrySet.get(3).mNotifPromoter);
+        assertEquals(promoter1, mEntrySet.get(2).getNotifPromoter());
+        assertEquals(promoter2, mEntrySet.get(3).getNotifPromoter());
     }
 
     @Test
@@ -650,34 +650,34 @@
         verify(pkg5Section).isInSection(mEntrySet.get(9));
 
         // THEN the correct section is assigned for entries in pkg1Section
-        assertEquals(pkg1Section, mEntrySet.get(2).mNotifSection);
+        assertEquals(pkg1Section, mEntrySet.get(2).getNotifSection());
         assertEquals(0, mEntrySet.get(2).getSection());
-        assertEquals(pkg1Section, mEntrySet.get(7).mNotifSection);
+        assertEquals(pkg1Section, mEntrySet.get(7).getNotifSection());
         assertEquals(0, mEntrySet.get(7).getSection());
 
         // THEN the correct section is assigned for entries in pkg2Section
-        assertEquals(pkg2Section, mEntrySet.get(1).mNotifSection);
+        assertEquals(pkg2Section, mEntrySet.get(1).getNotifSection());
         assertEquals(1, mEntrySet.get(1).getSection());
-        assertEquals(pkg2Section, mEntrySet.get(8).mNotifSection);
+        assertEquals(pkg2Section, mEntrySet.get(8).getNotifSection());
         assertEquals(1, mEntrySet.get(8).getSection());
-        assertEquals(pkg2Section, mBuiltList.get(3).mNotifSection);
+        assertEquals(pkg2Section, mBuiltList.get(3).getNotifSection());
         assertEquals(1, mBuiltList.get(3).getSection());
 
         // THEN no section was assigned to entries in pkg4Section (since they were filtered)
-        assertEquals(null, mEntrySet.get(0).mNotifSection);
+        assertEquals(null, mEntrySet.get(0).getNotifSection());
         assertEquals(-1, mEntrySet.get(0).getSection());
-        assertEquals(null, mEntrySet.get(10).mNotifSection);
+        assertEquals(null, mEntrySet.get(10).getNotifSection());
         assertEquals(-1, mEntrySet.get(10).getSection());
 
 
         // THEN the correct section is assigned for entries in pkg5Section
-        assertEquals(pkg5Section, mEntrySet.get(9).mNotifSection);
+        assertEquals(pkg5Section, mEntrySet.get(9).getNotifSection());
         assertEquals(3, mEntrySet.get(9).getSection());
 
         // THEN the children entries are assigned the same section as its parent
-        assertEquals(mBuiltList.get(3).mNotifSection, child(5).entry.mNotifSection);
+        assertEquals(mBuiltList.get(3).getNotifSection(), child(5).entry.getNotifSection());
         assertEquals(mBuiltList.get(3).getSection(), child(5).entry.getSection());
-        assertEquals(mBuiltList.get(3).mNotifSection, child(6).entry.mNotifSection);
+        assertEquals(mBuiltList.get(3).getNotifSection(), child(6).entry.getNotifSection());
         assertEquals(mBuiltList.get(3).getSection(), child(6).entry.getSection());
     }
 
@@ -700,7 +700,7 @@
 
         // THEN the entry that didn't have an explicit section gets assigned the DefaultSection
         assertEquals(1, notif(0).entry.getSection());
-        assertNotNull(notif(0).entry.mNotifSection);
+        assertNotNull(notif(0).entry.getNotifSection());
     }
 
     @Test