summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2014-04-24 13:45:17 -0700
committerAmith Yamasani <yamasani@google.com>2014-04-24 16:24:13 -0700
commitbe46532c9fbebf3ab6498c1b78013a33f620cd31 (patch)
tree3cc2d61d59132dfdce1c924e9d2343028d9a0157 /services/devicepolicy
parentd80cb24a5772d5536ac52ea7edee05f782575e60 (diff)
downloadframeworks_base-be46532c9fbebf3ab6498c1b78013a33f620cd31.zip
frameworks_base-be46532c9fbebf3ab6498c1b78013a33f620cd31.tar.gz
frameworks_base-be46532c9fbebf3ab6498c1b78013a33f620cd31.tar.bz2
Allow profile owners to set user restrictions
Pass the setting along to UserManager. Fixes a security exception when fetching the profile's enabled state. Change-Id: If71698cf32c52cce1158cf2027443a339bc58488
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index b82a126..f1ee280 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -3118,4 +3118,24 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
}
}
+
+ @Override
+ public void setUserRestriction(ComponentName who, String key, boolean enabled) {
+ final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId());
+
+ synchronized (this) {
+ if (who == null) {
+ throw new NullPointerException("ComponentName is null");
+ }
+ getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
+
+ UserManager um = UserManager.get(mContext);
+ long id = Binder.clearCallingIdentity();
+ try {
+ um.setUserRestriction(key, enabled, userHandle);
+ } finally {
+ restoreCallingIdentity(id);
+ }
+ }
+ }
}