DO NOT MERGE Isolated processes must fail registering BRs. am: d752ea5f24

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21688022

Change-Id: I7c31967c2f0af4a9375ae994adc8da200bb9a85c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Mugdha Lakhani
2023-03-03 19:37:53 +00:00
committed by Automerger Merge Worker

View File

@@ -13119,12 +13119,17 @@ public class ActivityManagerService extends IActivityManager.Stub
public Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage,
String callerFeatureId, String receiverId, IIntentReceiver receiver,
IntentFilter filter, String permission, int userId, int flags) {
enforceNotIsolatedCaller("registerReceiver");
// Allow Sandbox process to register only unexported receivers.
if ((flags & Context.RECEIVER_NOT_EXPORTED) != 0) {
enforceNotIsolatedCaller("registerReceiver");
} else if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()) {
enforceNotIsolatedOrSdkSandboxCaller("registerReceiver");
boolean unexported = (flags & Context.RECEIVER_NOT_EXPORTED) != 0;
if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()
&& Process.isSdkSandboxUid(Binder.getCallingUid())
&& !unexported) {
throw new SecurityException("SDK sandbox process not allowed to call "
+ "registerReceiver");
}
ArrayList<Intent> stickyIntents = null;
ProcessRecord callerApp = null;
final boolean visibleToInstantApps