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

Commit 4dc098ae authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Reset fingerprint lockout upon successful unlock

FingerprintSettings should not start listening for fingerprints until
after Pin/Pattern/Pass is entered

Fixes: 63437524
Fixes: 63739006

Test: open FP settings, touch an invalid finger 5 times
close FP settings, re-enter FP settings, enter Pin/Pattern/Pass
touch FP with valid finger, should not be in lockout mode

Change-Id: I9b322248b30f3c4f49414e5bc0693f03a8f2dbe4
parent 3102245b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -646,13 +646,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        return mStrongAuthTracker;
    }

    public void reportSuccessfulStrongAuthUnlockAttempt() {
        if (mFpm != null) {
            byte[] token = null; /* TODO: pass real auth token once fp HAL supports it */
            mFpm.resetTimeout(token);
        }
    }

    private void notifyStrongAuthStateChanged(int userId) {
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
+0 −7
Original line number Diff line number Diff line
@@ -560,9 +560,6 @@ public class KeyguardViewMediator extends SystemUI {
            }

            tryKeyguardDone();
            if (strongAuth) {
                mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
            }
        }

        @Override
@@ -591,9 +588,6 @@ public class KeyguardViewMediator extends SystemUI {
            mStatusBarKeyguardViewManager.startPreHideAnimation(mHideAnimationFinishedRunnable);
            mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
                    KEYGUARD_DONE_PENDING_TIMEOUT_MS);
            if (strongAuth) {
                mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
            }
            Trace.endSection();
        }

@@ -1288,7 +1282,6 @@ public class KeyguardViewMediator extends SystemUI {
                // Without this, settings is not enabled until the lock screen first appears
                setShowingLocked(false);
                hideLocked();
                mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
                return;
            }
        }
+1 −0
Original line number Diff line number Diff line
@@ -560,6 +560,7 @@ public class LockSettingsService extends ILockSettings.Stub {
        mDeviceProvisionedObserver.onSystemReady();
        // TODO: maybe skip this for split system user mode.
        mStorage.prefetchUser(UserHandle.USER_SYSTEM);
        mStrongAuth.systemReady();
    }

    private void migrateOldData() {
+11 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.app.AlarmManager.OnAlarmListener;
import android.app.admin.DevicePolicyManager;
import android.app.trust.IStrongAuthTracker;
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Binder;
import android.os.DeadObjectException;
import android.os.Handler;
@@ -64,6 +65,7 @@ public class LockSettingsStrongAuth {
    private final Context mContext;

    private AlarmManager mAlarmManager;
    private FingerprintManager mFingerprintManager;

    public LockSettingsStrongAuth(Context context) {
        mContext = context;
@@ -71,6 +73,10 @@ public class LockSettingsStrongAuth {
        mAlarmManager = context.getSystemService(AlarmManager.class);
    }

    public void systemReady() {
        mFingerprintManager = mContext.getSystemService(FingerprintManager.class);
    }

    private void handleAddStrongAuthTracker(IStrongAuthTracker tracker) {
        for (int i = 0; i < mStrongAuthTrackers.size(); i++) {
            if (mStrongAuthTrackers.get(i).asBinder() == tracker.asBinder()) {
@@ -188,6 +194,11 @@ public class LockSettingsStrongAuth {
    }

    public void reportSuccessfulStrongAuthUnlock(int userId) {
        if (mFingerprintManager != null) {
            byte[] token = null; /* TODO: pass real auth token once fp HAL supports it */
            mFingerprintManager.resetTimeout(token);
        }

        final int argNotUsed = 0;
        mHandler.obtainMessage(MSG_SCHEDULE_STRONG_AUTH_TIMEOUT, userId, argNotUsed).sendToTarget();
    }