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

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

Merge "DPM: Fix regression from I54376f60ac53451ace22965d331b47cd8c2e614e" into pi-dev

parents ecb38f30 b122ae96
Loading
Loading
Loading
Loading
+11 −15
Original line number Diff line number Diff line
@@ -4789,16 +4789,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private boolean resetPasswordInternal(String password, long tokenHandle, byte[] token,
            int flags, int callingUid, int userHandle) {
        int quality;
        final int realQuality;
        synchronized (getLockObject()) {
            quality = getPasswordQuality(null, userHandle, /* parent */ false);
            if (quality == DevicePolicyManager.PASSWORD_QUALITY_MANAGED) {
                quality = PASSWORD_QUALITY_UNSPECIFIED;
            }
            final PasswordMetrics metrics = PasswordMetrics.computeForPassword(password);
            realQuality = metrics.quality;
            if (quality != PASSWORD_QUALITY_UNSPECIFIED) {
            final int realQuality = metrics.quality;
            if (realQuality < quality
                    && quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
                Slog.w(LOG_TAG, "resetPassword: password quality 0x"
@@ -4808,7 +4805,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                return false;
            }
            quality = Math.max(realQuality, quality);
            }
            int length = getPasswordMinimumLength(null, userHandle, /* parent */ false);
            if (password.length() < length) {
                Slog.w(LOG_TAG, "resetPassword: password length " + password.length()
@@ -4885,7 +4881,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        try {
            if (token == null) {
                if (!TextUtils.isEmpty(password)) {
                    mLockPatternUtils.saveLockPassword(password, null, realQuality, userHandle);
                    mLockPatternUtils.saveLockPassword(password, null, quality, userHandle);
                } else {
                    mLockPatternUtils.clearLock(null, userHandle);
                }
@@ -4894,7 +4890,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                result = mLockPatternUtils.setLockCredentialWithToken(password,
                        TextUtils.isEmpty(password) ? LockPatternUtils.CREDENTIAL_TYPE_NONE
                                : LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
                        realQuality, tokenHandle, token, userHandle);
                        quality, tokenHandle, token, userHandle);
            }
            boolean requireEntry = (flags & DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY) != 0;
            if (requireEntry) {