diff options
author | Julia Reynolds <juliacr@google.com> | 2014-05-14 17:15:16 -0400 |
---|---|---|
committer | Julia Reynolds <juliacr@google.com> | 2014-05-20 17:49:45 -0400 |
commit | da551653219092306fc7e1ce5743ab40683cee6f (patch) | |
tree | 614a310341c5de83efb6f724630d3fe4080213b4 /services | |
parent | 3fff22173c7010467ce9e134e89b367e311d122b (diff) | |
download | frameworks_base-da551653219092306fc7e1ce5743ab40683cee6f.zip frameworks_base-da551653219092306fc7e1ce5743ab40683cee6f.tar.gz frameworks_base-da551653219092306fc7e1ce5743ab40683cee6f.tar.bz2 |
Allow device/profile owners to update settings.
Device owners can update Settings.Secure and Settings.Global settings.
Profile owners can update Settings.Secure settings.
DMAgent currently needs to live in /system/priv-app in order to
(among other things) update global and secure settings. This change will
get us closer to being able to move DMAgent out of priv-app.
Bug: 14965414
Change-Id: If2cc3a56de91bffde33b838ab8ecea2c32412803
Diffstat (limited to 'services')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 39 |
1 files changed, 39 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 e2cd4e2..773ccb3 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -3595,4 +3595,43 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } return false; } + + @Override + public void setGlobalSetting(ComponentName who, String setting, String value) { + final ContentResolver contentResolver = mContext.getContentResolver(); + + synchronized (this) { + if (who == null) { + throw new NullPointerException("ComponentName is null"); + } + getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); + + long id = Binder.clearCallingIdentity(); + try { + Settings.Global.putString(contentResolver, setting, value); + } finally { + restoreCallingIdentity(id); + } + } + } + + @Override + public void setSecureSetting(ComponentName who, String setting, String value) { + int callingUserId = UserHandle.getCallingUserId(); + final ContentResolver contentResolver = mContext.getContentResolver(); + + synchronized (this) { + if (who == null) { + throw new NullPointerException("ComponentName is null"); + } + getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); + + long id = Binder.clearCallingIdentity(); + try { + Settings.Secure.putStringForUser(contentResolver, setting, value, callingUserId); + } finally { + restoreCallingIdentity(id); + } + } + } } |