Skip to content

Commit e1655c9

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "When A11y is on, use a longer interval between lockout announcements." into jb-mr1-dev
2 parents da2509c + c2798a9 commit e1655c9

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardPasswordView.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import android.text.method.DigitsKeyListener;
3939
import android.text.method.TextKeyListener;
4040
import android.view.KeyEvent;
41+
import android.view.accessibility.AccessibilityManager;
4142
import android.view.inputmethod.EditorInfo;
4243
import android.view.inputmethod.InputMethodInfo;
4344
import android.view.inputmethod.InputMethodManager;
@@ -55,6 +56,16 @@
5556

5657
public class KeyguardPasswordView extends LinearLayout
5758
implements KeyguardSecurityView, OnEditorActionListener, TextWatcher {
59+
/** Delay in ms between updates to the "too many attempts" count down. */
60+
private static final long LOCKOUT_INTERVAL = 1000;
61+
62+
/**
63+
* Delay in ms between updates to the "too many attempts" count down used
64+
* when accessibility is turned on. Less annoying than the shorter default
65+
* {@link #LOCKOUT_INTERVAL}.
66+
*/
67+
private static final long ACCESSIBILITY_LOCKOUT_INTERVAL = 10000;
68+
5869
private KeyguardSecurityCallback mCallback;
5970
private EditText mPasswordEntry;
6071
private LockPatternUtils mLockPatternUtils;
@@ -310,7 +321,12 @@ private void handleAttemptLockout(long elapsedRealtimeDeadline) {
310321
mPasswordEntry.setEnabled(false);
311322
mKeyboardView.setEnabled(false);
312323
long elapsedRealtime = SystemClock.elapsedRealtime();
313-
new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, 1000) {
324+
final AccessibilityManager accessManager =
325+
(AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
326+
// Use a longer update interval when accessibility is turned on.
327+
final long interval = accessManager.isEnabled() ? ACCESSIBILITY_LOCKOUT_INTERVAL
328+
: LOCKOUT_INTERVAL;
329+
new CountDownTimer(elapsedRealtimeDeadline - elapsedRealtime, interval) {
314330

315331
@Override
316332
public void onTick(long millisUntilFinished) {

0 commit comments

Comments
 (0)