summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2012-09-14 19:12:40 -0700
committerJim Miller <jaggies@google.com>2012-09-14 19:15:45 -0700
commit08b2b6bfe2550b65c68ad7b4bef8283f1ff17561 (patch)
treef172d609bba7c3c9c7b23b70cbf6873442b2876f
parent8b681cb8813454aac8a626bf3d7adaa8beca4d75 (diff)
downloadframeworks_base-08b2b6bfe2550b65c68ad7b4bef8283f1ff17561.zip
frameworks_base-08b2b6bfe2550b65c68ad7b4bef8283f1ff17561.tar.gz
frameworks_base-08b2b6bfe2550b65c68ad7b4bef8283f1ff17561.tar.bz2
Fix keyguard timeout dialog messages
This fixes an issue where the attempt count was incorrect. We now show the dialog *after* reporting the failed attempt. This also fixes an issue where the text wasn't being reset in the password dialog of keyguard. Fixes bugs 7170545 and 7120895 Change-Id: Iba2009705373758acca6e10bd670eb34744bece9
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java9
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java13
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java5
3 files changed, 17 insertions, 10 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 95f8500..955c230 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -348,6 +348,7 @@ public class KeyguardHostView extends KeyguardViewBase {
(failedAttemptsBeforeWipe - failedAttempts)
: Integer.MAX_VALUE; // because DPM returns 0 if no restriction
+ boolean showTimeout = false;
if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
// If we reach this code, it means the user has installed a DevicePolicyManager
// that requests device wipe after N attempts. Once we get below the grace
@@ -361,7 +362,7 @@ public class KeyguardHostView extends KeyguardViewBase {
showWipeDialog(failedAttempts);
}
} else {
- boolean showTimeout =
+ showTimeout =
(failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
if (usingPattern && mEnableFallback) {
if (failedAttempts == failedAttemptWarning) {
@@ -374,12 +375,12 @@ public class KeyguardHostView extends KeyguardViewBase {
showTimeout = false;
}
}
- if (showTimeout) {
- showTimeoutDialog();
- }
}
monitor.reportFailedUnlockAttempt();
mLockPatternUtils.reportFailedPasswordAttempt();
+ if (showTimeout) {
+ showTimeoutDialog();
+ }
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java
index 7e9aa43..01f7af3 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java
@@ -97,11 +97,17 @@ public class KeyguardPasswordView extends LinearLayout
if (deadline != 0) {
handleAttemptLockout(deadline);
} else {
- mNavigationManager.setMessage(
- mIsAlpha ? R.string.kg_password_instructions : R.string.kg_pin_instructions);
+ resetState();
}
}
+ private void resetState() {
+ mNavigationManager.setMessage(
+ mIsAlpha ? R.string.kg_password_instructions : R.string.kg_pin_instructions);
+ mPasswordEntry.setEnabled(true);
+ mKeyboardView.setEnabled(true);
+ }
+
@Override
protected void onFinishInflate() {
mLockPatternUtils = new LockPatternUtils(mContext); // TODO: use common one
@@ -297,8 +303,7 @@ public class KeyguardPasswordView extends LinearLayout
@Override
public void onFinish() {
- mPasswordEntry.setEnabled(true);
- mKeyboardView.setEnabled(true);
+ resetState();
}
}.start();
}
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java
index e325f94..8d83484 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java
@@ -54,7 +54,7 @@ class KeyguardStatusViewManager {
private static final int BATTERY_INFO = 15;
private StatusMode mStatus;
- private String mDateFormatString;
+ private CharSequence mDateFormatString;
// Views that this class controls.
// NOTE: These may be null in some LockScreen screens and should protect from NPE
@@ -101,7 +101,8 @@ class KeyguardStatusViewManager {
public KeyguardStatusViewManager(View view) {
if (DEBUG) Log.v(TAG, "KeyguardStatusViewManager()");
mContainer = view;
- mDateFormatString = getContext().getString(R.string.abbrev_wday_month_day_no_year);
+ mDateFormatString = getContext().getResources()
+ .getText(R.string.abbrev_wday_month_day_no_year);
mLockPatternUtils = new LockPatternUtils(view.getContext());
mUpdateMonitor = KeyguardUpdateMonitor.getInstance(view.getContext());