Merge "Use new setUserRestriction API in policy engine." into udc-dev am: 14cc6847a9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21480930 Change-Id: I810963abe8be8a1a0f954f0e81d8b8e8615a9e3f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -12899,11 +12899,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
checkCanExecuteOrThrowUnsafe(DevicePolicyManager.OPERATION_SET_USER_RESTRICTION);
|
||||
|
||||
if (useDevicePolicyEngine(caller, /* delegateScope= */ null)) {
|
||||
int affectedUserId = parent ? getProfileParentId(userId) : userId;
|
||||
EnforcingAdmin admin = enforcePermissionForUserRestriction(
|
||||
who,
|
||||
key,
|
||||
caller.getPackageName(),
|
||||
userId);
|
||||
affectedUserId);
|
||||
PolicyDefinition<Boolean> policyDefinition =
|
||||
PolicyDefinition.getPolicyDefinitionForUserRestriction(key);
|
||||
if (enabledFromThisOwner) {
|
||||
@@ -12911,7 +12912,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
policyDefinition,
|
||||
admin,
|
||||
new BooleanPolicyValue(true),
|
||||
parent ? getProfileParentId(userId) : userId);
|
||||
affectedUserId);
|
||||
} else {
|
||||
// Remove any local and global policy that was set by the admin
|
||||
if (!policyDefinition.isLocalOnlyPolicy()) {
|
||||
|
||||
@@ -215,10 +215,9 @@ final class PolicyEnforcerCallbacks {
|
||||
}
|
||||
UserRestrictionPolicyKey parsedKey =
|
||||
(UserRestrictionPolicyKey) policyKey;
|
||||
// TODO: call into new UserManager API when merged
|
||||
UserManagerInternal userManager = LocalServices.getService(UserManagerInternal.class);
|
||||
// userManager.setUserRestriction(
|
||||
// userId, parsedKey.getRestriction(), enabled != null && enabled);
|
||||
userManager.setUserRestriction(
|
||||
userId, parsedKey.getRestriction(), enabled != null && enabled);
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user