Allow user add/remove broadcasts to manifest receivers

Bring the implemention into line with the documented (intended)
behavior.  Note that these broadcast already require that the recipient
hold a signature|privileged permission.

Bug: 177072348
Test: manual (bug test case validation)
Change-Id: Ic56892b934017f0d8f75c9c97932d4f6f2bc4166
This commit is contained in:
Christopher Tate
2021-01-08 11:40:24 -08:00
parent 3c72f3de1f
commit 946790208f

View File

@@ -3646,6 +3646,7 @@ public class UserManagerService extends IUserManager.Stub {
//...then external ones
Intent addedIntent = new Intent(Intent.ACTION_USER_ADDED);
addedIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
addedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userInfo.id);
// Also, add the UserHandle for mainline modules which can't use the @hide
// EXTRA_USER_HANDLE.
@@ -4048,6 +4049,7 @@ public class UserManagerService extends IUserManager.Stub {
final long ident = Binder.clearCallingIdentity();
try {
Intent removedIntent = new Intent(Intent.ACTION_USER_REMOVED);
removedIntent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
removedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
// Also, add the UserHandle for mainline modules which can't use the @hide
// EXTRA_USER_HANDLE.