diff options
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 12 | ||||
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 4 |
2 files changed, 16 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index e3d7c3d98fba..016111904160 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -1053,6 +1053,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 * will not be able to enter a new password that is not at least as diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 1ada0ace4429..a23e74b27a34 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -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 |