Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinatorTest.kt +10 −10 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ class BundleCoordinatorTest : SysuiTestCase() { val bundle = BundleEntry(TEST_BUNDLE_SPEC) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -510,7 +510,7 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) } Loading @@ -527,7 +527,7 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry2.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry2) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(3) } Loading @@ -540,7 +540,7 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) } Loading @@ -555,12 +555,12 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry1.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry1) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) bundle.removeChild(directNotifChild) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -572,11 +572,11 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) groupEntry1.rawChildren.clear() coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -588,12 +588,12 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) bundle.clearChildren() coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(0) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinator.kt +9 −9 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeFinalizeFilterListener import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.Invalidator import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifBundler Loading Loading @@ -190,18 +191,17 @@ constructor( * counted. */ @get:VisibleForTesting val bundleCountUpdater = OnBeforeRenderListListener { entries -> val bundleCountUpdater = OnBeforeFinalizeFilterListener { entries -> entries.forEachBundleEntry { bundleEntry -> val notifEntrySet = mutableSetOf<NotificationEntry>() fun collectNotifEntry(listEntries: List<ListEntry>) { fun countNotifications(listEntries: List<ListEntry>): Int { var count = 0 for (entry in listEntries) { when (entry) { is NotificationEntry -> { notifEntrySet.add(entry) count++ } is GroupEntry -> { // Do not count group summary NotifEntry collectNotifEntry(entry.children) count += entry.children.size } else -> { error( Loading @@ -212,9 +212,9 @@ constructor( } } } return count } collectNotifEntry(bundleEntry.children) bundleEntry.bundleRepository.numberOfChildren = notifEntrySet.size bundleEntry.bundleRepository.numberOfChildren = countNotifications(bundleEntry.children) } } Loading Loading @@ -311,8 +311,8 @@ constructor( if (NotificationBundleUi.isEnabled) { pipeline.setNotifBundler(bundler) pipeline.addOnBeforeFinalizeFilterListener(this::inflateAllBundleEntries) pipeline.addOnBeforeFinalizeFilterListener(bundleCountUpdater) pipeline.addFinalizeFilter(bundleFilter) pipeline.addOnBeforeRenderListListener(bundleCountUpdater) pipeline.addOnBeforeRenderListListener(bundleMembershipUpdater) pipeline.addOnBeforeRenderListListener(bundleAppDataUpdater) bindOnboardingAffordanceInvalidator(pipeline) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinatorTest.kt +10 −10 Original line number Diff line number Diff line Loading @@ -498,7 +498,7 @@ class BundleCoordinatorTest : SysuiTestCase() { val bundle = BundleEntry(TEST_BUNDLE_SPEC) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -510,7 +510,7 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) } Loading @@ -527,7 +527,7 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry2.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry2) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(3) } Loading @@ -540,7 +540,7 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) } Loading @@ -555,12 +555,12 @@ class BundleCoordinatorTest : SysuiTestCase() { groupEntry1.rawChildren.add(NotificationEntryBuilder().build()) bundle.addChild(groupEntry1) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) bundle.removeChild(directNotifChild) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -572,11 +572,11 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) groupEntry1.rawChildren.clear() coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(1) } Loading @@ -588,12 +588,12 @@ class BundleCoordinatorTest : SysuiTestCase() { bundle.addChild(groupEntry1) bundle.addChild(NotificationEntryBuilder().build()) coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(2) bundle.clearChildren() coordinator.bundleCountUpdater.onBeforeRenderList(listOf(bundle)) coordinator.bundleCountUpdater.onBeforeFinalizeFilter(listOf(bundle)) assertThat(bundle.bundleRepository.numberOfChildren).isEqualTo(0) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/BundleCoordinator.kt +9 −9 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import com.android.systemui.statusbar.notification.collection.NotifPipeline import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.collection.PipelineEntry import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeFinalizeFilterListener import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.Invalidator import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifBundler Loading Loading @@ -190,18 +191,17 @@ constructor( * counted. */ @get:VisibleForTesting val bundleCountUpdater = OnBeforeRenderListListener { entries -> val bundleCountUpdater = OnBeforeFinalizeFilterListener { entries -> entries.forEachBundleEntry { bundleEntry -> val notifEntrySet = mutableSetOf<NotificationEntry>() fun collectNotifEntry(listEntries: List<ListEntry>) { fun countNotifications(listEntries: List<ListEntry>): Int { var count = 0 for (entry in listEntries) { when (entry) { is NotificationEntry -> { notifEntrySet.add(entry) count++ } is GroupEntry -> { // Do not count group summary NotifEntry collectNotifEntry(entry.children) count += entry.children.size } else -> { error( Loading @@ -212,9 +212,9 @@ constructor( } } } return count } collectNotifEntry(bundleEntry.children) bundleEntry.bundleRepository.numberOfChildren = notifEntrySet.size bundleEntry.bundleRepository.numberOfChildren = countNotifications(bundleEntry.children) } } Loading Loading @@ -311,8 +311,8 @@ constructor( if (NotificationBundleUi.isEnabled) { pipeline.setNotifBundler(bundler) pipeline.addOnBeforeFinalizeFilterListener(this::inflateAllBundleEntries) pipeline.addOnBeforeFinalizeFilterListener(bundleCountUpdater) pipeline.addFinalizeFilter(bundleFilter) pipeline.addOnBeforeRenderListListener(bundleCountUpdater) pipeline.addOnBeforeRenderListListener(bundleMembershipUpdater) pipeline.addOnBeforeRenderListListener(bundleAppDataUpdater) bindOnboardingAffordanceInvalidator(pipeline) Loading