Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java +15 −7 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ public class ShadeListBuilder implements Dumpable { private final NotificationInteractionTracker mInteractionTracker; private final DumpManager mDumpManager; // used exclusivly by ShadeListBuilder#notifySectionEntriesUpdated // TODO replace temp with collection pool for readability private final ArrayList<ListEntry> mTempSectionMembers = new ArrayList<>(); private final boolean mAlwaysLogList; Loading Loading @@ -230,13 +231,7 @@ public class ShadeListBuilder implements Dumpable { mPipelineState.requireState(STATE_IDLE); mNotifSections.clear(); NotifSectioner lastSection = null; for (NotifSectioner sectioner : sectioners) { if (lastSection != null && lastSection.getBucket() > sectioner.getBucket()) { throw new IllegalArgumentException("setSectioners with non contiguous sections " + lastSection.getName() + " - " + lastSection.getBucket() + " & " + sectioner.getName() + " - " + sectioner.getBucket()); } final NotifSection section = new NotifSection(sectioner, mNotifSections.size()); final NotifComparator sectionComparator = section.getComparator(); mNotifSections.add(section); Loading @@ -244,10 +239,23 @@ public class ShadeListBuilder implements Dumpable { if (sectionComparator != null) { sectionComparator.setInvalidationListener(this::onNotifComparatorInvalidated); } lastSection = sectioner; } mNotifSections.add(new NotifSection(DEFAULT_SECTIONER, mNotifSections.size())); // validate sections final ArraySet<Integer> seenBuckets = new ArraySet<>(); int lastBucket = mNotifSections.size() > 0 ? mNotifSections.get(0).getBucket() : 0; for (NotifSection section : mNotifSections) { if (lastBucket != section.getBucket() && seenBuckets.contains(section.getBucket())) { throw new IllegalStateException("setSectioners with non contiguous sections " + section.getLabel() + " has an already seen bucket"); } lastBucket = section.getBucket(); seenBuckets.add(lastBucket); } } void setNotifStabilityManager(@NonNull NotifStabilityManager notifStabilityManager) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilder.kt +0 −10 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class NodeSpecBuilder( var currentSection: NotifSection? = null val prevSections = mutableSetOf<NotifSection?>() var lastSection: NotifSection? = null val showHeaders = sectionHeaderVisibilityProvider.sectionHeadersVisible val sectionOrder = mutableListOf<NotifSection?>() val sectionHeaders = mutableMapOf<NotifSection?, NodeController?>() Loading @@ -65,15 +64,6 @@ class NodeSpecBuilder( for (entry in notifList) { val section = entry.section!! lastSection?.let { if (it.bucket > section.bucket) { throw IllegalStateException("buildNodeSpec with non contiguous section " + "buckets ${it.sectioner.name} - ${it.bucket} & " + "${it.sectioner.name} - ${it.bucket}") } } lastSection = section if (prevSections.contains(section)) { throw java.lang.RuntimeException("Section ${section.label} has been duplicated") } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java +33 −1 Original line number Diff line number Diff line Loading @@ -1527,6 +1527,34 @@ public class ShadeListBuilderTest extends SysuiTestCase { ); } @Test public void testContiguousSections() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 3), new PackageSectioner("pkg", 2) )); } @Test(expected = IllegalStateException.class) public void testNonContiguousSections() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 3), new PackageSectioner("pkg", 1) )); } @Test(expected = IllegalStateException.class) public void testBucketZeroNotAllowed() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 0), new PackageSectioner("pkg", 1) )); } @Test public void testStabilizeGroupsDelayedSummaryRendersAllNotifsTopLevel() { // GIVEN group children posted without a summary Loading Loading @@ -2189,7 +2217,11 @@ public class ShadeListBuilderTest extends SysuiTestCase { } PackageSectioner(String pkg) { super("PackageSection_" + pkg, 0); this(pkg, 0); } PackageSectioner(String pkg, int bucket) { super("PackageSection_" + pkg, bucket); mPackages = List.of(pkg); mComparator = null; } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilder.java +15 −7 Original line number Diff line number Diff line Loading @@ -93,6 +93,7 @@ public class ShadeListBuilder implements Dumpable { private final NotificationInteractionTracker mInteractionTracker; private final DumpManager mDumpManager; // used exclusivly by ShadeListBuilder#notifySectionEntriesUpdated // TODO replace temp with collection pool for readability private final ArrayList<ListEntry> mTempSectionMembers = new ArrayList<>(); private final boolean mAlwaysLogList; Loading Loading @@ -230,13 +231,7 @@ public class ShadeListBuilder implements Dumpable { mPipelineState.requireState(STATE_IDLE); mNotifSections.clear(); NotifSectioner lastSection = null; for (NotifSectioner sectioner : sectioners) { if (lastSection != null && lastSection.getBucket() > sectioner.getBucket()) { throw new IllegalArgumentException("setSectioners with non contiguous sections " + lastSection.getName() + " - " + lastSection.getBucket() + " & " + sectioner.getName() + " - " + sectioner.getBucket()); } final NotifSection section = new NotifSection(sectioner, mNotifSections.size()); final NotifComparator sectionComparator = section.getComparator(); mNotifSections.add(section); Loading @@ -244,10 +239,23 @@ public class ShadeListBuilder implements Dumpable { if (sectionComparator != null) { sectionComparator.setInvalidationListener(this::onNotifComparatorInvalidated); } lastSection = sectioner; } mNotifSections.add(new NotifSection(DEFAULT_SECTIONER, mNotifSections.size())); // validate sections final ArraySet<Integer> seenBuckets = new ArraySet<>(); int lastBucket = mNotifSections.size() > 0 ? mNotifSections.get(0).getBucket() : 0; for (NotifSection section : mNotifSections) { if (lastBucket != section.getBucket() && seenBuckets.contains(section.getBucket())) { throw new IllegalStateException("setSectioners with non contiguous sections " + section.getLabel() + " has an already seen bucket"); } lastBucket = section.getBucket(); seenBuckets.add(lastBucket); } } void setNotifStabilityManager(@NonNull NotifStabilityManager notifStabilityManager) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/NodeSpecBuilder.kt +0 −10 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class NodeSpecBuilder( var currentSection: NotifSection? = null val prevSections = mutableSetOf<NotifSection?>() var lastSection: NotifSection? = null val showHeaders = sectionHeaderVisibilityProvider.sectionHeadersVisible val sectionOrder = mutableListOf<NotifSection?>() val sectionHeaders = mutableMapOf<NotifSection?, NodeController?>() Loading @@ -65,15 +64,6 @@ class NodeSpecBuilder( for (entry in notifList) { val section = entry.section!! lastSection?.let { if (it.bucket > section.bucket) { throw IllegalStateException("buildNodeSpec with non contiguous section " + "buckets ${it.sectioner.name} - ${it.bucket} & " + "${it.sectioner.name} - ${it.bucket}") } } lastSection = section if (prevSections.contains(section)) { throw java.lang.RuntimeException("Section ${section.label} has been duplicated") } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/ShadeListBuilderTest.java +33 −1 Original line number Diff line number Diff line Loading @@ -1527,6 +1527,34 @@ public class ShadeListBuilderTest extends SysuiTestCase { ); } @Test public void testContiguousSections() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 3), new PackageSectioner("pkg", 2) )); } @Test(expected = IllegalStateException.class) public void testNonContiguousSections() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 1), new PackageSectioner("pkg", 3), new PackageSectioner("pkg", 1) )); } @Test(expected = IllegalStateException.class) public void testBucketZeroNotAllowed() { mListBuilder.setSectioners(List.of( new PackageSectioner("pkg", 0), new PackageSectioner("pkg", 1) )); } @Test public void testStabilizeGroupsDelayedSummaryRendersAllNotifsTopLevel() { // GIVEN group children posted without a summary Loading Loading @@ -2189,7 +2217,11 @@ public class ShadeListBuilderTest extends SysuiTestCase { } PackageSectioner(String pkg) { super("PackageSection_" + pkg, 0); this(pkg, 0); } PackageSectioner(String pkg, int bucket) { super("PackageSection_" + pkg, bucket); mPackages = List.of(pkg); mComparator = null; } Loading