Merge "Add DPMS reset password metrics" into sc-dev am: 68d3b19012
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14640415 Change-Id: I4650ad90ef84f9d8f4cfbbc0a747a185c8e2c6a9
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user