Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6df64bec authored by Steve Elliott's avatar Steve Elliott Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Hide surface under keyguard during swipe" into main

parents a76ecb70 7c95212d
Loading
Loading
Loading
Loading
+38 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() {

    @Test
    @EnableSceneContainer
    fun surfaceBehindVisibility_fromLockscreenToGone_trueThroughout() =
    fun surfaceBehindVisibility_fromLockscreenToGone_noUserInput_trueThroughout() =
        testScope.runTest {
            val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility)
            val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene)
@@ -247,6 +247,43 @@ class WindowManagerLockscreenVisibilityInteractorTest : SysuiTestCase() {
            assertThat(isSurfaceBehindVisible).isTrue()
        }

    @Test
    @EnableSceneContainer
    fun surfaceBehindVisibility_fromLockscreenToGone_withUserInput_falseUntilInputStops() =
        testScope.runTest {
            val isSurfaceBehindVisible by collectLastValue(underTest.value.surfaceBehindVisibility)
            val currentScene by collectLastValue(kosmos.sceneInteractor.currentScene)

            // Before the transition, we start on Lockscreen so the surface should start invisible.
            kosmos.setSceneTransition(ObservableTransitionState.Idle(Scenes.Lockscreen))
            assertThat(currentScene).isEqualTo(Scenes.Lockscreen)
            assertThat(isSurfaceBehindVisible).isFalse()

            // Unlocked with fingerprint.
            kosmos.deviceEntryFingerprintAuthRepository.setAuthenticationStatus(
                SuccessFingerprintAuthenticationStatus(0, true)
            )

            // Start the transition to Gone, the surface should not be visible while
            // isUserInputOngoing is true
            val isUserInputOngoing = MutableStateFlow(true)
            kosmos.setSceneTransition(
                ObservableTransitionState.Transition(
                    fromScene = Scenes.Lockscreen,
                    toScene = Scenes.Gone,
                    isInitiatedByUserInput = true,
                    isUserInputOngoing = isUserInputOngoing,
                    progress = flowOf(0.51f),
                    currentScene = flowOf(Scenes.Gone),
                )
            )
            assertThat(isSurfaceBehindVisible).isFalse()

            // When isUserInputOngoing becomes false, then the surface should become visible.
            isUserInputOngoing.value = false
            assertThat(isSurfaceBehindVisible).isTrue()
        }

    @Test
    @EnableSceneContainer
    fun surfaceBehindVisibility_fromBouncerToGone_becomesTrue() =
+11 −1
Original line number Diff line number Diff line
@@ -105,7 +105,17 @@ constructor(
                        is ObservableTransitionState.Transition ->
                            when {
                                transitionState.fromScene == Scenes.Lockscreen &&
                                    transitionState.toScene == Scenes.Gone -> flowOf(true)
                                    transitionState.toScene == Scenes.Gone ->
                                    sceneInteractor
                                        .get()
                                        .isTransitionUserInputOngoing
                                        .flatMapLatestConflated { isUserInputOngoing ->
                                            if (isUserInputOngoing) {
                                                isDeviceEntered
                                            } else {
                                                flowOf(true)
                                            }
                                        }
                                transitionState.fromScene == Scenes.Bouncer &&
                                    transitionState.toScene == Scenes.Gone ->
                                    transitionState.progress.map { progress ->