Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +27 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runCurrent import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.useUnconfinedTestDispatcher Loading @@ -52,6 +53,7 @@ import com.android.systemui.mediaprojection.data.model.MediaProjectionState import com.android.systemui.mediaprojection.data.repository.fakeMediaProjectionRepository import com.android.systemui.plugins.DarkIconDispatcher import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.screenrecord.data.model.ScreenRecordModel import com.android.systemui.screenrecord.data.repository.screenRecordRepository Loading Loading @@ -90,6 +92,7 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -555,6 +558,30 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { assertThat(latest).isTrue() } @Test fun isHomeStatusBarAllowedByScene_sceneGoneWithNotificationsShadeOverlay_false() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowedByScene) kosmos.sceneContainerRepository.snapToScene(Scenes.Gone) kosmos.sceneContainerRepository.showOverlay(Overlays.NotificationsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isHomeStatusBarAllowedByScene_sceneGoneWithQuickSettingsShadeOverlay_false() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowedByScene) kosmos.sceneContainerRepository.snapToScene(Scenes.Gone) kosmos.sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) runCurrent() assertThat(latest).isFalse() } @Test fun shouldShowOperatorNameView_allowedByInteractor_allowedByDisableFlags_visible() = kosmos.runTest { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +36 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior Loading @@ -44,6 +45,7 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest Loading @@ -54,6 +56,7 @@ import org.mockito.Mockito.verify import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { Loading Loading @@ -95,6 +98,15 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa ) } @Test fun isVisible_lockscreen_true() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) assertThat(latest).isTrue() } @Test fun isVisible_dozing_false() = testScope.runTest { Loading @@ -116,6 +128,30 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test fun isVisible_notificationsShadeOverlay_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) kosmos.sceneContainerRepository.showOverlay(Overlays.NotificationsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isVisible_quickSettingsShadeOverlay_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) kosmos.sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isVisible_sceneBouncer_false() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +12 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.plugins.DarkIconDispatcher import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.chips.mediaprojection.domain.model.MediaProjectionStopDialogModel Loading Loading @@ -228,14 +229,19 @@ constructor( override val isHomeStatusBarAllowedByScene: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, sceneContainerOcclusionInteractor.invisibleDueToOcclusion, ) { currentScene, isOccluded -> ) { currentScene, currentOverlays, isOccluded -> // All scenes have their own status bars, so we should only show the home status bar // if we're not in a scene. The one exception: If the scene is occluded, then the // occluding app needs to show the status bar. (Fullscreen apps actually won't show // the status bar but that's handled with the rest of our fullscreen app logic, // which lives elsewhere.) currentScene == Scenes.Gone || isOccluded // if we're not in a scene. There are two exceptions: // 1) The shade (notifications or quick settings) is shown, because it has its own // status-bar-like header. // 2) If the scene is occluded, then the occluding app needs to show the status bar. // (Fullscreen apps actually won't show the status bar but that's handled with the // rest of our fullscreen app logic, which lives elsewhere.) (currentScene == Scenes.Gone && Overlays.NotificationsShade !in currentOverlays && Overlays.QuickSettingsShade !in currentOverlays) || isOccluded } .distinctUntilChanged() .logDiffsForTable( Loading packages/SystemUI/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModel.kt +8 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.KeyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior Loading Loading @@ -70,10 +71,15 @@ constructor( val isVisible: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, keyguardInteractor.isDozing, showingHeadsUpStatusBar, ) { currentScene, isDozing, showHeadsUpStatusBar -> currentScene == Scenes.Lockscreen && !isDozing && !showHeadsUpStatusBar ) { currentScene, currentOverlays, isDozing, showHeadsUpStatusBar -> currentScene == Scenes.Lockscreen && Overlays.NotificationsShade !in currentOverlays && Overlays.QuickSettingsShade !in currentOverlays && !isDozing && !showHeadsUpStatusBar } .stateIn(scope, SharingStarted.WhileSubscribed(), false) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +27 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runCurrent import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.kosmos.useUnconfinedTestDispatcher Loading @@ -52,6 +53,7 @@ import com.android.systemui.mediaprojection.data.model.MediaProjectionState import com.android.systemui.mediaprojection.data.repository.fakeMediaProjectionRepository import com.android.systemui.plugins.DarkIconDispatcher import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.screenrecord.data.model.ScreenRecordModel import com.android.systemui.screenrecord.data.repository.screenRecordRepository Loading Loading @@ -90,6 +92,7 @@ import com.android.systemui.testKosmos import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runCurrent import org.junit.Before import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -555,6 +558,30 @@ class HomeStatusBarViewModelImplTest : SysuiTestCase() { assertThat(latest).isTrue() } @Test fun isHomeStatusBarAllowedByScene_sceneGoneWithNotificationsShadeOverlay_false() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowedByScene) kosmos.sceneContainerRepository.snapToScene(Scenes.Gone) kosmos.sceneContainerRepository.showOverlay(Overlays.NotificationsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isHomeStatusBarAllowedByScene_sceneGoneWithQuickSettingsShadeOverlay_false() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowedByScene) kosmos.sceneContainerRepository.snapToScene(Scenes.Gone) kosmos.sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) runCurrent() assertThat(latest).isFalse() } @Test fun shouldShowOperatorNameView_allowedByInteractor_allowedByDisableFlags_visible() = kosmos.runTest { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModelTest.kt +36 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.kosmos.testScope import com.android.systemui.scene.data.repository.sceneContainerRepository import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.keyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior Loading @@ -44,6 +45,7 @@ import com.android.systemui.testKosmos import com.android.systemui.util.mockito.argumentCaptor import com.android.systemui.util.mockito.capture import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest Loading @@ -54,6 +56,7 @@ import org.mockito.Mockito.verify import platform.test.runner.parameterized.ParameterizedAndroidJunit4 import platform.test.runner.parameterized.Parameters @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(ParameterizedAndroidJunit4::class) class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCase() { Loading Loading @@ -95,6 +98,15 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa ) } @Test fun isVisible_lockscreen_true() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) assertThat(latest).isTrue() } @Test fun isVisible_dozing_false() = testScope.runTest { Loading @@ -116,6 +128,30 @@ class KeyguardStatusBarViewModelTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test fun isVisible_notificationsShadeOverlay_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) kosmos.sceneContainerRepository.showOverlay(Overlays.NotificationsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isVisible_quickSettingsShadeOverlay_false() = testScope.runTest { val latest by collectLastValue(underTest.isVisible) kosmos.sceneContainerRepository.snapToScene(Scenes.Lockscreen) kosmos.sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) runCurrent() assertThat(latest).isFalse() } @Test fun isVisible_sceneBouncer_false() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +12 −6 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import com.android.systemui.plugins.DarkIconDispatcher import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.statusbar.chips.mediaprojection.domain.model.MediaProjectionStopDialogModel Loading Loading @@ -228,14 +229,19 @@ constructor( override val isHomeStatusBarAllowedByScene: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, sceneContainerOcclusionInteractor.invisibleDueToOcclusion, ) { currentScene, isOccluded -> ) { currentScene, currentOverlays, isOccluded -> // All scenes have their own status bars, so we should only show the home status bar // if we're not in a scene. The one exception: If the scene is occluded, then the // occluding app needs to show the status bar. (Fullscreen apps actually won't show // the status bar but that's handled with the rest of our fullscreen app logic, // which lives elsewhere.) currentScene == Scenes.Gone || isOccluded // if we're not in a scene. There are two exceptions: // 1) The shade (notifications or quick settings) is shown, because it has its own // status-bar-like header. // 2) If the scene is occluded, then the occluding app needs to show the status bar. // (Fullscreen apps actually won't show the status bar but that's handled with the // rest of our fullscreen app logic, which lives elsewhere.) (currentScene == Scenes.Gone && Overlays.NotificationsShade !in currentOverlays && Overlays.QuickSettingsShade !in currentOverlays) || isOccluded } .distinctUntilChanged() .logDiffsForTable( Loading
packages/SystemUI/src/com/android/systemui/statusbar/ui/viewmodel/KeyguardStatusBarViewModel.kt +8 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.scene.domain.interactor.SceneInteractor import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.scene.shared.model.Overlays import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.statusbar.domain.interactor.KeyguardStatusBarInteractor import com.android.systemui.statusbar.headsup.shared.StatusBarNoHunBehavior Loading Loading @@ -70,10 +71,15 @@ constructor( val isVisible: StateFlow<Boolean> = combine( sceneInteractor.currentScene, sceneInteractor.currentOverlays, keyguardInteractor.isDozing, showingHeadsUpStatusBar, ) { currentScene, isDozing, showHeadsUpStatusBar -> currentScene == Scenes.Lockscreen && !isDozing && !showHeadsUpStatusBar ) { currentScene, currentOverlays, isDozing, showHeadsUpStatusBar -> currentScene == Scenes.Lockscreen && Overlays.NotificationsShade !in currentOverlays && Overlays.QuickSettingsShade !in currentOverlays && !isDozing && !showHeadsUpStatusBar } .stateIn(scope, SharingStarted.WhileSubscribed(), false) Loading