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

Commit b32e9cdd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Listen for the right edge transition." into main

parents 63b7b04c 0b7b7206
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),
                    )
                )
            }
        }