Throw SecurityException when an admin uses the

setUserRestrictionGlobally method.

Test: btest CtsDevicePolicyTestCases
Fixes: 278772650
Change-Id: Id230f8b179df79b62bc8a85ed50e18dede8a298e
This commit is contained in:
Jonathan Scott
2023-04-21 08:30:49 +00:00
parent 3d3fc71b21
commit 32e686255e

View File

@@ -13376,7 +13376,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
throw new IllegalStateException("Feature flag is not enabled.");
}
if (isDeviceOwner(caller) || isProfileOwner(caller)) {
throw new IllegalStateException("Admins are not allowed to call this API.");
throw new SecurityException("Admins are not allowed to call this API.");
}
if (!mInjector.isChangeEnabled(
ENABLE_COEXISTENCE_CHANGE, callerPackage, caller.getUserId())) {