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

Commit 38b3e3a1 authored by Roshan Pius's avatar Roshan Pius
Browse files

UserManagerService: Add UserHandle extra to user added/removed broadcast

Also, renamed a local variable.

Bug: 147611548
Test: Compiles
Change-Id: I4de739c7719321c83ebdd32df13395d9a218c4ad
parent b4e491a6
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -3395,6 +3395,9 @@ public class UserManagerService extends IUserManager.Stub {
    private void dispatchUserAddedIntent(@NonNull UserInfo userInfo) {
        Intent addedIntent = new Intent(Intent.ACTION_USER_ADDED);
        addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userInfo.id);
        // Also, add the UserHandle for mainline modules which can't use the @hide
        // EXTRA_USER_HANDLE.
        addedIntent.putExtra(Intent.EXTRA_USER, UserHandle.of(userInfo.id));
        mContext.sendBroadcastAsUser(addedIntent, UserHandle.ALL,
                android.Manifest.permission.MANAGE_USERS);
        MetricsLogger.count(mContext, userInfo.isGuest() ? TRON_GUEST_CREATED
@@ -3678,9 +3681,12 @@ public class UserManagerService extends IUserManager.Stub {
        // wiping the user's system directory and removing from the user list
        long ident = Binder.clearCallingIdentity();
        try {
            Intent addedIntent = new Intent(Intent.ACTION_USER_REMOVED);
            addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
            mContext.sendOrderedBroadcastAsUser(addedIntent, UserHandle.ALL,
            Intent removedIntent = new Intent(Intent.ACTION_USER_REMOVED);
            removedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
            // Also, add the UserHandle for mainline modules which can't use the @hide
            // EXTRA_USER_HANDLE.
            removedIntent.putExtra(Intent.EXTRA_USER, UserHandle.of(userId));
            mContext.sendOrderedBroadcastAsUser(removedIntent, UserHandle.ALL,
                    android.Manifest.permission.MANAGE_USERS,

                    new BroadcastReceiver() {