diff options
author | Uriel Rodriguez <urodriguez@google.com> | 2011-10-14 11:04:37 -0400 |
---|---|---|
committer | Uriel Rodriguez <urodriguez@google.com> | 2011-10-14 16:25:42 -0400 |
commit | fd2ed6910f932ce43b621d6296eff112e137fbf9 (patch) | |
tree | 5fe29da32ac12932577515dafc79763ba456e7a7 /policy | |
parent | 23b80f083b0a2ccd26f37298d4f9611de3857a31 (diff) | |
download | frameworks_base-fd2ed6910f932ce43b621d6296eff112e137fbf9.zip frameworks_base-fd2ed6910f932ce43b621d6296eff112e137fbf9.tar.gz frameworks_base-fd2ed6910f932ce43b621d6296eff112e137fbf9.tar.bz2 |
going directly to backup after face unlock fails 15 times
- after 15 failed face unlock attempts, go to backup until the backup method is successful
- if the backup method times out (because too many unsuccessful unlocking attempts),
face unlock will not be launched until the backup method is used sucessfully
- fixes 5365919
Change-Id: I9aef7a4f1abcceefc5d6f1c0458ae5cbe8a902df
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 80275b1..022c09b 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -129,6 +129,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler // So the user has a consistent amount of time when brought to the backup method from FaceLock private final int BACKUP_LOCK_TIMEOUT = 5000; + // Needed to keep track of failed FaceUnlock attempts + private int mFailedFaceUnlockAttempts = 0; + private static final int FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP = 15; + /** * The current {@link KeyguardScreen} will use this to communicate back to us. */ @@ -424,6 +428,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } public void reportSuccessfulUnlockAttempt() { + mFailedFaceUnlockAttempts = 0; mLockPatternUtils.reportSuccessfulPasswordAttempt(); } }; @@ -536,7 +541,16 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler * FaceLock, but only if we're not dealing with a call */ private void activateFaceLockIfAble() { - if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE && !mHasOverlay) { + final boolean tooManyFaceUnlockTries = + (mFailedFaceUnlockAttempts >= FAILED_FACE_UNLOCK_ATTEMPTS_BEFORE_BACKUP); + final int failedBackupAttempts = mUpdateMonitor.getFailedAttempts(); + final boolean backupIsTimedOut = + (failedBackupAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT); + if (tooManyFaceUnlockTries) Log.i(TAG, "tooManyFaceUnlockTries: " + tooManyFaceUnlockTries); + if (mUpdateMonitor.getPhoneState() == TelephonyManager.CALL_STATE_IDLE + && !mHasOverlay + && !tooManyFaceUnlockTries + && !backupIsTimedOut) { bindToFaceLock(); // Show FaceLock area, but only for a little bit so lockpattern will become visible if // FaceLock fails to start or crashes @@ -1257,7 +1271,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler } // Stops the FaceLock UI and exposes the backup method without unlocking - // This means either the user has cancelled out or FaceLock failed to recognize them + // This means the user has cancelled out @Override public void cancel() { if (DEBUG) Log.d(TAG, "FaceLock cancel()"); @@ -1266,6 +1280,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); } + // Stops the FaceLock UI and exposes the backup method without unlocking + // This means FaceLock failed to recognize them + @Override + public void reportFailedAttempt() { + if (DEBUG) Log.d(TAG, "FaceLock reportFailedAttempt()"); + mFailedFaceUnlockAttempts++; + hideFaceLockArea(); // Expose fallback + stopFaceLock(); + mKeyguardScreenCallback.pokeWakelock(BACKUP_LOCK_TIMEOUT); + } + // Allows the Face Unlock service to poke the wake lock to keep the lockscreen alive @Override public void pokeWakelock() { |