Clear "Wrong pattern" prompt automatically.

When the user enters a wrong pattern/pin/password, a "Wrong
pattern/pin/password" text shows up on ConfirmLockPattern or
ConfirmLockPassword screen. In ConfirmLockPassword, it disappears
automatically after 3 seconds, whereas it doesn't in ConfirmLockPattern.

In this change, we make the prompt in ConfirmLockPattern disappear
automatically as well.

Bug: 64781905
Test: manual
Test: make RunSettingsRoboTests
Change-Id: I53a25576413671ced4197064d51fbcc397733265
This commit is contained in:
Charles He
2017-08-18 17:35:27 +01:00
parent fdbe5d9f82
commit caf9510923
3 changed files with 7 additions and 7 deletions

View File

@@ -77,6 +77,9 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends OptionsMenuFra
protected static final int USER_TYPE_MANAGED_PROFILE = 2; protected static final int USER_TYPE_MANAGED_PROFILE = 2;
protected static final int USER_TYPE_SECONDARY = 3; protected static final int USER_TYPE_SECONDARY = 3;
/** Time we wait before clearing a wrong input attempt (e.g. pattern) and the error message. */
protected static final long CLEAR_WRONG_ATTEMPT_TIMEOUT_MS = 3000;
private FingerprintUiHelper mFingerprintHelper; private FingerprintUiHelper mFingerprintHelper;
protected boolean mReturnCredentials = false; protected boolean mReturnCredentials = false;
protected Button mCancelButton; protected Button mCancelButton;

View File

@@ -93,7 +93,6 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
public static class ConfirmLockPasswordFragment extends ConfirmDeviceCredentialBaseFragment public static class ConfirmLockPasswordFragment extends ConfirmDeviceCredentialBaseFragment
implements OnClickListener, OnEditorActionListener, implements OnClickListener, OnEditorActionListener,
CredentialCheckResultTracker.Listener { CredentialCheckResultTracker.Listener {
private static final long ERROR_MESSAGE_TIMEOUT = 3000;
private static final String FRAGMENT_TAG_CHECK_LOCK_RESULT = "check_lock_result"; private static final String FRAGMENT_TAG_CHECK_LOCK_RESULT = "check_lock_result";
private ImeAwareEditText mPasswordEntry; private ImeAwareEditText mPasswordEntry;
private TextViewInputDisabler mPasswordEntryInputDisabler; private TextViewInputDisabler mPasswordEntryInputDisabler;
@@ -460,7 +459,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
effectiveUserId, timeoutMs); effectiveUserId, timeoutMs);
handleAttemptLockout(deadline); handleAttemptLockout(deadline);
} else { } else {
showError(getErrorMessage(), ERROR_MESSAGE_TIMEOUT); showError(getErrorMessage(), CLEAR_WRONG_ATTEMPT_TIMEOUT_MS);
} }
if (newResult) { if (newResult) {
reportFailedAttempt(); reportFailedAttempt();

View File

@@ -79,9 +79,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
public static class ConfirmLockPatternFragment extends ConfirmDeviceCredentialBaseFragment public static class ConfirmLockPatternFragment extends ConfirmDeviceCredentialBaseFragment
implements AppearAnimationCreator<Object>, CredentialCheckResultTracker.Listener { implements AppearAnimationCreator<Object>, CredentialCheckResultTracker.Listener {
// how long we wait to clear a wrong pattern
private static final int WRONG_PATTERN_CLEAR_TIMEOUT_MS = 2000;
private static final String FRAGMENT_TAG_CHECK_LOCK_RESULT = "check_lock_result"; private static final String FRAGMENT_TAG_CHECK_LOCK_RESULT = "check_lock_result";
private LockPatternView mLockPatternView; private LockPatternView mLockPatternView;
@@ -315,7 +312,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
mLockPatternView.clearPattern(); mLockPatternView.clearPattern();
break; break;
case NeedToUnlockWrong: case NeedToUnlockWrong:
mErrorTextView.setText(R.string.lockpattern_need_to_unlock_wrong); showError(R.string.lockpattern_need_to_unlock_wrong,
CLEAR_WRONG_ATTEMPT_TIMEOUT_MS);
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong); mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
mLockPatternView.setEnabled(true); mLockPatternView.setEnabled(true);
@@ -349,7 +347,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
// already // already
private void postClearPatternRunnable() { private void postClearPatternRunnable() {
mLockPatternView.removeCallbacks(mClearPatternRunnable); mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS); mLockPatternView.postDelayed(mClearPatternRunnable, CLEAR_WRONG_ATTEMPT_TIMEOUT_MS);
} }
@Override @Override