Make failed ConfirmCredential attempts count towards wipe
Previously, failed ConfirmDeviceCredential attempts only counted towards the wipe limit if it is used as a separate work challenge. In this CL, we additionally make these failed attempts count towards the total failures in the following scenarios: 1) when unified work challenge is enabled 2) for the primary user (e.g. when a wipe limit is set by a DO) 3) for secondary users Bug: 27238008 Test: manual, by entering wrong credentials multiple times Test: make SettingsRoboTests Change-Id: Ie5a099bb3fd46245c13ccf4c8f91c4d935412a4e
This commit is contained in:
@@ -211,9 +211,20 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLastTryErrorMessage() {
|
||||
return mIsAlpha ? R.string.lock_profile_wipe_warning_content_password
|
||||
: R.string.lock_profile_wipe_warning_content_pin;
|
||||
protected int getLastTryErrorMessage(int userType) {
|
||||
switch (userType) {
|
||||
case USER_TYPE_PRIMARY:
|
||||
return mIsAlpha ? R.string.lock_last_password_attempt_before_wipe_device
|
||||
: R.string.lock_last_pin_attempt_before_wipe_device;
|
||||
case USER_TYPE_MANAGED_PROFILE:
|
||||
return mIsAlpha ? R.string.lock_last_password_attempt_before_wipe_profile
|
||||
: R.string.lock_last_pin_attempt_before_wipe_profile;
|
||||
case USER_TYPE_SECONDARY:
|
||||
return mIsAlpha ? R.string.lock_last_password_attempt_before_wipe_user
|
||||
: R.string.lock_last_pin_attempt_before_wipe_user;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unrecognized user type:" + userType);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -278,10 +289,8 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
} else {
|
||||
resetState();
|
||||
mErrorTextView.setText("");
|
||||
if (isProfileChallenge()) {
|
||||
updateErrorMessage(mLockPatternUtils.getCurrentFailedPasswordAttempts(
|
||||
mEffectiveUserId));
|
||||
}
|
||||
updateErrorMessage(
|
||||
mLockPatternUtils.getCurrentFailedPasswordAttempts(mEffectiveUserId));
|
||||
}
|
||||
mCredentialCheckResultTracker.setListener(this);
|
||||
}
|
||||
@@ -444,7 +453,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
mPasswordEntryInputDisabler.setInputEnabled(true);
|
||||
if (matched) {
|
||||
if (newResult) {
|
||||
reportSuccessfullAttempt();
|
||||
reportSuccessfulAttempt();
|
||||
}
|
||||
startDisappearAnimation(intent);
|
||||
checkForPendingIntent();
|
||||
@@ -493,10 +502,8 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
public void onFinish() {
|
||||
resetState();
|
||||
mErrorTextView.setText("");
|
||||
if (isProfileChallenge()) {
|
||||
updateErrorMessage(mLockPatternUtils.getCurrentFailedPasswordAttempts(
|
||||
mEffectiveUserId));
|
||||
}
|
||||
updateErrorMessage(
|
||||
mLockPatternUtils.getCurrentFailedPasswordAttempts(mEffectiveUserId));
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
Reference in New Issue
Block a user