summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard/src/com/android
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-03-10 20:06:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-03-10 20:07:00 +0000
commit75fc5928474c8a5ffbec76c9595df9427109f13a (patch)
treeef0d4e04fec9308d27fc297f298ea7fd9797f501 /packages/Keyguard/src/com/android
parentb08216c082da6ae0e7ec2f2161f4e16ffb3a1569 (diff)
parent7c11f8b4659c3444d5037b756b6e5f45a2ea61a6 (diff)
downloadframeworks_base-75fc5928474c8a5ffbec76c9595df9427109f13a.zip
frameworks_base-75fc5928474c8a5ffbec76c9595df9427109f13a.tar.gz
frameworks_base-75fc5928474c8a5ffbec76c9595df9427109f13a.tar.bz2
Merge "Fix bug that allowed avoiding lockout if too many wrong patterns are entered."
Diffstat (limited to 'packages/Keyguard/src/com/android')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index 0fa27c1..14de6dd 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -58,8 +58,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
// how many cells the user has to cross before we poke the wakelock
private static final int MIN_PATTERN_BEFORE_POKE_WAKELOCK = 2;
- private int mFailedPatternAttemptsSinceLastTimeout = 0;
- private int mTotalFailedPatternAttempts = 0;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+
private CountDownTimer mCountdownTimer = null;
private LockPatternUtils mLockPatternUtils;
private LockPatternView mLockPatternView;
@@ -100,6 +100,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
public KeyguardPatternView(Context context, AttributeSet attrs) {
super(context, attrs);
+ mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
}
public void setKeyguardCallback(KeyguardSecurityCallback callback) {
@@ -202,7 +203,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
if (mCallback.isVerifyUnlockOnly()) {
updateFooter(FooterMode.VerifyUnlocked);
} else if (mEnableFallback &&
- (mTotalFailedPatternAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
+ (mKeyguardUpdateMonitor.getFailedUnlockAttempts()
+ >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
updateFooter(FooterMode.ForgotLockPattern);
} else {
updateFooter(FooterMode.Normal);
@@ -211,7 +213,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
private void displayDefaultSecurityMessage() {
- if (KeyguardUpdateMonitor.getInstance(mContext).getMaxBiometricUnlockAttemptsReached()) {
+ if (mKeyguardUpdateMonitor.getMaxBiometricUnlockAttemptsReached()) {
mSecurityMessageDisplay.setMessage(R.string.faceunlock_multiple_failures, true);
} else {
mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false);
@@ -262,20 +264,20 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
if (mLockPatternUtils.checkPattern(pattern)) {
mCallback.reportUnlockAttempt(true);
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
- mTotalFailedPatternAttempts = 0;
mCallback.dismiss(true);
} else {
if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
mCallback.userActivity(UNLOCK_PATTERN_WAKE_INTERVAL_MS);
}
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
- if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
- mTotalFailedPatternAttempts++;
- mFailedPatternAttemptsSinceLastTimeout++;
+ boolean registeredAttempt =
+ pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL;
+ if (registeredAttempt) {
mCallback.reportUnlockAttempt(false);
}
- if (mFailedPatternAttemptsSinceLastTimeout
- >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
+ int attempts = mKeyguardUpdateMonitor.getFailedUnlockAttempts();
+ if (registeredAttempt &&
+ 0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
handleAttemptLockout(deadline);
} else {
@@ -363,7 +365,6 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
mLockPatternView.setEnabled(true);
displayDefaultSecurityMessage();
// TODO mUnlockIcon.setVisibility(View.VISIBLE);
- mFailedPatternAttemptsSinceLastTimeout = 0;
if (mEnableFallback) {
updateFooter(FooterMode.ForgotLockPattern);
} else {