diff options
author | Adam Connors <adamconnors@google.com> | 2014-02-11 13:59:46 +0000 |
---|---|---|
committer | Adam Connors <adamconnors@google.com> | 2014-02-17 10:18:59 +0000 |
commit | 661ec4710b30516a2c7a1101ba65ecac109af619 (patch) | |
tree | 4c45047eb9bbcfa783a5507f886c940cb5c2b750 /services/devicepolicy | |
parent | fde7865c16599f617de08001dbc0ce7d8be6da30 (diff) | |
download | frameworks_base-661ec4710b30516a2c7a1101ba65ecac109af619.zip frameworks_base-661ec4710b30516a2c7a1101ba65ecac109af619.tar.gz frameworks_base-661ec4710b30516a2c7a1101ba65ecac109af619.tar.bz2 |
Change API for setProfileOwner to require userId
Previously the userId of the current process used but it
makes the provisioning process cleaner to be able to pass
it in explicitly.
Change-Id: I670c4cf3638f1340f6d0bf856c3e01045df8c29e
Diffstat (limited to 'services/devicepolicy')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 8 |
1 files changed, 8 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 bb96544..12f0114 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -2830,6 +2830,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return false; } mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null); + + UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); + if (um.getUserInfo(userHandle) == null) { + // User doesn't exist. + throw new IllegalArgumentException( + "Attempted to set profile owner for invalid userId: " + userHandle); + } + if (packageName == null || !DeviceOwner.isInstalledForUser(packageName, userHandle)) { throw new IllegalArgumentException("Package name " + packageName |