Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,22 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { } } @Test @EnableSceneContainer fun surfaceBehindVisibility_whileSceneContainerNotVisible_alwaysTrue() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isFalse() kosmos.sceneInteractor.setVisible(false, "test") runCurrent() assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_idleWhileLocked_alwaysFalse() = Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +41 −30 Original line number Diff line number Diff line Loading @@ -196,23 +196,30 @@ constructor( .distinctUntilChanged() } private val lockscreenVisibilityWithScenes = private val lockscreenVisibilityWithScenes: Flow<Boolean> = // The scene container visibility into account as that will be forced to false when the // device isn't yet provisioned (e.g. still in the setup wizard). sceneInteractor.get().isVisible.flatMapLatestConflated { isVisible -> if (isVisible) { combine( sceneInteractor.get().transitionState.flatMapLatestConflated { when (it) { is Idle -> { is Idle -> when (it.currentScene) { in keyguardContent -> flowOf(true) in nonKeyguardContent -> flowOf(false) in keyguardAgnosticContent -> isDeviceNotEnteredDirectly else -> throw IllegalStateException("Unknown scene: ${it.currentScene}") } throw IllegalStateException( "Unknown scene: ${it.currentScene}" ) } is Transition -> { is Transition -> when { it.isTransitioningSets(from = keyguardContent) -> flowOf(true) it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false) it.isTransitioningSets(from = keyguardContent) -> flowOf(true) it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false) it.isTransitioningSets(from = keyguardAgnosticContent) -> isDeviceNotEnteredDirectly else -> Loading @@ -221,7 +228,6 @@ constructor( ) } } } }, wakeToGoneInteractor.canWakeDirectlyToGone, ::Pair, Loading @@ -229,6 +235,11 @@ constructor( .map { (lockscreenVisibilityByTransitionState, canWakeDirectlyToGone) -> lockscreenVisibilityByTransitionState && !canWakeDirectlyToGone } } else { // Lockscreen is never visible when the scene container is invisible. flowOf(false) } } private val lockscreenVisibilityLegacy = combine( Loading packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +2 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,8 @@ constructor( return } printSection("Scene state") { printSection("Framework state") { println("isVisible", sceneInteractor.isVisible.value) println("currentScene", sceneInteractor.currentScene.value.debugName) println( "currentOverlays", Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +16 −0 Original line number Diff line number Diff line Loading @@ -338,6 +338,22 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { } } @Test @EnableSceneContainer fun surfaceBehindVisibility_whileSceneContainerNotVisible_alwaysTrue() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isFalse() kosmos.sceneInteractor.setVisible(false, "test") runCurrent() assertThat(currentScene).isEqualTo(Scenes.Lockscreen) assertThat(isSurfaceBehindVisible).isTrue() } @Test @EnableSceneContainer fun surfaceBehindVisibility_idleWhileLocked_alwaysFalse() = Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +41 −30 Original line number Diff line number Diff line Loading @@ -196,23 +196,30 @@ constructor( .distinctUntilChanged() } private val lockscreenVisibilityWithScenes = private val lockscreenVisibilityWithScenes: Flow<Boolean> = // The scene container visibility into account as that will be forced to false when the // device isn't yet provisioned (e.g. still in the setup wizard). sceneInteractor.get().isVisible.flatMapLatestConflated { isVisible -> if (isVisible) { combine( sceneInteractor.get().transitionState.flatMapLatestConflated { when (it) { is Idle -> { is Idle -> when (it.currentScene) { in keyguardContent -> flowOf(true) in nonKeyguardContent -> flowOf(false) in keyguardAgnosticContent -> isDeviceNotEnteredDirectly else -> throw IllegalStateException("Unknown scene: ${it.currentScene}") } throw IllegalStateException( "Unknown scene: ${it.currentScene}" ) } is Transition -> { is Transition -> when { it.isTransitioningSets(from = keyguardContent) -> flowOf(true) it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false) it.isTransitioningSets(from = keyguardContent) -> flowOf(true) it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false) it.isTransitioningSets(from = keyguardAgnosticContent) -> isDeviceNotEnteredDirectly else -> Loading @@ -221,7 +228,6 @@ constructor( ) } } } }, wakeToGoneInteractor.canWakeDirectlyToGone, ::Pair, Loading @@ -229,6 +235,11 @@ constructor( .map { (lockscreenVisibilityByTransitionState, canWakeDirectlyToGone) -> lockscreenVisibilityByTransitionState && !canWakeDirectlyToGone } } else { // Lockscreen is never visible when the scene container is invisible. flowOf(false) } } private val lockscreenVisibilityLegacy = combine( Loading
packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +2 −1 Original line number Diff line number Diff line Loading @@ -195,7 +195,8 @@ constructor( return } printSection("Scene state") { printSection("Framework state") { println("isVisible", sceneInteractor.isVisible.value) println("currentScene", sceneInteractor.currentScene.value.debugName) println( "currentOverlays", Loading