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

Commit cede4fa0 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "Inline the NotificationsLiveDataStoreRefactor flag" into main

parents 84d12e19 fdf86870
Loading
Loading
Loading
Loading
+3 −60
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.scene.domain.interactor

import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import android.platform.test.flag.junit.FlagsParameterization
import android.testing.TestableLooper
import androidx.test.filters.SmallTest
@@ -46,7 +44,6 @@ import com.android.systemui.statusbar.notification.data.repository.setActiveNoti
import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager
import com.android.systemui.statusbar.notification.init.NotificationsController
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.testKosmos
import com.android.systemui.util.concurrency.FakeExecutor
import com.android.systemui.util.mockito.any
@@ -535,25 +532,7 @@ class WindowRootViewVisibilityInteractorTest(flags: FlagsParameterization) : Sys
        }

    @Test
    @DisableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_hasHeadsUpAndNotifPresenterCollapsed_flagOff_notifCountOne() =
        kosmos.runTest {
            underTest.start()

            whenever(headsUpManager.hasPinnedHeadsUp()).thenReturn(true)
            whenever(notificationPresenter.isPresenterFullyCollapsed).thenReturn(true)
            whenever(notificationsController.getActiveNotificationsCount()).thenReturn(4)

            makeLockscreenShadeVisible()

            val notifCount = argumentCaptor<Int>()
            verify(iStatusBarService).onPanelRevealed(any(), notifCount.capture())
            assertThat(notifCount.value).isEqualTo(1)
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_hasHeadsUpAndNotifPresenterCollapsed_flagOn_notifCountOne() =
    fun lockscreenShadeInteractive_hasHeadsUpAndNotifPresenterCollapsed_notifCountOne() =
        kosmos.runTest {
            underTest.start()

@@ -584,25 +563,7 @@ class WindowRootViewVisibilityInteractorTest(flags: FlagsParameterization) : Sys
        }

    @Test
    @DisableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_noHeadsUp_flagOff_notifCountMatchesNotifController() =
        kosmos.runTest {
            underTest.start()
            whenever(notificationPresenter.isPresenterFullyCollapsed).thenReturn(true)

            whenever(headsUpManager.hasPinnedHeadsUp()).thenReturn(false)
            whenever(notificationsController.getActiveNotificationsCount()).thenReturn(9)

            makeLockscreenShadeVisible()

            val notifCount = argumentCaptor<Int>()
            verify(iStatusBarService).onPanelRevealed(any(), notifCount.capture())
            assertThat(notifCount.value).isEqualTo(9)
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_noHeadsUp_flagOn_notifCountMatchesNotifController() =
    fun lockscreenShadeInteractive_noHeadsUp_notifCountMatchesNotifController() =
        kosmos.runTest {
            underTest.start()
            whenever(notificationPresenter.isPresenterFullyCollapsed).thenReturn(true)
@@ -618,25 +579,7 @@ class WindowRootViewVisibilityInteractorTest(flags: FlagsParameterization) : Sys
        }

    @Test
    @DisableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_notifPresenterNotCollapsed_flagOff_notifCountMatchesNotifController() =
        kosmos.runTest {
            underTest.start()
            whenever(headsUpManager.hasPinnedHeadsUp()).thenReturn(true)

            whenever(notificationPresenter.isPresenterFullyCollapsed).thenReturn(false)
            whenever(notificationsController.getActiveNotificationsCount()).thenReturn(8)

            makeLockscreenShadeVisible()

            val notifCount = argumentCaptor<Int>()
            verify(iStatusBarService).onPanelRevealed(any(), notifCount.capture())
            assertThat(notifCount.value).isEqualTo(8)
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun lockscreenShadeInteractive_notifPresenterNotCollapsed_flagOn_notifCountMatchesNotifController() =
    fun lockscreenShadeInteractive_notifPresenterNotCollapsed_notifCountMatchesNotifController() =
        kosmos.runTest {
            underTest.start()
            whenever(headsUpManager.hasPinnedHeadsUp()).thenReturn(true)
+0 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.statusbar.notification.collection.coordinator

import android.platform.test.annotations.EnableFlags
import android.service.notification.NotificationListenerService.REASON_CANCEL
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
@@ -24,7 +23,6 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.notification.collection.NotifPipeline
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.stack.ui.view.NotificationStatsLogger
import com.android.systemui.util.mockito.mock
import com.android.systemui.util.mockito.whenever
@@ -37,7 +35,6 @@ import org.mockito.Mockito.verify

@SmallTest
@RunWith(AndroidJUnit4::class)
@EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
@android.platform.test.annotations.EnabledOnRavenwood
class NotificationStatsLoggerCoordinatorTest : SysuiTestCase() {

+2 −3
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.platform.test.annotations.DisableFlags;
import android.testing.TestableLooper.RunWithLooper;
import android.view.Display;
import android.view.View;
@@ -41,9 +40,9 @@ import com.android.systemui.SysuiTestCase;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.notification.collection.NotifLiveData;
import com.android.systemui.statusbar.notification.collection.NotifLiveDataStore;
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
@@ -56,7 +55,7 @@ import java.util.Objects;
@SmallTest
@RunWith(AndroidJUnit4.class)
@RunWithLooper
@DisableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
@Ignore("b/424001722") // remove this test when LegacyLightsOutNotifController is gone
public class LegacyLightsOutNotifControllerTest extends SysuiTestCase {
    private static final int LIGHTS_ON = 0;
    private static final int LIGHTS_OUT = APPEARANCE_LOW_PROFILE_BARS;
+0 −17
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import com.android.systemui.kosmos.runTest
import com.android.systemui.kosmos.testScope
import com.android.systemui.kosmos.useUnconfinedTestDispatcher
import com.android.systemui.lifecycle.activateIn
import com.android.systemui.log.assertLogsWtf
import com.android.systemui.mediaprojection.data.model.MediaProjectionState
import com.android.systemui.mediaprojection.data.repository.fakeMediaProjectionRepository
import com.android.systemui.plugins.DarkIconDispatcher
@@ -94,7 +93,6 @@ import com.android.systemui.statusbar.notification.data.repository.activeNotific
import com.android.systemui.statusbar.notification.headsup.PinnedStatus
import com.android.systemui.statusbar.notification.promoted.PromotedNotificationUi
import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import com.android.systemui.statusbar.notification.stack.data.repository.headsUpNotificationRepository
import com.android.systemui.statusbar.phone.SysuiDarkIconDispatcher
import com.android.systemui.statusbar.phone.data.repository.fakeDarkIconRepository
@@ -433,7 +431,6 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun areNotificationsLightsOut_lowProfileWithNotifications_true() =
        kosmos.runTest {
            fakeStatusBarModeRepository.defaultDisplay.statusBarMode.value =
@@ -447,7 +444,6 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun areNotificationsLightsOut_lowProfileWithoutNotifications_false() =
        kosmos.runTest {
            fakeStatusBarModeRepository.defaultDisplay.statusBarMode.value =
@@ -461,7 +457,6 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun areNotificationsLightsOut_defaultStatusBarModeWithoutNotifications_false() =
        kosmos.runTest {
            fakeStatusBarModeRepository.defaultDisplay.statusBarMode.value =
@@ -475,7 +470,6 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
        }

    @Test
    @EnableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun areNotificationsLightsOut_defaultStatusBarModeWithNotifications_false() =
        kosmos.runTest {
            fakeStatusBarModeRepository.defaultDisplay.statusBarMode.value =
@@ -488,17 +482,6 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa
            assertThat(actual).isFalse()
        }

    @Test
    @DisableFlags(NotificationsLiveDataStoreRefactor.FLAG_NAME)
    fun areNotificationsLightsOut_requiresFlagEnabled() =
        kosmos.runTest {
            assertLogsWtf {
                val latest by collectLastValue(underTest.areNotificationsLightsOut)
                // Nothing is emitted
                assertThat(latest).isNull()
            }
        }

    @Test
    fun primaryOngoingActivityChip_matchesViewModel() =
        kosmos.runTest {
+1 −6
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import com.android.systemui.statusbar.NotificationPresenter
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
import com.android.systemui.statusbar.notification.headsup.HeadsUpManager
import com.android.systemui.statusbar.notification.init.NotificationsController
import com.android.systemui.statusbar.notification.shared.NotificationsLiveDataStoreRefactor
import javax.inject.Inject
import javax.inject.Provider
import kotlinx.coroutines.CoroutineScope
@@ -170,10 +169,6 @@ constructor(
    }

    private fun getActiveNotificationsCount(): Int {
        return if (NotificationsLiveDataStoreRefactor.isEnabled) {
            activeNotificationsInteractor.allNotificationsCountValue
        } else {
            notificationsController?.getActiveNotificationsCount() ?: 0
        }
        return activeNotificationsInteractor.allNotificationsCountValue
    }
}
Loading