From c15dcf7ea1421305a54f256777212373c28c53c0 Mon Sep 17 00:00:00 2001 From: Konstantin Lopyrev Date: Fri, 14 May 2010 11:50:09 -0700 Subject: [PATCH] Fix 2571606: Correct message after too many failed attempts for password and pin. Change-Id: Ib712c692804b067b95b261852afdd9fac40194c4 --- core/res/res/values/strings.xml | 17 ++++++++++++++++- .../policy/impl/LockPatternKeyguardView.java | 11 ++++++++++- .../policy/impl/PasswordUnlockScreen.java | 9 ++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 63d391a8ee441..0071ea27e65d6 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1513,12 +1513,27 @@ progress dialog in the meantime. this is the emssage. --> Unlocking SIM card\u2026 - + You have incorrectly drawn your unlock pattern %d times. \n\nPlease try again in %d seconds. + + + You have incorrectly entered your password %d times. + \n\nPlease try again in %d seconds. + + + + + You have incorrectly entered your PIN %d times. + \n\nPlease try again in %d seconds. + + diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java index 27706eff298d7..587f9c19dc3a1 100644 --- a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -687,8 +687,17 @@ public class LockPatternKeyguardView extends KeyguardViewBase { private void showTimeoutDialog() { int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000; + int messageId = R.string.lockscreen_too_many_failed_attempts_dialog_message;; + if(getUnlockMode() == UnlockMode.Password) { + if(mLockPatternUtils.getKeyguardStoredPasswordQuality() == + DevicePolicyManager.PASSWORD_QUALITY_NUMERIC) { + messageId = R.string.lockscreen_too_many_failed_pin_attempts_dialog_message; + } else { + messageId = R.string.lockscreen_too_many_failed_password_attempts_dialog_message; + } + } String message = mContext.getString( - R.string.lockscreen_too_many_failed_attempts_dialog_message, + messageId, mUpdateMonitor.getFailedAttempts(), timeoutInSeconds); final AlertDialog dialog = new AlertDialog.Builder(mContext) diff --git a/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java index 8f5bb24ff4b8d..c519d82cb13ff 100644 --- a/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -198,7 +198,14 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen @Override public void onFinish() { mPasswordEntry.setEnabled(true); - mTitle.setText(R.string.keyguard_password_enter_password_code); + final int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality(); + final boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality + || DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == quality; + if(isAlpha) { + mTitle.setText(R.string.keyguard_password_enter_password_code); + } else { + mTitle.setText(R.string.keyguard_password_enter_pin_password_code); + } mKeyboardView.setEnabled(true); } }.start();