diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 44cf9321e717e..9fc45e811b441 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -13804,8 +13804,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { admin, new BooleanPolicyValue(hidden), userId); - Boolean resolvedPolicy = mDevicePolicyEngine.getResolvedPolicy( - PolicyDefinition.APPLICATION_HIDDEN(packageName), userId); result = mInjector.binderWithCleanCallingIdentity(() -> { try { // This is a best effort to continue returning the same value that was @@ -18976,7 +18974,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { admin, MANAGE_DEVICE_POLICY_RESET_PASSWORD, caller.getPackageName(), - UserHandle.USER_ALL); + userId); Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin( PolicyDefinition.RESET_PASSWORD_TOKEN, enforcingAdmin, @@ -19040,7 +19038,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { admin, MANAGE_DEVICE_POLICY_RESET_PASSWORD, caller.getPackageName(), - UserHandle.USER_ALL); + userId); Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin( PolicyDefinition.RESET_PASSWORD_TOKEN, enforcingAdmin, @@ -19086,7 +19084,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { admin, MANAGE_DEVICE_POLICY_RESET_PASSWORD, caller.getPackageName(), - UserHandle.USER_ALL); + userId); Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin( PolicyDefinition.RESET_PASSWORD_TOKEN, enforcingAdmin, @@ -19138,7 +19136,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { admin, MANAGE_DEVICE_POLICY_RESET_PASSWORD, caller.getPackageName(), - UserHandle.USER_ALL); + userId); Long currentTokenHandle = mDevicePolicyEngine.getLocalPolicySetByAdmin( PolicyDefinition.RESET_PASSWORD_TOKEN, enforcingAdmin, @@ -19164,10 +19162,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } if (result) { - DevicePolicyEventLogger - .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN) - .setAdmin(caller.getComponentName()) - .write(); + if (isPermissionCheckFlagEnabled()) { + DevicePolicyEventLogger + .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN) + .setAdmin(callerPackageName) + .write(); + } else { + DevicePolicyEventLogger + .createEvent(DevicePolicyEnums.RESET_PASSWORD_WITH_TOKEN) + .setAdmin(caller.getComponentName()) + .write(); + } } return result; }