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

Commit 0b7b7206 authored by Andrey Yepin's avatar Andrey Yepin
Browse files

Listen for the right edge transition.

Update SystemUIDeviceEntryFaceAuthenticator to use the correct
dream-to-lockscreen edge for Flexiglass.

Fix: 436549011
Test: manual testing with and without the flag
Flag: com.android.systemui.scene_container
Change-Id: Ia25a2650f852c97baa73b44b01cc798312899ee6
parent 7f12e4ab
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.se
import com.android.systemui.power.domain.interactor.powerInteractor
import com.android.systemui.power.shared.model.WakeSleepReason
import com.android.systemui.scene.data.repository.ShowOverlay
import com.android.systemui.scene.data.repository.Transition
import com.android.systemui.scene.data.repository.setSceneTransition
import com.android.systemui.scene.domain.interactor.sceneInteractor
import com.android.systemui.scene.shared.model.Overlays
@@ -74,6 +75,7 @@ import com.android.systemui.user.data.model.SelectionStatus
import com.android.systemui.user.data.repository.fakeUserRepository
import com.android.systemui.util.mockito.eq
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flowOf
import org.junit.Before
import org.junit.Test
@@ -175,6 +177,38 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
                )
        }

    @Test
    @EnableSceneContainer
    @EnableFlags(FLAG_DREAMS_V2)
    fun faceAuthIsRequestedWhenTransitioningFromDreamToLockscreen_withSceneContainerEnabled() =
        kosmos.runTest {
            underTest.start()
            runCurrent()

            powerInteractor.setAwakeForTest(reason = PowerManager.WAKE_REASON_LID)
            fakeFaceWakeUpTriggersConfig.setTriggerFaceAuthOnWakeUpFrom(
                setOf(WakeSleepReason.LID.powerManagerWakeReason)
            )

            sceneInteractor.setTransitionState(
                MutableStateFlow(Transition(from = Scenes.Dream, to = Scenes.Lockscreen))
            )
            runCurrent()
            fakeKeyguardTransitionRepository.sendTransitionStep(
                TransitionStep(
                    KeyguardState.UNDEFINED,
                    KeyguardState.LOCKSCREEN,
                    transitionState = TransitionState.STARTED,
                )
            )
            runCurrent()

            assertThat(faceAuthRepository.runningAuthRequest.value)
                .isEqualTo(
                    Pair(FaceAuthUiEvent.FACE_AUTH_UPDATED_KEYGUARD_VISIBILITY_CHANGED, true)
                )
        }

    @Test
    fun whenFaceIsLockedOutAndNonBypassAnyAttemptsToTriggerFaceAuthMustProvideLockoutError() =
        kosmos.runTest {
+6 −1
Original line number Diff line number Diff line
@@ -170,7 +170,12 @@ constructor(
            add(keyguardTransitionInteractor.transition(Edge.create(DOZING, LOCKSCREEN)))

            if (dreamsV2()) {
                add(keyguardTransitionInteractor.transition(Edge.create(DREAMING, LOCKSCREEN)))
                add(
                    keyguardTransitionInteractor.transition(
                        edge = Edge.create(Scenes.Dream, LOCKSCREEN),
                        edgeWithoutSceneContainer = Edge.create(DREAMING, LOCKSCREEN),
                    )
                )
            }
        }