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

Commit 7c95212d authored by Steve Elliott's avatar Steve Elliott
Browse files

[flexiglass] Hide surface under keyguard during swipe

We now wait until the user lifts their finger before revealing the
surface underneath lockscreen.

Flag: com.android.systemui.scene_container DEVELOPMENT
Bug: 344844978
Test: manual
 0. Enable flexiglass
 1. Swipe up on the keyguard, do not lift finger.
 Observe: launcher does not appear
 2. Release finger
 Observe: launcher appears
Change-Id: Ic7ea906efaab486c08f03e3aea2172469351f8d2
parent c455fb1d
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 ->