diff options
3 files changed, 59 insertions, 31 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt index f0eedee48e57..4f351143c793 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt @@ -340,6 +340,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() = testScope.runTest { val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt index 68d595ebf0b6..b4e9d8296a74 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt @@ -196,39 +196,50 @@ constructor( .distinctUntilChanged() } - private val lockscreenVisibilityWithScenes = - combine( - sceneInteractor.get().transitionState.flatMapLatestConflated { - when (it) { - is Idle -> { - when (it.currentScene) { - in keyguardContent -> flowOf(true) - in nonKeyguardContent -> flowOf(false) - in keyguardAgnosticContent -> isDeviceNotEnteredDirectly - else -> - throw IllegalStateException("Unknown scene: ${it.currentScene}") - } - } - is Transition -> { - when { - it.isTransitioningSets(from = keyguardContent) -> flowOf(true) - it.isTransitioningSets(from = nonKeyguardContent) -> flowOf(false) - it.isTransitioningSets(from = keyguardAgnosticContent) -> - isDeviceNotEnteredDirectly - else -> - throw IllegalStateException( - "Unknown content: ${it.fromContent}" - ) + 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 -> + when (it.currentScene) { + in keyguardContent -> flowOf(true) + in nonKeyguardContent -> flowOf(false) + in keyguardAgnosticContent -> isDeviceNotEnteredDirectly + else -> + throw IllegalStateException( + "Unknown scene: ${it.currentScene}" + ) + } + is Transition -> + when { + it.isTransitioningSets(from = keyguardContent) -> + flowOf(true) + it.isTransitioningSets(from = nonKeyguardContent) -> + flowOf(false) + it.isTransitioningSets(from = keyguardAgnosticContent) -> + isDeviceNotEnteredDirectly + else -> + throw IllegalStateException( + "Unknown content: ${it.fromContent}" + ) + } } - } + }, + wakeToGoneInteractor.canWakeDirectlyToGone, + ::Pair, + ) + .map { (lockscreenVisibilityByTransitionState, canWakeDirectlyToGone) -> + lockscreenVisibilityByTransitionState && !canWakeDirectlyToGone } - }, - wakeToGoneInteractor.canWakeDirectlyToGone, - ::Pair, - ) - .map { (lockscreenVisibilityByTransitionState, canWakeDirectlyToGone) -> - lockscreenVisibilityByTransitionState && !canWakeDirectlyToGone + } else { + // Lockscreen is never visible when the scene container is invisible. + flowOf(false) } + } private val lockscreenVisibilityLegacy = combine( diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt index 7ed4b9f8abfa..06fc8610c97b 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt @@ -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", |