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

Commit 404a28de authored by Kevin Chyn's avatar Kevin Chyn Committed by android-build-merger
Browse files

Merge "Keyguard should authenticate with FP even after getting valid FP" into oc-dev am: 4ea09f5c

am: 54b5b6d7

Change-Id: Ic865f205b44d3ba1b851b571a69b97c7a393a958
parents 626eb77c 54b5b6d7
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -165,11 +165,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private int mPhoneState;
    private boolean mKeyguardIsVisible;

    /**
     * If true, fingerprint was already authenticated and we don't need to start listening again
     * until the Keyguard has been dismissed.
     */
    private boolean mFingerprintAlreadyAuthenticated;
    private boolean mGoingToSleep;
    private boolean mBouncer;
    private boolean mBootCompleted;
@@ -409,11 +404,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    private void onFingerprintAuthenticated(int userId) {
        Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
        mUserFingerprintAuthenticated.put(userId, true);

        // If fingerprint unlocking is allowed, this event will lead to a Keyguard dismiss or to a
        // wake-up (if Keyguard is not showing), so we don't need to listen until Keyguard is
        // fully gone.
        mFingerprintAlreadyAuthenticated = isUnlockingWithFingerprintAllowed();
        // Don't send cancel if authentication succeeds
        mFingerprintCancelSignal = null;
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
@@ -922,7 +914,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
            }
        }
        mGoingToSleep = true;
        mFingerprintAlreadyAuthenticated = false;
        updateFingerprintListeningState();
    }

@@ -1092,8 +1083,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {

    private boolean shouldListenForFingerprint() {
        return (mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep)
                && !mSwitchingUser && !mFingerprintAlreadyAuthenticated
                && !isFingerprintDisabled(getCurrentUser());
                && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser());
    }

    private void startListeningForFingerprint() {
@@ -1416,9 +1406,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                cb.onKeyguardVisibilityChangedRaw(showing);
            }
        }
        if (!showing) {
            mFingerprintAlreadyAuthenticated = false;
        }
        updateFingerprintListeningState();
    }

+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ public abstract class AuthenticationClient extends ClientMonitor {

    public abstract boolean handleFailedAttempt();
    public abstract void resetFailedAttempts();
    private boolean mAlreadyCancelled;

    public AuthenticationClient(Context context, long halDeviceId, IBinder token,
            IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId,
@@ -129,6 +130,10 @@ public abstract class AuthenticationClient extends ClientMonitor {

    @Override
    public int stop(boolean initiatedByClient) {
        if (mAlreadyCancelled) {
            Slog.w(TAG, "stopAuthentication: already cancelled!");
            return 0;
        }
        IBiometricsFingerprint daemon = getFingerprintDaemon();
        if (daemon == null) {
            Slog.w(TAG, "stopAuthentication: no fingerprint HAL!");
@@ -145,6 +150,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
            Slog.e(TAG, "stopAuthentication failed", e);
            return ERROR_ESRCH;
        }
        mAlreadyCancelled = true;
        return 0; // success
    }