Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a1b84e6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Switch to new checkPasswordHistory method" into pi-dev

parents b0877b39 c33e2a1c
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ public class ChooseLockPassword extends SettingsActivity {
        private int mPasswordMinLengthToFulfillAllPolicies = 0;
        protected int mUserId;
        private boolean mHideDrawer = false;
        private byte[] mPasswordHistoryHashFactor;
        /**
         * Password requirements that we need to verify.
         */
@@ -667,7 +668,8 @@ public class ChooseLockPassword extends SettingsActivity {
                    }
                }
                // Is the password recently used?
                if (mLockPatternUtils.checkPasswordHistory(password, mUserId)) {
                if (mLockPatternUtils.checkPasswordHistory(password, getPasswordHistoryHashFactor(),
                        mUserId)) {
                    errorCode |= RECENTLY_USED;
                }
            }
@@ -730,6 +732,18 @@ public class ChooseLockPassword extends SettingsActivity {
            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() {
            if (mSaveAndFinishWorker != null) return;
            mChosenPassword = mPasswordEntry.getText().toString();