From 305093f9116b364856bcdcd499e9f69910e249dd Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Sun, 16 Jan 2011 18:18:15 -0800 Subject: Fix 3005526: Properly update StatusView from Password/PIN unlock This uses the newly added setHelpMessage() to properly show PIN and password help in StatusView. Change-Id: I8662e179e989c6e72f657c81f23b1b2fa7982727 --- .../internal/policy/impl/PasswordUnlockScreen.java | 18 ++++++++++++------ .../com/android/internal/policy/impl/StatusView.java | 9 ++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java index b789288..eb4d930 100644 --- a/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -135,9 +135,12 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen // numeric keys. if (mIsAlpha) { mPasswordEntry.setKeyListener(TextKeyListener.getInstance()); + mStatusView.setHelpMessage(R.string.keyguard_password_enter_password_code, + StatusView.LOCK_ICON); } else { mPasswordEntry.setKeyListener(DigitsKeyListener.getInstance()); - mStatusView.setInstructionText(R.string.keyguard_password_enter_pin_password_code); + mStatusView.setHelpMessage(R.string.keyguard_password_enter_pin_code, + StatusView.LOCK_ICON); } mKeyboardHelper.setVibratePattern(mLockPatternUtils.isTactileFeedbackEnabled() ? @@ -151,6 +154,11 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen mStatusView.setCarrierText(LockScreen.getCarrierString( mUpdateMonitor.getTelephonyPlmn(), mUpdateMonitor.getTelephonySpn())); + + mUpdateMonitor.registerInfoCallback(this); + //mUpdateMonitor.registerSimStateCallback(this); + + resetStatusInfo(); } @Override @@ -204,6 +212,7 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen if (mLockPatternUtils.checkPassword(entry)) { mCallback.keyguardDone(true); mCallback.reportSuccessfulUnlockAttempt(); + mStatusView.setInstructionText(null); } else if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) { // to avoid accidental lockout, only count attempts that are long enough to be a // real password. This may require some tweaking. @@ -316,11 +325,8 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen } private void resetStatusInfo() { - if(mIsAlpha) { - mStatusView.setInstructionText(R.string.keyguard_password_enter_password_code); - } else { - mStatusView.setInstructionText(R.string.keyguard_password_enter_pin_password_code); - } + mStatusView.setInstructionText(null); + mStatusView.updateStatusLines(true); } } diff --git a/policy/src/com/android/internal/policy/impl/StatusView.java b/policy/src/com/android/internal/policy/impl/StatusView.java index 5d32cf4..4b91b65 100644 --- a/policy/src/com/android/internal/policy/impl/StatusView.java +++ b/policy/src/com/android/internal/policy/impl/StatusView.java @@ -125,13 +125,13 @@ class StatusView { void setInstructionText(int stringId) { mStatus1.setText(stringId); mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0); - mStatus1.setVisibility(View.VISIBLE); + mStatus1.setVisibility(stringId != 0 ? View.VISIBLE : View.INVISIBLE); } void setInstructionText(String string) { mStatus1.setText(string); mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0); - mStatus1.setVisibility(View.VISIBLE); + mStatus1.setVisibility(TextUtils.isEmpty(string) ? View.INVISIBLE : View.VISIBLE); } void setCarrierText(int stringId) { @@ -177,11 +177,10 @@ class StatusView { } // Update Status1 - if (mInstructions != null) { + if (!TextUtils.isEmpty(mInstructions)) { // Instructions only - final int resId = TextUtils.isEmpty(mInstructions) ? 0 : LOCK_ICON; mStatus1.setText(mInstructions); - mStatus1.setCompoundDrawablesWithIntrinsicBounds(resId, 0, 0, 0); + mStatus1.setCompoundDrawablesWithIntrinsicBounds(LOCK_ICON, 0, 0, 0); mStatus1.setVisibility(View.VISIBLE); } else if (mShowingBatteryInfo) { // Battery status -- cgit v1.1