Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2af03d2a authored by Nicolas Prevot's avatar Nicolas Prevot Committed by Nicolas Prévot
Browse files

Send the MANAGE_PROFILE_ADDED broadcast to the correct user.

Send it to the parent, who is not always the user owner.

BUG:22753960
Change-Id: Ibd0edb78be4b3bdfc9fc31fd05e50fe3bf8bb493
parent 30c3c090
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4523,12 +4523,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            long id = Binder.clearCallingIdentity();
            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.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY |
                        Intent.FLAG_RECEIVER_FOREGROUND);
                // TODO This should send to parent of profile (which is always owner at the moment).
                mContext.sendBroadcastAsUser(intent, UserHandle.OWNER);
                mContext.sendBroadcastAsUser(intent, new UserHandle(parent.id));
            } finally {
                restoreCallingIdentity(id);
            }