diff options
author | Adam Cohen <adamcohen@google.com> | 2012-10-12 19:57:16 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-10-13 16:33:27 -0700 |
commit | 0a4f900463024908220d0c9bf4b291a6e1284846 (patch) | |
tree | 3f6f24b66c4f05aee3cb395eccbd02aa5fc5aca2 /policy | |
parent | 8ec3ff8dcc68d246fcaafb98050ec9be4f7ec34a (diff) | |
download | frameworks_base-0a4f900463024908220d0c9bf4b291a6e1284846.zip frameworks_base-0a4f900463024908220d0c9bf4b291a6e1284846.tar.gz frameworks_base-0a4f900463024908220d0c9bf4b291a6e1284846.tar.bz2 |
Only showing important security messages in status area (issue 7341795)
Change-Id: Ie2fcd4dd7130b4684223d0442f50e76435f61768
Diffstat (limited to 'policy')
8 files changed, 30 insertions, 28 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAccountView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAccountView.java index 57239c3..ba695ac 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAccountView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAccountView.java @@ -137,8 +137,9 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit mLogin.setText(""); mPassword.setText(""); mLogin.requestFocus(); - mSecurityMessageDisplay.setMessage(mLockPatternUtils.isPermanentlyLocked() ? - R.string.kg_login_too_many_attempts : R.string.kg_login_instructions); + boolean permLocked = mLockPatternUtils.isPermanentlyLocked(); + mSecurityMessageDisplay.setMessage(permLocked ? R.string.kg_login_too_many_attempts : + R.string.kg_login_instructions, permLocked ? true : false); } /** {@inheritDoc} */ @@ -178,7 +179,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit // dismiss keyguard mCallback.dismiss(true); } else { - mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input); + mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input, true); mPassword.setText(""); mCallback.reportFailedUnlockAttempt(); } diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardNavigationManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardNavigationManager.java index 74b244d..8dc38e7 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardNavigationManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardNavigationManager.java @@ -16,11 +16,8 @@ package com.android.internal.policy.impl.keyguard; -import android.view.View; import android.widget.TextView; -import com.android.internal.R; - public class KeyguardNavigationManager implements SecurityMessageDisplay { private TextView mMessageArea; @@ -30,12 +27,12 @@ public class KeyguardNavigationManager implements SecurityMessageDisplay { mMessageArea.setSelected(true); // Make marquee work } - public void setMessage(CharSequence msg) { + public void setMessage(CharSequence msg, boolean important) { mMessageArea.setText(msg); mMessageArea.announceForAccessibility(mMessageArea.getText()); } - public void setMessage(int resId) { + public void setMessage(int resId, boolean important) { if (resId != 0) { mMessageArea.setText(resId); mMessageArea.announceForAccessibility(mMessageArea.getText()); @@ -44,7 +41,7 @@ public class KeyguardNavigationManager implements SecurityMessageDisplay { } } - public void setMessage(int resId, Object... formatArgs) { + public void setMessage(int resId, boolean important, Object... formatArgs) { if (resId != 0) { mMessageArea.setText(mMessageArea.getContext().getString(resId, formatArgs)); mMessageArea.announceForAccessibility(mMessageArea.getText()); 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 5a1c30f..a472c8a 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java @@ -102,7 +102,7 @@ public class KeyguardPasswordView extends LinearLayout private void resetState() { mSecurityMessageDisplay.setMessage( - mIsAlpha ? R.string.kg_password_instructions : R.string.kg_pin_instructions); + mIsAlpha ? R.string.kg_password_instructions : R.string.kg_pin_instructions, false); mPasswordEntry.setEnabled(true); mKeyboardView.setEnabled(true); } @@ -287,7 +287,7 @@ public class KeyguardPasswordView extends LinearLayout handleAttemptLockout(deadline); } mSecurityMessageDisplay.setMessage( - mIsAlpha ? R.string.kg_wrong_password : R.string.kg_wrong_pin); + mIsAlpha ? R.string.kg_wrong_password : R.string.kg_wrong_pin, true); } mPasswordEntry.setText(""); } @@ -303,7 +303,7 @@ public class KeyguardPasswordView extends LinearLayout public void onTick(long millisUntilFinished) { int secondsRemaining = (int) (millisUntilFinished / 1000); mSecurityMessageDisplay.setMessage( - R.string.kg_too_many_failed_attempts_countdown, secondsRemaining); + R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining); } @Override diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java index d8d7990..7361481 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java @@ -182,7 +182,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit if (deadline != 0) { handleAttemptLockout(deadline); } else { - mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions); + mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false); } // the footer depends on how many total attempts the user has failed @@ -254,7 +254,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit long deadline = mLockPatternUtils.setLockoutAttemptDeadline(); handleAttemptLockout(deadline); } else { - mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pattern); + mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pattern, true); mLockPatternView.postDelayed(mCancelPatternRunnable, PATTERN_CLEAR_TIMEOUT_MS); } } @@ -327,13 +327,13 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit public void onTick(long millisUntilFinished) { final int secondsRemaining = (int) (millisUntilFinished / 1000); mSecurityMessageDisplay.setMessage( - R.string.kg_too_many_failed_attempts_countdown, secondsRemaining); + R.string.kg_too_many_failed_attempts_countdown, true, secondsRemaining); } @Override public void onFinish() { mLockPatternView.setEnabled(true); - mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions); + mSecurityMessageDisplay.setMessage(R.string.kg_pattern_instructions, false); // TODO mUnlockIcon.setVisibility(View.VISIBLE); mFailedPatternAttemptsSinceLastTimeout = 0; if (mEnableFallback) { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPinView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPinView.java index 3516af9..31ae8fa 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPinView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPinView.java @@ -111,7 +111,7 @@ public class KeyguardSimPinView extends LinearLayout public void reset() { // start fresh if (mSecurityMessageDisplay != null) { - mSecurityMessageDisplay.setMessage(R.string.kg_sim_pin_instructions); + mSecurityMessageDisplay.setMessage(R.string.kg_sim_pin_instructions, true); } // make sure that the number of entered digits is consistent when we @@ -193,7 +193,7 @@ public class KeyguardSimPinView extends LinearLayout private void checkPin() { if (mPinEntry.getText().length() < 4) { // otherwise, display a message to the user, and don't submit. - mSecurityMessageDisplay.setMessage(R.string.kg_invalid_sim_pin_hint); + mSecurityMessageDisplay.setMessage(R.string.kg_invalid_sim_pin_hint, true); mPinEntry.setText(""); mCallback.userActivity(0); return; @@ -216,7 +216,8 @@ public class KeyguardSimPinView extends LinearLayout KeyguardUpdateMonitor.getInstance(getContext()).reportSimUnlocked(); mCallback.dismiss(true); } else { - mSecurityMessageDisplay.setMessage(R.string.kg_password_wrong_pin_code); + mSecurityMessageDisplay.setMessage + (R.string.kg_password_wrong_pin_code, true); mPinEntry.setText(""); } mCallback.userActivity(0); diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java index 2194c80..4c0d3b7 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardSimPukView.java @@ -99,7 +99,7 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList } mSimPinEntry.setText(null); if (msg != 0) { - mSecurityMessageDisplay.setMessage(msg); + mSecurityMessageDisplay.setMessage(msg, true); } } @@ -108,7 +108,7 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList mPukText=""; state = ENTER_PUK; if (mSecurityMessageDisplay != null) { - mSecurityMessageDisplay.setMessage(R.string.kg_puk_enter_puk_hint); + mSecurityMessageDisplay.setMessage(R.string.kg_puk_enter_puk_hint, true); } mSimPinEntry.requestFocus(); } @@ -279,7 +279,7 @@ public class KeyguardSimPukView extends LinearLayout implements View.OnClickList mCallback.dismiss(true); } else { mStateMachine.reset(); - mSecurityMessageDisplay.setMessage(R.string.kg_invalid_puk); + mSecurityMessageDisplay.setMessage(R.string.kg_invalid_puk, true); } mCheckInProgress = false; } 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 ab2e170..ab5e394 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardStatusViewManager.java @@ -188,12 +188,14 @@ class KeyguardStatusViewManager implements SecurityMessageDisplay { updateStatusLines(); } - public void setMessage(CharSequence msg) { + public void setMessage(CharSequence msg, boolean important) { + if (!important) return; mSecurityMessageContents = msg; securityMessageChanged(); } - public void setMessage(int resId) { + public void setMessage(int resId, boolean important) { + if (!important) return; if (resId != 0) { mSecurityMessageContents = getContext().getResources().getText(resId); } else { @@ -202,7 +204,8 @@ class KeyguardStatusViewManager implements SecurityMessageDisplay { securityMessageChanged(); } - public void setMessage(int resId, Object... formatArgs) { + public void setMessage(int resId, boolean important, Object... formatArgs) { + if (!important) return; if (resId != 0) { mSecurityMessageContents = getContext().getString(resId, formatArgs); } else { diff --git a/policy/src/com/android/internal/policy/impl/keyguard/SecurityMessageDisplay.java b/policy/src/com/android/internal/policy/impl/keyguard/SecurityMessageDisplay.java index 98fd11e..b57d8c1 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/SecurityMessageDisplay.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/SecurityMessageDisplay.java @@ -17,9 +17,9 @@ package com.android.internal.policy.impl.keyguard; public interface SecurityMessageDisplay { - public void setMessage(CharSequence msg); + public void setMessage(CharSequence msg, boolean important); - public void setMessage(int resId); + public void setMessage(int resId, boolean important); - public void setMessage(int resId, Object... formatArgs); + public void setMessage(int resId, boolean important, Object... formatArgs); } |