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

Commit 82f915cb authored by Anna Bauza's avatar Anna Bauza Committed by Android (Google) Code Review
Browse files

Merge "Add hidden broadcast to inform system apps about changes in user info." into main

parents c117f30c 55319db9
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4215,6 +4215,17 @@ public class Intent implements Parcelable, Cloneable {
    public static final String ACTION_USER_INFO_CHANGED =
            "android.intent.action.USER_INFO_CHANGED";
    /**
     * Broadcast sent to the system when a user's information changes. Carries an extra
     * {@link #EXTRA_USER_HANDLE} to indicate which user's information changed.
     * This is only sent to permission protected manifest receivers. It is sent to all users.
     * @hide
     */
    @BroadcastBehavior(includeBackground = true)
    public static final String ACTION_USER_INFO_CHANGED_BACKGROUND =
            "android.intent.action.USER_INFO_CHANGED_BACKGROUND";
    /**
     * Broadcast sent to the primary user when an associated managed profile is added (the profile
     * was created and is ready to be used). Carries an extra {@link #EXTRA_USER} that specifies
+5 −0
Original line number Diff line number Diff line
@@ -134,4 +134,9 @@ to pre-existing users, but cannot uninstall pre-existing system packages from pr
    <install-in-user-type package="com.android.avatarpicker">
        <install-in user-type="FULL" />
    </install-in-user-type>

    <!-- Users Widget (Users widget)-->
    <install-in-user-type package="com.android.multiuser">
        <install-in user-type="FULL" />
    </install-in-user-type>
</config>
+7 −2
Original line number Diff line number Diff line
@@ -3312,13 +3312,18 @@ public class UserManagerService extends IUserManager.Stub {
        }
    }



    private void sendUserInfoChangedBroadcast(@UserIdInt int userId) {
        Intent changedIntent = new Intent(Intent.ACTION_USER_INFO_CHANGED);
        changedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
        changedIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
        mContext.sendBroadcastAsUser(changedIntent, UserHandle.ALL);

        // This intent allow system UI apps to refresh the content even if process was freezed.
        Intent bgIntent = new Intent(Intent.ACTION_USER_INFO_CHANGED_BACKGROUND);
        bgIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
        bgIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        mContext.sendBroadcastAsUser(bgIntent, UserHandle.ALL,
                Manifest.permission.MANAGE_USERS);
    }

    @Override