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

Commit ca430960 authored by Chandru S's avatar Chandru S
Browse files

Do not run device entry face auth when keyguard is not showing

                                                                                                                                                                   Other changes:
 - Reduce hardware error retry count to 5 (unresolved comment in another CL)

Fixes: 283077185
Fixes: 285495324
Test: atest DeviceEntryFaceAuthRepositoryTest
Test: verified manually that the current triggers are not impacted.
Change-Id: I54d799795cbd224b9a16978ed9c2bf5b2514e0ba
parent f7160398
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -335,6 +335,11 @@ constructor(
                    biometricSettingsRepository.isCurrentUserInLockdown.isFalse(),
                    "userHasNotLockedDownDevice",
                    tableLogBuffer
                ),
                logAndObserve(
                    keyguardRepository.isKeyguardShowing,
                    "isKeyguardShowing",
                    tableLogBuffer
                )
            )
            .reduce(::and)
@@ -598,7 +603,7 @@ constructor(
        const val DEFAULT_CANCEL_SIGNAL_TIMEOUT = 3000L

        /** Number of allowed retries whenever there is a face hardware error */
        const val HAL_ERROR_RETRY_MAX = 20
        const val HAL_ERROR_RETRY_MAX = 5

        /** Timeout before retries whenever there is a HAL error. */
        const val HAL_ERROR_RETRY_TIMEOUT = 500L // ms
+17 −0
Original line number Diff line number Diff line
@@ -506,6 +506,18 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
            testGatingCheckForFaceAuth { fakeUserRepository.setUserSwitching(true) }
        }

    @Test
    fun authenticateDoesNotRunIfKeyguardIsNotShowing() =
        testScope.runTest {
            testGatingCheckForFaceAuth { keyguardRepository.setKeyguardShowing(false) }
        }

    @Test
    fun detectDoesNotRunIfKeyguardIsNotShowing() =
        testScope.runTest {
            testGatingCheckForDetect { keyguardRepository.setKeyguardShowing(false) }
        }

    @Test
    fun authenticateDoesNotRunWhenFpIsLockedOut() =
        testScope.runTest {
@@ -565,6 +577,8 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
        testScope.runTest {
            testGatingCheckForFaceAuth {
                bouncerRepository.setAlternateVisible(false)
                // Keyguard is occluded when secure camera is active.
                keyguardRepository.setKeyguardOccluded(true)
                fakeCommandQueue.doForEachCallback {
                    it.onCameraLaunchGestureDetected(CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP)
                }
@@ -774,6 +788,8 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
        testScope.runTest {
            testGatingCheckForDetect {
                bouncerRepository.setAlternateVisible(false)
                // Keyguard is occluded when secure camera is active.
                keyguardRepository.setKeyguardOccluded(true)
                fakeCommandQueue.doForEachCallback {
                    it.onCameraLaunchGestureDetected(CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP)
                }
@@ -1011,6 +1027,7 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
        fakeUserRepository.setSelectedUserInfo(primaryUser)
        biometricSettingsRepository.setIsFaceAuthSupportedInCurrentPosture(true)
        bouncerRepository.setAlternateVisible(true)
        keyguardRepository.setKeyguardShowing(true)
        runCurrent()
    }