diff options
| author | 2016-01-21 11:03:54 +0000 | |
|---|---|---|
| committer | 2016-01-21 11:03:54 +0000 | |
| commit | a94c46b074dbd82b28cf306a39ca8eefc81df065 (patch) | |
| tree | 3166db947fc71567d9b3d0617c3fb0e742236648 | |
| parent | a0e10434c49c6fe075e853da2046fd281318c4c4 (diff) | |
| parent | 0fdcd3df83b4af1e6cd89246b5f38401d8062148 (diff) | |
Merge "Added new password quality constant PASSWORD_QUALITY_MANAGED to make it possible to prevent user from unlock modification. BUG: 25549437"
| -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 |