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

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

Minor face auth fixes

1. Reset auth state on device going to sleep
2. Stop face auth when user input is happening on primary bouncer
3. Fix some logging inconsistencies

Fixes: 275802536, 278627459
Test: atest DeviceEntryFaceAuthRepositoryTest, KeyguardFaceAuthInteractorTest
Change-Id: I6f10ec30d6ce08072b33fa66759568f026e35fdb
parent fa88b450
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard

        @Override
        public void onUserInput() {
            mKeyguardFaceAuthInteractor.onPrimaryBouncerUserInput();
            mUpdateMonitor.cancelFaceAuth();
        }

+16 −9
Original line number Diff line number Diff line
@@ -225,10 +225,17 @@ constructor(
    }

    private fun observeFaceAuthResettingConditions() {
        // Clear auth status when keyguard is going away or when the user is switching.
        merge(keyguardRepository.isKeyguardGoingAway, userRepository.userSwitchingInProgress)
            .onEach { goingAwayOrUserSwitchingInProgress ->
                if (goingAwayOrUserSwitchingInProgress) {
        // Clear auth status when keyguard is going away or when the user is switching or device
        // starts going to sleep.
        merge(
                keyguardRepository.wakefulness.map {
                    WakefulnessModel.isSleepingOrStartingToSleep(it)
                },
                keyguardRepository.isKeyguardGoingAway,
                userRepository.userSwitchingInProgress
            )
            .onEach { anyOfThemIsTrue ->
                if (anyOfThemIsTrue) {
                    _isAuthenticated.value = false
                    retryCount = 0
                    halErrorRetryJob?.cancel()
@@ -248,8 +255,8 @@ constructor(
                    "nonStrongBiometricIsNotAllowed",
                    faceDetectLog
                ),
                // We don't want to run face detect if it's not possible to authenticate with FP
                // from the bouncer. UDFPS is the only fp sensor type that won't support this.
                // We don't want to run face detect if fingerprint can be used to unlock the device
                // but it's not possible to authenticate with FP from the bouncer (UDFPS)
                logAndObserve(
                    and(isUdfps(), deviceEntryFingerprintAuthRepository.isRunning).isFalse(),
                    "udfpsAuthIsNotPossibleAnymore",
@@ -306,7 +313,7 @@ constructor(
                logAndObserve(
                    combine(
                        keyguardInteractor.isSecureCameraActive,
                        alternateBouncerInteractor.isVisible,
                        alternateBouncerInteractor.isVisible
                    ) { a, b ->
                        !a || b
                    },
@@ -334,12 +341,12 @@ constructor(
                logAndObserve(isLockedOut.isFalse(), "isNotInLockOutState", faceAuthLog),
                logAndObserve(
                    deviceEntryFingerprintAuthRepository.isLockedOut.isFalse(),
                    "fpLockedOut",
                    "fpIsNotLockedOut",
                    faceAuthLog
                ),
                logAndObserve(
                    trustRepository.isCurrentUserTrusted.isFalse(),
                    "currentUserTrusted",
                    "currentUserIsNotTrusted",
                    faceAuthLog
                ),
                logAndObserve(
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ interface KeyguardFaceAuthInteractor {
    fun onQsExpansionStared()
    fun onNotificationPanelClicked()
    fun onSwipeUpOnBouncer()
    fun onPrimaryBouncerUserInput()
}

/**
+1 −0
Original line number Diff line number Diff line
@@ -59,4 +59,5 @@ class NoopKeyguardFaceAuthInteractor @Inject constructor() : KeyguardFaceAuthInt
    override fun onNotificationPanelClicked() {}

    override fun onSwipeUpOnBouncer() {}
    override fun onPrimaryBouncerUserInput() {}
}
+4 −0
Original line number Diff line number Diff line
@@ -151,6 +151,10 @@ constructor(
        return featureFlags.isEnabled(Flags.FACE_AUTH_REFACTOR)
    }

    override fun onPrimaryBouncerUserInput() {
        repository.cancel()
    }

    /** Provide the status of face authentication */
    override val authenticationStatus = repository.authenticationStatus

Loading