Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9381b7c authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "Add DPMS reset password metrics" into sc-dev am: 68d3b190

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

Change-Id: Ibb5d295b88b0c0d51819c796fc483d8e4e2fa4eb
parents 494d8a3e 68d3b190
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -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");
            }