Merge "Add DPMS reset password metrics" into sc-dev am: 68d3b19012 am: 4481c151a6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14640415

Change-Id: Id8694f8cbe7c3dc6a1445a00f4bfa246246566e2
This commit is contained in:
Alex Johnston
2021-05-24 11:33:07 +00:00
committed by Automerger Merge Worker

View File

@@ -4951,10 +4951,16 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
final CallerIdentity caller = getCallerIdentity();
final int userHandle = caller.getUserId();
// As of R, only privlleged caller holding RESET_PASSWORD can call resetPassword() to
// As of R, only privileged caller holding RESET_PASSWORD can call resetPassword() to
// set password to an unsecured user.
if (hasCallingPermission(permission.RESET_PASSWORD)) {
return setPasswordPrivileged(password, flags, caller);
final boolean result = setPasswordPrivileged(password, flags, caller);
if (result) {
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.RESET_PASSWORD)
.write();
}
return result;
}
// If caller has PO (or DO) throw or fail silently depending on its target SDK level.
@@ -15243,8 +15249,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
DevicePolicyData policy = getUserData(caller.getUserId());
if (policy.mPasswordTokenHandle != 0) {
final String password = passwordOrNull != null ? passwordOrNull : "";
return resetPasswordInternal(password, policy.mPasswordTokenHandle, token,
flags, caller);
final boolean result = resetPasswordInternal(password, policy.mPasswordTokenHandle,
token, flags, caller);
if (result) {
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN)
.setAdmin(caller.getComponentName())
.write();
}
return result;
} else {
Slogf.w(LOG_TAG, "No saved token handle");
}