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

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

Merge "Only run face auth onBouncerShowingSoon" into main

parents 624b5643 b927b9b4
Loading
Loading
Loading
Loading
+25 −16
Original line number Diff line number Diff line
@@ -353,22 +353,6 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
            assertThat(faceAuthRepository.runningAuthRequest.value!!.second).isEqualTo(false)
        }

    @Test
    @DisableSceneContainer
    fun faceAuthIsRequestedWhenPrimaryBouncerIsVisible() =
        testScope.runTest {
            underTest.start()

            bouncerRepository.setPrimaryShow(false)
            runCurrent()

            bouncerRepository.setPrimaryShow(true)
            runCurrent()

            assertThat(faceAuthRepository.runningAuthRequest.value)
                .isEqualTo(Pair(FaceAuthUiEvent.FACE_AUTH_UPDATED_PRIMARY_BOUNCER_SHOWN, false))
        }

    @Test
    @EnableSceneContainer
    fun faceAuthIsRequestedWhenPrimaryBouncerIsVisible_withSceneContainerEnabled() =
@@ -389,6 +373,7 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
        }

    @Test
    @DisableSceneContainer
    fun faceAuthIsRequestedWhenPrimaryBouncerIsAboutToShow() =
        testScope.runTest {
            underTest.start()
@@ -408,6 +393,30 @@ class DeviceEntryFaceAuthInteractorTest : SysuiTestCase() {
                )
        }

    @Test
    @DisableSceneContainer
    fun faceAuthIsOnlyRequestedWhenPrimaryBouncerIsAboutToShow() =
        testScope.runTest {
            underTest.start()

            bouncerRepository.setPrimaryShowingSoon(false)
            bouncerRepository.setPrimaryShow(false)
            runCurrent()

            bouncerRepository.setPrimaryShowingSoon(true)
            runCurrent()
            bouncerRepository.setPrimaryShow(true)
            runCurrent()

            assertThat(faceAuthRepository.runningAuthRequest.value)
                .isEqualTo(
                    Pair(
                        FaceAuthUiEvent.FACE_AUTH_UPDATED_PRIMARY_BOUNCER_SHOWN_OR_WILL_BE_SHOWN,
                        false,
                    )
                )
        }

    @Test
    @EnableSceneContainer
    fun withSceneContainerEnabled_faceAuthIsRequestedWhenPrimaryBouncerIsVisible() =
+27 −20
Original line number Diff line number Diff line
@@ -116,6 +116,8 @@ constructor(
        keyguardUpdateMonitor.setFaceAuthInteractor(this)
        observeFaceAuthStateUpdates()
        faceAuthenticationLogger.interactorStarted()

        if (SceneContainerFlag.isEnabled) {
            isBouncerVisible
                .whenItFlipsToTrue()
                .onEach {
@@ -126,7 +128,11 @@ constructor(
                    )
                }
                .launchIn(applicationScope)

        } else {
            // When face auth can run, `isBouncerShowingSoon` will always gets triggered before
            // `isBouncerVisible`. Only run face auth when `isBouncerShowingSoon` (and not
            // `isBouncerVisible` to avoid running face auth twice for a single transition
            // to the primary bouncer.
            isBouncerShowingSoon
                .whenItFlipsToTrue()
                .onEach {
@@ -137,6 +143,7 @@ constructor(
                    )
                }
                .launchIn(applicationScope)
        }

        alternateBouncerInteractor.isVisible
            .whenItFlipsToTrue()