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

Commit b927b9b4 authored by Beverly's avatar Beverly
Browse files

Only run face auth onBouncerShowingSoon

When the scene container is not enabled,
only run face auth onBouncerShowingSoon
instead of both onBouncerShowingSoon AND
onBouncerShowing. onBouncerShowingSoon
is always called before onBouncerShowing

If the scene container is enabled,
we run face auth when the scene is
in transition to the bouncer.

Test: atest DeviceEntryFaceAuthInteractorTest
Fixes: 414045086
Flag: EXEMPT bugfix
Change-Id: I0cbe8513582df9ab76bd47f815ea88c2b9145f5a
parent 00143545
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()