From 29aa5dc7de41cc41428dfa958a0cbeac38b29e26 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 17 Oct 2011 21:44:19 -0700 Subject: [PATCH] Fix 5452698: fix broken logic in reportFailedAttempt() in lockscreen This fixes a bug where we were no longer showing the countdown dialog every 5 attempts or "forgot pattern" button when the user has a fallback password enabled on the pattern unlock screen. It now correctly shows the dialog whenever the user hits a multiple of 5 bad attempts on any of the pin/pattern/password screens. Change-Id: I4eb47b4149958a93572d256a4a70f9d67bc1eb38 --- .../policy/impl/LockPatternKeyguardView.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index ebf380a1f9fe2..c00abb6f52258 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -421,16 +421,20 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler Slog.i(TAG, "Too many unlock attempts; device will be wiped!"); showWipeDialog(failedAttempts); } - } else if (usingPattern && mEnableFallback) { - if (failedAttempts == failedAttemptWarning) { - showAlmostAtAccountLoginDialog(); - } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) { - mLockPatternUtils.setPermanentlyLocked(true); - updateScreen(mMode, false); - } } else { - final boolean showTimeout = + boolean showTimeout = (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0; + if (usingPattern && mEnableFallback) { + if (failedAttempts == failedAttemptWarning) { + showAlmostAtAccountLoginDialog(); + showTimeout = false; // don't show both dialogs + } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) { + mLockPatternUtils.setPermanentlyLocked(true); + updateScreen(mMode, false); + // don't show timeout dialog because we show account unlock screen next + showTimeout = false; + } + } if (showTimeout) { showTimeoutDialog(); }