Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +44 −0 Original line number Diff line number Diff line Loading @@ -674,6 +674,50 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onExternalDisplay_whenNotificationShadeIsVisibleOnDefaultDisplay_isTrue() = kosmos.runTest { val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY) val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.NotificationsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isTrue() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onDefaultDisplay_whenShadeIsVisibleOnDefaultDisplay_isFalse() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isFalse() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onExternalDisplay_whenShadeIsVisibleOnDefaultDisplay_isTrue() = kosmos.runTest { val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY) val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isTrue() } @Test fun shouldShowOperatorNameView_allowedByInteractor_allowedByDisableFlags_visible() = kosmos.runTest { Loading packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +12 −11 Original line number Diff line number Diff line Loading @@ -348,18 +348,19 @@ constructor( private val isHomeStatusBarAllowedByScene: Flow<Boolean> = combine( sceneInteractor.currentScene, isShadeVisibleOnThisDisplay, isShadeVisibleOnAnyDisplay, sceneContainerOcclusionInteractor.invisibleDueToOcclusion, ) { currentScene, isShadeVisible, isOccluded -> // All scenes have their own status bars, so we should only show the home status bar // 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 && !isShadeVisible) || isOccluded isShadeWindowOnThisDisplay, ) { currentScene, isShadeVisibleOnAnyDisplay, isOccluded, isShadeWindowOnThisDisplay -> if (isOccluded) { true } else if (isShadeWindowOnThisDisplay) { currentScene == Scenes.Gone && !isShadeVisibleOnAnyDisplay } else { // When the shade is visible on another display, // allow the home status bar on the current display. currentScene == Scenes.Gone || isShadeVisibleOnAnyDisplay } } .distinctUntilChanged() .logDiffsForTable( Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModelImplTest.kt +44 −0 Original line number Diff line number Diff line Loading @@ -674,6 +674,50 @@ class HomeStatusBarViewModelImplTest(flags: FlagsParameterization) : SysuiTestCa assertThat(latest).isFalse() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onExternalDisplay_whenNotificationShadeIsVisibleOnDefaultDisplay_isTrue() = kosmos.runTest { val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY) val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.NotificationsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isTrue() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onDefaultDisplay_whenShadeIsVisibleOnDefaultDisplay_isFalse() = kosmos.runTest { val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isFalse() } @Test @EnableFlags(Flags.FLAG_SHADE_WINDOW_GOES_AROUND) @EnableSceneContainer fun isHomeStatusBarAllowed_onExternalDisplay_whenShadeIsVisibleOnDefaultDisplay_isTrue() = kosmos.runTest { val underTest = homeStatusBarViewModelFactory(EXTERNAL_DISPLAY) val latest by collectLastValue(underTest.isHomeStatusBarAllowed) sceneContainerRepository.instantlyTransitionTo(Scenes.Gone) sceneContainerRepository.showOverlay(Overlays.QuickSettingsShade) fakeShadeDisplaysRepository.setDisplayId(DEFAULT_DISPLAY) assertThat(latest).isTrue() } @Test fun shouldShowOperatorNameView_allowedByInteractor_allowedByDisableFlags_visible() = kosmos.runTest { Loading
packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/viewmodel/HomeStatusBarViewModel.kt +12 −11 Original line number Diff line number Diff line Loading @@ -348,18 +348,19 @@ constructor( private val isHomeStatusBarAllowedByScene: Flow<Boolean> = combine( sceneInteractor.currentScene, isShadeVisibleOnThisDisplay, isShadeVisibleOnAnyDisplay, sceneContainerOcclusionInteractor.invisibleDueToOcclusion, ) { currentScene, isShadeVisible, isOccluded -> // All scenes have their own status bars, so we should only show the home status bar // 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 && !isShadeVisible) || isOccluded isShadeWindowOnThisDisplay, ) { currentScene, isShadeVisibleOnAnyDisplay, isOccluded, isShadeWindowOnThisDisplay -> if (isOccluded) { true } else if (isShadeWindowOnThisDisplay) { currentScene == Scenes.Gone && !isShadeVisibleOnAnyDisplay } else { // When the shade is visible on another display, // allow the home status bar on the current display. currentScene == Scenes.Gone || isShadeVisibleOnAnyDisplay } } .distinctUntilChanged() .logDiffsForTable( Loading