Merge "Keyguard should authenticate with FP even after getting valid FP" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-15 07:05:44 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 16 deletions

View File

@@ -165,11 +165,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private int mPhoneState; private int mPhoneState;
private boolean mKeyguardIsVisible; 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 mGoingToSleep;
private boolean mBouncer; private boolean mBouncer;
private boolean mBootCompleted; private boolean mBootCompleted;
@@ -409,11 +404,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private void onFingerprintAuthenticated(int userId) { private void onFingerprintAuthenticated(int userId) {
Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated"); Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
mUserFingerprintAuthenticated.put(userId, true); mUserFingerprintAuthenticated.put(userId, true);
// Don't send cancel if authentication succeeds
// If fingerprint unlocking is allowed, this event will lead to a Keyguard dismiss or to a mFingerprintCancelSignal = null;
// wake-up (if Keyguard is not showing), so we don't need to listen until Keyguard is
// fully gone.
mFingerprintAlreadyAuthenticated = isUnlockingWithFingerprintAllowed();
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) { if (cb != null) {
@@ -922,7 +914,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
} }
} }
mGoingToSleep = true; mGoingToSleep = true;
mFingerprintAlreadyAuthenticated = false;
updateFingerprintListeningState(); updateFingerprintListeningState();
} }
@@ -1092,8 +1083,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private boolean shouldListenForFingerprint() { private boolean shouldListenForFingerprint() {
return (mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep) return (mKeyguardIsVisible || !mDeviceInteractive || mBouncer || mGoingToSleep)
&& !mSwitchingUser && !mFingerprintAlreadyAuthenticated && !mSwitchingUser && !isFingerprintDisabled(getCurrentUser());
&& !isFingerprintDisabled(getCurrentUser());
} }
private void startListeningForFingerprint() { private void startListeningForFingerprint() {
@@ -1416,9 +1406,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
cb.onKeyguardVisibilityChangedRaw(showing); cb.onKeyguardVisibilityChangedRaw(showing);
} }
} }
if (!showing) {
mFingerprintAlreadyAuthenticated = false;
}
updateFingerprintListeningState(); updateFingerprintListeningState();
} }

View File

@@ -36,6 +36,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
public abstract boolean handleFailedAttempt(); public abstract boolean handleFailedAttempt();
public abstract void resetFailedAttempts(); public abstract void resetFailedAttempts();
private boolean mAlreadyCancelled;
public AuthenticationClient(Context context, long halDeviceId, IBinder token, public AuthenticationClient(Context context, long halDeviceId, IBinder token,
IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId, IFingerprintServiceReceiver receiver, int targetUserId, int groupId, long opId,
@@ -129,6 +130,10 @@ public abstract class AuthenticationClient extends ClientMonitor {
@Override @Override
public int stop(boolean initiatedByClient) { public int stop(boolean initiatedByClient) {
if (mAlreadyCancelled) {
Slog.w(TAG, "stopAuthentication: already cancelled!");
return 0;
}
IBiometricsFingerprint daemon = getFingerprintDaemon(); IBiometricsFingerprint daemon = getFingerprintDaemon();
if (daemon == null) { if (daemon == null) {
Slog.w(TAG, "stopAuthentication: no fingerprint HAL!"); Slog.w(TAG, "stopAuthentication: no fingerprint HAL!");
@@ -145,6 +150,7 @@ public abstract class AuthenticationClient extends ClientMonitor {
Slog.e(TAG, "stopAuthentication failed", e); Slog.e(TAG, "stopAuthentication failed", e);
return ERROR_ESRCH; return ERROR_ESRCH;
} }
mAlreadyCancelled = true;
return 0; // success return 0; // success
} }