Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +77 −0 Original line number Diff line number Diff line Loading @@ -1228,6 +1228,83 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { assertEquals(listOf(false, true, false), aodVisibility) } @Test @EnableSceneContainer fun lockscreenVisibility_notVisibleCollapsingShadeOverLockscreen() = kosmos.runTest { enableSingleShade() runCurrent() setSceneTransition(Idle(Scenes.Lockscreen)) val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Shade)) sceneInteractor.changeScene(Scenes.Shade, "") assertThat(lockscreenVisibility).isTrue() // Ensure that LS remains not visible during Shade -> Lockscreen. Since Shade is not // explicitly a Keyguard scene, we've had regressions where lockscreen becomes visible // during transitions from Shade. setSceneTransition(Transition(from = Scenes.Shade, to = Scenes.Lockscreen)) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Lockscreen)) sceneInteractor.changeScene(Scenes.Lockscreen, "") assertThat(lockscreenVisibility).isTrue() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") assertThat(lockscreenVisibility).isFalse() } @Test @EnableSceneContainer fun lockscreenVisibility_remainsVisibleDuringLsGone() = kosmos.runTest { enableSingleShade() runCurrent() setSceneTransition(Idle(Scenes.Lockscreen)) val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isTrue() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") assertThat(lockscreenVisibility).isFalse() } @Test @EnableSceneContainer fun lockscreenVisibility_remainsNotVisibleDuringGoneLs() = kosmos.runTest { enableSingleShade() runCurrent() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isFalse() // Lockscreen vis remains false during Gone -> LS so the unlocked app content is visible // during the screen off animation. setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) assertThat(lockscreenVisibility).isFalse() setSceneTransition(Idle(Scenes.Lockscreen)) sceneInteractor.changeScene(Scenes.Lockscreen, "") assertThat(lockscreenVisibility).isTrue() } companion object { private val progress = MutableStateFlow(0f) Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +11 −8 Original line number Diff line number Diff line Loading @@ -232,14 +232,17 @@ constructor( // visible. it.currentOverlays.contains(Overlays.Bouncer) -> flowOf(true) // If transitioning between two shade scenes and the bouncer // overlay is not showing, report that the keyguard is // visible if the device hasn't yet been entered. it.fromScene in shadeScenes && it.toScene in shadeScenes -> isDeviceNotEnteredDirectly // In all other cases, report that the keyguard isn't // visible. else -> flowOf(false) // Otherwise, default to showing the lockscreen if the // device is not yet entered, or leaving it not showing if // the device was entered. This covers two requirements: // - For LS -> Gone and vice versa, lockscreen visibility // state needs to not change until the end of the // transition, so that animations can play on the LS UI // elements (or over the unlocked app content). // - For transitions such as Shade -> LS, which can occur // both while locked and unlocked, the lockscreen // visibility should simply not change. else -> isDeviceNotEnteredDirectly } is Transition.OverlayTransition -> Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractorTest.kt +77 −0 Original line number Diff line number Diff line Loading @@ -1228,6 +1228,83 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() { assertEquals(listOf(false, true, false), aodVisibility) } @Test @EnableSceneContainer fun lockscreenVisibility_notVisibleCollapsingShadeOverLockscreen() = kosmos.runTest { enableSingleShade() runCurrent() setSceneTransition(Idle(Scenes.Lockscreen)) val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Shade)) sceneInteractor.changeScene(Scenes.Shade, "") assertThat(lockscreenVisibility).isTrue() // Ensure that LS remains not visible during Shade -> Lockscreen. Since Shade is not // explicitly a Keyguard scene, we've had regressions where lockscreen becomes visible // during transitions from Shade. setSceneTransition(Transition(from = Scenes.Shade, to = Scenes.Lockscreen)) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Lockscreen)) sceneInteractor.changeScene(Scenes.Lockscreen, "") assertThat(lockscreenVisibility).isTrue() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") assertThat(lockscreenVisibility).isFalse() } @Test @EnableSceneContainer fun lockscreenVisibility_remainsVisibleDuringLsGone() = kosmos.runTest { enableSingleShade() runCurrent() setSceneTransition(Idle(Scenes.Lockscreen)) val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isTrue() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Transition(from = Scenes.Lockscreen, to = Scenes.Gone)) assertThat(lockscreenVisibility).isTrue() setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") assertThat(lockscreenVisibility).isFalse() } @Test @EnableSceneContainer fun lockscreenVisibility_remainsNotVisibleDuringGoneLs() = kosmos.runTest { enableSingleShade() runCurrent() kosmos.authenticationInteractor.authenticate(FakeAuthenticationRepository.DEFAULT_PIN) setSceneTransition(Idle(Scenes.Gone)) sceneInteractor.changeScene(Scenes.Gone, "") val lockscreenVisibility by collectLastValue(underTest.lockscreenVisibility) assertThat(lockscreenVisibility).isFalse() // Lockscreen vis remains false during Gone -> LS so the unlocked app content is visible // during the screen off animation. setSceneTransition(Transition(from = Scenes.Gone, to = Scenes.Lockscreen)) assertThat(lockscreenVisibility).isFalse() setSceneTransition(Idle(Scenes.Lockscreen)) sceneInteractor.changeScene(Scenes.Lockscreen, "") assertThat(lockscreenVisibility).isTrue() } companion object { private val progress = MutableStateFlow(0f) Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt +11 −8 Original line number Diff line number Diff line Loading @@ -232,14 +232,17 @@ constructor( // visible. it.currentOverlays.contains(Overlays.Bouncer) -> flowOf(true) // If transitioning between two shade scenes and the bouncer // overlay is not showing, report that the keyguard is // visible if the device hasn't yet been entered. it.fromScene in shadeScenes && it.toScene in shadeScenes -> isDeviceNotEnteredDirectly // In all other cases, report that the keyguard isn't // visible. else -> flowOf(false) // Otherwise, default to showing the lockscreen if the // device is not yet entered, or leaving it not showing if // the device was entered. This covers two requirements: // - For LS -> Gone and vice versa, lockscreen visibility // state needs to not change until the end of the // transition, so that animations can play on the LS UI // elements (or over the unlocked app content). // - For transitions such as Shade -> LS, which can occur // both while locked and unlocked, the lockscreen // visibility should simply not change. else -> isDeviceNotEnteredDirectly } is Transition.OverlayTransition -> Loading