diff options
author | Nicolas Prévot <nprevot@google.com> | 2016-02-08 14:08:20 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-02-08 14:08:20 +0000 |
commit | e64f3da729ae6a00fb627f00b8a97e7c5feb8bcb (patch) | |
tree | 656a7f478679335ac7e74a38b24fea74a97597fb | |
parent | 0ab80e6c261339d17585522a6b69d98a16779c0b (diff) | |
parent | e28e5a9d3b3115ec00c1209bec393a397d359a9f (diff) |
Merge "Fail if setProfileEnabled is called outside a managed profile." into nyc-dev
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index f296d68cedcf..3fb5a0d39b84 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -5718,18 +5718,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return; } Preconditions.checkNotNull(who, "ComponentName is null"); - final int userHandle = UserHandle.getCallingUserId(); synchronized (this) { // Check if this is the profile owner who is calling getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); - int userId = UserHandle.getCallingUserId(); + final int userId = UserHandle.getCallingUserId(); + enforceManagedProfile(userId, "enable the profile"); long id = mInjector.binderClearCallingIdentity(); try { mUserManager.setUserEnabled(userId); UserInfo parent = mUserManager.getProfileParent(userId); Intent intent = new Intent(Intent.ACTION_MANAGED_PROFILE_ADDED); - intent.putExtra(Intent.EXTRA_USER, new UserHandle(userHandle)); + intent.putExtra(Intent.EXTRA_USER, new UserHandle(userId)); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND); mContext.sendBroadcastAsUser(intent, new UserHandle(parent.id)); |