Loading packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +49 −0 Original line number Diff line number Diff line Loading @@ -1768,6 +1768,55 @@ class SceneContainerStartableTest : SysuiTestCase() { verify(notificationShadeWindowController, times(2)).setNotificationShadeFocusable(false) } @Test fun hydrateWindowController_setNotificationShadeFocusable_dual_shade() = kosmos.runTest { enableDualShade() runCurrent() val currentDesiredSceneKey by collectLastValue(sceneInteractor.currentScene) val transitionStateFlow = prepareState( isDeviceUnlocked = true, initialSceneKey = Scenes.Gone, ) assertThat(currentDesiredSceneKey).isEqualTo(Scenes.Gone) verify(notificationShadeWindowController, never()) .setNotificationShadeFocusable(anyBoolean()) underTest.start() runCurrent() // By default, the notification shade window should not be focusable. verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(0)).setNotificationShadeFocusable(true) sceneInteractor.showOverlay(Overlays.QuickSettingsShade, loggingReason="") transitionStateFlow.value = ObservableTransitionState.Idle( Scenes.Gone, setOf(Overlays.QuickSettingsShade) ) // When showing the Quick Settings shade with the `Gone` scene, the notification shade // window should be focusable. runCurrent() verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(true) sceneInteractor.showOverlay(Overlays.NotificationsShade, loggingReason="") sceneInteractor.hideOverlay(Overlays.QuickSettingsShade, loggingReason="") transitionStateFlow.value = ObservableTransitionState.Idle( Scenes.Gone, setOf(Overlays.NotificationsShade) ) // When showing the notification shade with the `Gone` scene, the notification shade // window should be focusable. runCurrent() verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(2)).setNotificationShadeFocusable(true) } @Test fun hydrateWindowController_setKeyguardShowing() = kosmos.runTest { Loading packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +6 −5 Original line number Diff line number Diff line Loading @@ -834,12 +834,13 @@ constructor( private fun hydrateWindowController() { applicationScope.launch { sceneInteractor.transitionState .mapNotNull { transitionState -> (transitionState as? ObservableTransitionState.Idle)?.currentScene } .filterIsInstance<ObservableTransitionState.Idle>() .map { it.currentScene to it.currentOverlays } .distinctUntilChanged() .collect { sceneKey -> windowController.setNotificationShadeFocusable(sceneKey != Scenes.Gone) .collect { (currentScene, currentOverlays) -> windowController.setNotificationShadeFocusable( currentScene != Scenes.Gone || currentOverlays.isNotEmpty() ) } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +49 −0 Original line number Diff line number Diff line Loading @@ -1768,6 +1768,55 @@ class SceneContainerStartableTest : SysuiTestCase() { verify(notificationShadeWindowController, times(2)).setNotificationShadeFocusable(false) } @Test fun hydrateWindowController_setNotificationShadeFocusable_dual_shade() = kosmos.runTest { enableDualShade() runCurrent() val currentDesiredSceneKey by collectLastValue(sceneInteractor.currentScene) val transitionStateFlow = prepareState( isDeviceUnlocked = true, initialSceneKey = Scenes.Gone, ) assertThat(currentDesiredSceneKey).isEqualTo(Scenes.Gone) verify(notificationShadeWindowController, never()) .setNotificationShadeFocusable(anyBoolean()) underTest.start() runCurrent() // By default, the notification shade window should not be focusable. verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(0)).setNotificationShadeFocusable(true) sceneInteractor.showOverlay(Overlays.QuickSettingsShade, loggingReason="") transitionStateFlow.value = ObservableTransitionState.Idle( Scenes.Gone, setOf(Overlays.QuickSettingsShade) ) // When showing the Quick Settings shade with the `Gone` scene, the notification shade // window should be focusable. runCurrent() verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(true) sceneInteractor.showOverlay(Overlays.NotificationsShade, loggingReason="") sceneInteractor.hideOverlay(Overlays.QuickSettingsShade, loggingReason="") transitionStateFlow.value = ObservableTransitionState.Idle( Scenes.Gone, setOf(Overlays.NotificationsShade) ) // When showing the notification shade with the `Gone` scene, the notification shade // window should be focusable. runCurrent() verify(notificationShadeWindowController, times(1)).setNotificationShadeFocusable(false) verify(notificationShadeWindowController, times(2)).setNotificationShadeFocusable(true) } @Test fun hydrateWindowController_setKeyguardShowing() = kosmos.runTest { Loading
packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +6 −5 Original line number Diff line number Diff line Loading @@ -834,12 +834,13 @@ constructor( private fun hydrateWindowController() { applicationScope.launch { sceneInteractor.transitionState .mapNotNull { transitionState -> (transitionState as? ObservableTransitionState.Idle)?.currentScene } .filterIsInstance<ObservableTransitionState.Idle>() .map { it.currentScene to it.currentOverlays } .distinctUntilChanged() .collect { sceneKey -> windowController.setNotificationShadeFocusable(sceneKey != Scenes.Gone) .collect { (currentScene, currentOverlays) -> windowController.setNotificationShadeFocusable( currentScene != Scenes.Gone || currentOverlays.isNotEmpty() ) } } Loading