summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/src
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-08-18 19:49:04 -0700
committerJorim Jaggi <jjaggi@google.com>2015-08-19 17:06:29 -0700
commit71448a70036e8f95a4f7f3b0f6252bd3344976bb (patch)
treee5a07ac877a3c976fe91cc11c2687ecfd74068d6 /packages/Keyguard/src
parent5fb4b98bdd33475703f8928699c8a6b91fd06550 (diff)
downloadframeworks_base-71448a70036e8f95a4f7f3b0f6252bd3344976bb.zip
frameworks_base-71448a70036e8f95a4f7f3b0f6252bd3344976bb.tar.gz
frameworks_base-71448a70036e8f95a4f7f3b0f6252bd3344976bb.tar.bz2
Don't call authenticate immediately after getting valid fingerprint
After gettin a callback onAuthenticationSucceded we set the fingerprint listening state to false. However, when waking up, we immediately started listening again because the state was false. Protect against that by only calling authenticate only once, except when the unlock doesn't go through because unlocking with fingerprint is not allowed. Also fixes some animation "jank" because of the state messup. Bug: 23304421 Change-Id: Ic83ac0f1590dd4f8017bb55dca9e19a60cfdf99f
Diffstat (limited to 'packages/Keyguard/src')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 4eb6f88..40dcd0d 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -147,6 +147,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private int mRingMode;
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 mBouncer;
private boolean mBootCompleted;
private boolean mUserHasAuthenticatedSinceBoot;
@@ -373,6 +379,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private void onFingerprintAuthenticated(int userId) {
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();
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {
@@ -818,6 +829,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
cb.onFinishedGoingToSleep(arg1);
}
}
+ mFingerprintAlreadyAuthenticated = false;
updateFingerprintListeningState();
}
@@ -951,13 +963,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
}
private boolean shouldListenForFingerprint() {
- return (mKeyguardIsVisible || !mDeviceInteractive) && !mSwitchingUser;
+ return (mKeyguardIsVisible || !mDeviceInteractive) && !mSwitchingUser
+ && !mFingerprintAlreadyAuthenticated;
}
private void startListeningForFingerprint() {
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
int userId = ActivityManager.getCurrentUser();
- if (!mFingerprintDetectionRunning && isUnlockWithFingerprintPossible(userId)) {
+ if (isUnlockWithFingerprintPossible(userId)) {
mUserHasAuthenticatedSinceBoot = mTrustManager.hasUserAuthenticatedSinceBoot(
ActivityManager.getCurrentUser());
if (mFingerprintCancelSignal != null) {
@@ -1249,6 +1262,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
cb.onKeyguardVisibilityChangedRaw(isShowing);
}
}
+ if (!isShowing) {
+ mFingerprintAlreadyAuthenticated = false;
+ }
updateFingerprintListeningState();
}