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

Commit 61c46a21 authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Remove NotifStackController

Moved NotifStats to its own file, it's currently being used in the
ActiveNotificationsListRepository.

Bug: 293167744
Flag: EXEMPT removing unused code
Test: builds, existing tests pass
Change-Id: I50497dd4a6182bd60c02d2a533b3dd5d3a33e695
parent ed1e3379
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@ class RenderStageManagerTest : SysuiTestCase() {
        // VERIFY that the renderer is not queried for group or row controllers
        inOrder(spyViewRenderer).apply {
            verify(spyViewRenderer, times(1)).onRenderList(any())
            verify(spyViewRenderer, times(1)).getStackController()
            verify(spyViewRenderer, never()).getGroupController(any())
            verify(spyViewRenderer, never()).getRowController(any())
            verify(spyViewRenderer, times(1)).onDispatchComplete()
@@ -121,7 +120,6 @@ class RenderStageManagerTest : SysuiTestCase() {
        // VERIFY that the renderer is queried once per group/entry
        inOrder(spyViewRenderer).apply {
            verify(spyViewRenderer, times(1)).onRenderList(any())
            verify(spyViewRenderer, times(1)).getStackController()
            verify(spyViewRenderer, times(2)).getGroupController(any())
            verify(spyViewRenderer, times(8)).getRowController(any())
            verify(spyViewRenderer, times(1)).onDispatchComplete()
@@ -144,7 +142,6 @@ class RenderStageManagerTest : SysuiTestCase() {
        // VERIFY that the renderer is queried once per group/entry
        inOrder(spyViewRenderer).apply {
            verify(spyViewRenderer, times(1)).onRenderList(any())
            verify(spyViewRenderer, times(1)).getStackController()
            verify(spyViewRenderer, times(2)).getGroupController(any())
            verify(spyViewRenderer, times(8)).getRowController(any())
            verify(spyViewRenderer, times(1)).onDispatchComplete()
@@ -162,7 +159,7 @@ class RenderStageManagerTest : SysuiTestCase() {
        onRenderListListener.onRenderList(listWith2Groups8Entries())

        // VERIFY that the listeners are invoked once per group and once per entry
        verify(onAfterRenderListListener, times(1)).onAfterRenderList(any(), any())
        verify(onAfterRenderListListener, times(1)).onAfterRenderList(any())
        verify(onAfterRenderGroupListener, times(2)).onAfterRenderGroup(any(), any())
        verify(onAfterRenderEntryListener, times(8)).onAfterRenderEntry(any(), any())
        verifyNoMoreInteractions(
@@ -182,7 +179,7 @@ class RenderStageManagerTest : SysuiTestCase() {
        onRenderListListener.onRenderList(listOf())

        // VERIFY that the stack listener is invoked once but other listeners are not
        verify(onAfterRenderListListener, times(1)).onAfterRenderList(any(), any())
        verify(onAfterRenderListListener, times(1)).onAfterRenderList(any())
        verify(onAfterRenderGroupListener, never()).onAfterRenderGroup(any(), any())
        verify(onAfterRenderEntryListener, never()).onAfterRenderEntry(any(), any())
        verifyNoMoreInteractions(
@@ -203,8 +200,6 @@ class RenderStageManagerTest : SysuiTestCase() {
    private class FakeNotifViewRenderer : NotifViewRenderer {
        override fun onRenderList(notifList: List<ListEntry>) {}

        override fun getStackController(): NotifStackController = mock()

        override fun getGroupController(group: GroupEntry): NotifGroupController = mock()

        override fun getRowController(entry: NotificationEntry): NotifRowController = mock()
+1 −9
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.kosmos.testScope
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.notification.collection.render.NotifStats
import com.android.systemui.statusbar.notification.data.model.NotifStats
import com.android.systemui.statusbar.notification.data.model.activeNotificationModel
import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
@@ -275,7 +275,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
@@ -293,7 +292,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = false,
@@ -311,7 +309,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 0,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = false,
@@ -329,7 +326,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = false,
@@ -347,7 +343,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = true,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = true,
@@ -365,7 +360,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
@@ -383,7 +377,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = true,
@@ -401,7 +394,6 @@ class ActiveNotificationsInteractorTest : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = false,
+1 −6
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ import com.android.systemui.power.shared.model.WakefulnessState
import com.android.systemui.res.R
import com.android.systemui.shade.shadeTestUtil
import com.android.systemui.shared.settings.data.repository.fakeSecureSettingsRepository
import com.android.systemui.statusbar.notification.collection.render.NotifStats
import com.android.systemui.statusbar.notification.data.model.NotifStats
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix
import com.android.systemui.statusbar.notification.footer.shared.NotifRedesignFooter
@@ -115,7 +115,6 @@ class FooterViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
@@ -133,7 +132,6 @@ class FooterViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = false,
                    hasNonClearableSilentNotifs = false,
@@ -151,7 +149,6 @@ class FooterViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {

            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
@@ -183,7 +180,6 @@ class FooterViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            // AND there are clearable notifications
            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
@@ -217,7 +213,6 @@ class FooterViewModelTest(flags: FlagsParameterization) : SysuiTestCase() {
            // AND there are clearable notifications
            activeNotificationListRepository.notifStats.value =
                NotifStats(
                    numActiveNotifs = 2,
                    hasNonClearableAlertingNotifs = false,
                    hasClearableAlertingNotifs = true,
                    hasNonClearableSilentNotifs = false,
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class DataStoreCoordinator
internal constructor(private val notifLiveDataStoreImpl: NotifLiveDataStoreImpl) : CoreCoordinator {

    override fun attach(pipeline: NotifPipeline) {
        pipeline.addOnAfterRenderListListener { entries, _ -> onAfterRenderList(entries) }
        pipeline.addOnAfterRenderListListener { entries -> onAfterRenderList(entries) }
    }

    override fun dumpPipeline(d: PipelineDumper) {
+2 −5
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@ import com.android.systemui.statusbar.notification.collection.ListEntry
import com.android.systemui.statusbar.notification.collection.NotifPipeline
import com.android.systemui.statusbar.notification.collection.coordinator.dagger.CoordinatorScope
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManagerImpl
import com.android.systemui.statusbar.notification.collection.render.NotifStackController
import com.android.systemui.statusbar.notification.collection.render.NotifStats
import com.android.systemui.statusbar.notification.data.model.NotifStats
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
import com.android.systemui.statusbar.notification.domain.interactor.RenderNotificationListInteractor
import com.android.systemui.statusbar.notification.stack.BUCKET_SILENT
@@ -51,8 +50,7 @@ internal constructor(
        groupExpansionManagerImpl.attach(pipeline)
    }

    // TODO: b/293167744 - Remove controller param.
    private fun onAfterRenderList(entries: List<ListEntry>, controller: NotifStackController) =
    private fun onAfterRenderList(entries: List<ListEntry>) =
        traceSection("StackCoordinator.onAfterRenderList") {
            val notifStats = calculateNotifStats(entries)
            activeNotificationsInteractor.setNotifStats(notifStats)
@@ -84,7 +82,6 @@ internal constructor(
            }
        }
        return NotifStats(
            numActiveNotifs = entries.size,
            hasNonClearableAlertingNotifs = hasNonClearableAlertingNotifs,
            hasClearableAlertingNotifs = hasClearableAlertingNotifs,
            hasNonClearableSilentNotifs = hasNonClearableSilentNotifs,
Loading