Merge "Ensure correct admin name is logged." into udc-dev am: d9fc7a5785

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

Change-Id: I5f655e387d0121dcef38076f79ddb6978b4c3638
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Pavel Grafov
2023-04-04 09:43:41 +00:00
committed by Automerger Merge Worker

View File

@@ -2315,7 +2315,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
* Creates a new {@link CallerIdentity} object to represent the caller's identity.
*/
private CallerIdentity getCallerIdentity(@Nullable String callerPackage) {
return getCallerIdentity(null, callerPackage);
}
@@ -5305,11 +5304,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
Preconditions.checkArgument(allowedModes.contains(passwordComplexity),
"Provided complexity is not one of the allowed values.");
CallerIdentity caller;
if (isPermissionCheckFlagEnabled()) {
caller = getCallerIdentity(callerPackageName);
} else {
caller = getCallerIdentity();
CallerIdentity caller = getCallerIdentity(callerPackageName);
if (!isPermissionCheckFlagEnabled()) {
Preconditions.checkCallAuthorization(
isDefaultDeviceOwner(caller) || isProfileOwner(caller));
Preconditions.checkArgument(!calledOnParent || isProfileOwner(caller));