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

Commit a94c46b0 authored by Oleksandr Peletskyi's avatar Oleksandr Peletskyi Committed by Android (Google) Code Review
Browse files

Merge "Added new password quality constant PASSWORD_QUALITY_MANAGED to make it...

Merge "Added new password quality constant PASSWORD_QUALITY_MANAGED to make it possible to prevent user from unlock modification. BUG: 25549437"
parents a0e10434 0fdcd3df
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1052,6 +1052,18 @@ public class DevicePolicyManager {
     */
    public static final int PASSWORD_QUALITY_COMPLEX = 0x60000;

    /**
     * Constant for {@link #setPasswordQuality}: the user is not allowed to
     * modify password. In case this password quality is set, the password is
     * managed by a profile owner. The profile owner can set any password,
     * as if {@link #PASSWORD_QUALITY_UNSPECIFIED} is used. Note
     * that quality constants are ordered so that higher values are more
     * restrictive. The value of {@link #PASSWORD_QUALITY_MANAGED} is
     * the highest.
     * @hide
     */
    public static final int PASSWORD_QUALITY_MANAGED = 0x80000;

    /**
     * Called by an application that is administering the device to set the
     * password restrictions it is imposing.  After setting this, the user
+4 −0
Original line number Diff line number Diff line
@@ -2237,6 +2237,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
            case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
            case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
            case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
                return;
        }
        throw new IllegalArgumentException("Invalid quality constant: 0x"
@@ -3467,6 +3468,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                }
            }
            quality = getPasswordQuality(null, userHandle, false);
            if (quality == DevicePolicyManager.PASSWORD_QUALITY_MANAGED) {
                quality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
            }
            if (quality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
                int realQuality = LockPatternUtils.computePasswordQuality(password);
                if (realQuality < quality