Merge "DevicePolicy: Always send ACTION_PASSWORD_CHANGED"

am: 3fe5a65b1c

* commit '3fe5a65b1cc621d40f6278dd1e38d5ec58f92fb6':
  DevicePolicy: Always send ACTION_PASSWORD_CHANGED
This commit is contained in:
Robin Lee
2015-12-02 12:41:20 +00:00
committed by android-build-merger

View File

@@ -3465,42 +3465,33 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
} }
enforceCrossUserPermission(userHandle); enforceCrossUserPermission(userHandle);
enforceNotManagedProfile(userHandle, "set the active password"); enforceNotManagedProfile(userHandle, "set the active password");
mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.BIND_DEVICE_ADMIN, null); android.Manifest.permission.BIND_DEVICE_ADMIN, null);
DevicePolicyData p = getUserData(userHandle);
validateQualityConstant(quality); validateQualityConstant(quality);
synchronized (this) { DevicePolicyData policy = getUserData(userHandle);
if (p.mActivePasswordQuality != quality || p.mActivePasswordLength != length
|| p.mFailedPasswordAttempts != 0 || p.mActivePasswordLetters != letters long ident = Binder.clearCallingIdentity();
|| p.mActivePasswordUpperCase != uppercase try {
|| p.mActivePasswordLowerCase != lowercase synchronized (this) {
|| p.mActivePasswordNumeric != numbers policy.mActivePasswordQuality = quality;
|| p.mActivePasswordSymbols != symbols policy.mActivePasswordLength = length;
|| p.mActivePasswordNonLetter != nonletter) { policy.mActivePasswordLetters = letters;
long ident = Binder.clearCallingIdentity(); policy.mActivePasswordLowerCase = lowercase;
try { policy.mActivePasswordUpperCase = uppercase;
p.mActivePasswordQuality = quality; policy.mActivePasswordNumeric = numbers;
p.mActivePasswordLength = length; policy.mActivePasswordSymbols = symbols;
p.mActivePasswordLetters = letters; policy.mActivePasswordNonLetter = nonletter;
p.mActivePasswordLowerCase = lowercase; policy.mFailedPasswordAttempts = 0;
p.mActivePasswordUpperCase = uppercase; saveSettingsLocked(userHandle);
p.mActivePasswordNumeric = numbers; updatePasswordExpirationsLocked(userHandle);
p.mActivePasswordSymbols = symbols; setExpirationAlarmCheckLocked(mContext, policy);
p.mActivePasswordNonLetter = nonletter; sendAdminCommandToSelfAndProfilesLocked(
p.mFailedPasswordAttempts = 0; DeviceAdminReceiver.ACTION_PASSWORD_CHANGED,
saveSettingsLocked(userHandle); DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle);
updatePasswordExpirationsLocked(userHandle);
setExpirationAlarmCheckLocked(mContext, p);
sendAdminCommandToSelfAndProfilesLocked(
DeviceAdminReceiver.ACTION_PASSWORD_CHANGED,
DeviceAdminInfo.USES_POLICY_LIMIT_PASSWORD, userHandle);
} finally {
Binder.restoreCallingIdentity(ident);
}
} }
} finally {
Binder.restoreCallingIdentity(ident);
} }
} }