Merge "Honor app visibility for broadcasting PACKAGE_RESTARTED"

This commit is contained in:
Jackal Guo
2022-04-19 01:51:00 +00:00
committed by Android (Google) Code Review

View File

@@ -4270,12 +4270,19 @@ public class ActivityManagerService extends IActivityManager.Stub
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY
| Intent.FLAG_RECEIVER_FOREGROUND);
}
final int userId = UserHandle.getUserId(uid);
final int[] broadcastAllowList =
getPackageManagerInternal().getVisibilityAllowList(packageName, userId);
intent.putExtra(Intent.EXTRA_UID, uid);
intent.putExtra(Intent.EXTRA_USER_HANDLE, UserHandle.getUserId(uid));
broadcastIntentLocked(null, null, null, intent,
null, null, 0, null, null, null, null, OP_NONE,
null, false, false, MY_PID, SYSTEM_UID, Binder.getCallingUid(),
Binder.getCallingPid(), UserHandle.getUserId(uid));
intent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
broadcastIntentLocked(null /* callerApp */, null /* callerPackage */,
null /* callerFeatureId */, intent, null /* resolvedType */, null /* resultTo */,
0 /* resultCode */, null /* resultData */, null /* resultExtras */,
null /* requiredPermissions */, null /* excludedPermissions */, OP_NONE,
null /* bOptions */, false /* ordered */, false /* sticky */, MY_PID, SYSTEM_UID,
Binder.getCallingUid(), Binder.getCallingPid(), userId,
false /* allowBackgroundActivityStarts */, null /* backgroundActivityStartsToken */,
broadcastAllowList);
}
private void cleanupDisabledPackageComponentsLocked(