diff options
| author | 2015-11-19 19:45:44 +0000 | |
|---|---|---|
| committer | 2015-11-19 19:45:44 +0000 | |
| commit | 5145df278bc7b607599e81370a2aecbfe0834c0c (patch) | |
| tree | f00960326f69cfea1345148d5007d431d86c81c8 | |
| parent | 376d5f350c6618d915338a9927b5d0f5fb61eba8 (diff) | |
DevicePolicy: Always send ACTION_PASSWORD_CHANGED
The old check looks a lot like an equality check, but it's not valid
because two passwords can share the same parameters.
For example:
'11Aa' and
'Y99z'
Are not different according to the old logic.
Bug: 25319928
Change-Id: Ia69861d9103670d1fc1dbf0130516e18e85e8de0
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 53 |
1 files changed, 22 insertions, 31 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index dedf1d9ae9f7..1db285ff1b12 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3465,42 +3465,33 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } enforceCrossUserPermission(userHandle); enforceNotManagedProfile(userHandle, "set the active password"); - mContext.enforceCallingOrSelfPermission( android.Manifest.permission.BIND_DEVICE_ADMIN, null); - DevicePolicyData p = getUserData(userHandle); - validateQualityConstant(quality); - synchronized (this) { - if (p.mActivePasswordQuality != quality || p.mActivePasswordLength != length - || p.mFailedPasswordAttempts != 0 || p.mActivePasswordLetters != letters - || p.mActivePasswordUpperCase != uppercase - || p.mActivePasswordLowerCase != lowercase - || p.mActivePasswordNumeric != numbers - || p.mActivePasswordSymbols != symbols - || p.mActivePasswordNonLetter != nonletter) { - long ident = Binder.clearCallingIdentity(); - try { - p.mActivePasswordQuality = quality; - p.mActivePasswordLength = length; - p.mActivePasswordLetters = letters; - p.mActivePasswordLowerCase = lowercase; - p.mActivePasswordUpperCase = uppercase; - p.mActivePasswordNumeric = numbers; - p.mActivePasswordSymbols = symbols; - p.mActivePasswordNonLetter = nonletter; - p.mFailedPasswordAttempts = 0; - saveSettingsLocked(userHandle); - updatePasswordExpirationsLocked(userHandle); - setExpirationAlarmCheckLocked(mContext, p); - sendAdminCommandToSelfAndProfilesLocked( - DeviceAdminReceiver.ACTION_PASSWORD_CHANGED, - DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle); - } finally { - Binder.restoreCallingIdentity(ident); - } + DevicePolicyData policy = getUserData(userHandle); + + long ident = Binder.clearCallingIdentity(); + try { + synchronized (this) { + policy.mActivePasswordQuality = quality; + policy.mActivePasswordLength = length; + policy.mActivePasswordLetters = letters; + policy.mActivePasswordLowerCase = lowercase; + policy.mActivePasswordUpperCase = uppercase; + policy.mActivePasswordNumeric = numbers; + policy.mActivePasswordSymbols = symbols; + policy.mActivePasswordNonLetter = nonletter; + policy.mFailedPasswordAttempts = 0; + saveSettingsLocked(userHandle); + updatePasswordExpirationsLocked(userHandle); + setExpirationAlarmCheckLocked(mContext, policy); + sendAdminCommandToSelfAndProfilesLocked( + DeviceAdminReceiver.ACTION_PASSWORD_CHANGED, + DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle); } + } finally { + Binder.restoreCallingIdentity(ident); } } |