Merge "Switch to new checkPasswordHistory method" into pi-dev am: 4a1b84e613

am: 399675408d

Change-Id: I53198b254e2e93aee0ab8a7e980e46bd20745e05
This commit is contained in:
Rubin Xu
2018-04-24 06:33:31 -07:00
committed by android-build-merger

View File

@@ -193,6 +193,7 @@ public class ChooseLockPassword extends SettingsActivity {
private int mPasswordMinLengthToFulfillAllPolicies = 0; private int mPasswordMinLengthToFulfillAllPolicies = 0;
protected int mUserId; protected int mUserId;
private boolean mHideDrawer = false; private boolean mHideDrawer = false;
private byte[] mPasswordHistoryHashFactor;
/** /**
* Password requirements that we need to verify. * Password requirements that we need to verify.
*/ */
@@ -667,7 +668,8 @@ public class ChooseLockPassword extends SettingsActivity {
} }
} }
// Is the password recently used? // Is the password recently used?
if (mLockPatternUtils.checkPasswordHistory(password, mUserId)) { if (mLockPatternUtils.checkPasswordHistory(password, getPasswordHistoryHashFactor(),
mUserId)) {
errorCode |= RECENTLY_USED; errorCode |= RECENTLY_USED;
} }
} }
@@ -730,6 +732,18 @@ public class ChooseLockPassword extends SettingsActivity {
return errorCode; return errorCode;
} }
/**
* Lazily compute and return the history hash factor of the current user (mUserId), used for
* password history check.
*/
private byte[] getPasswordHistoryHashFactor() {
if (mPasswordHistoryHashFactor == null) {
mPasswordHistoryHashFactor = mLockPatternUtils.getPasswordHistoryHashFactor(
mCurrentPassword, mUserId);
}
return mPasswordHistoryHashFactor;
}
public void handleNext() { public void handleNext() {
if (mSaveAndFinishWorker != null) return; if (mSaveAndFinishWorker != null) return;
mChosenPassword = mPasswordEntry.getText().toString(); mChosenPassword = mPasswordEntry.getText().toString();