|
38 | 38 | import android.text.method.DigitsKeyListener; |
39 | 39 | import android.text.method.TextKeyListener; |
40 | 40 | import android.view.KeyEvent; |
| 41 | +import android.view.accessibility.AccessibilityManager; |
41 | 42 | import android.view.inputmethod.EditorInfo; |
42 | 43 | import android.view.inputmethod.InputMethodInfo; |
43 | 44 | import android.view.inputmethod.InputMethodManager; |
|
55 | 56 |
|
56 | 57 | public class KeyguardPasswordView extends LinearLayout |
57 | 58 | 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 | + |
58 | 69 | private KeyguardSecurityCallback mCallback; |
59 | 70 | private EditText mPasswordEntry; |
60 | 71 | private LockPatternUtils mLockPatternUtils; |
@@ -310,7 +321,12 @@ private void handleAttemptLockout(long elapsedRealtimeDeadline) { |
310 | 321 | mPasswordEntry.setEnabled(false); |
311 | 322 | mKeyboardView.setEnabled(false); |
312 | 323 | 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) { |
314 | 330 |
|
315 | 331 | @Override |
316 | 332 | public void onTick(long millisUntilFinished) { |
|
0 commit comments