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

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

Change-Id: I186aba5c6cb3603051fc3339dfed416946d6f032
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:40:41 +00:00
committed by Automerger Merge Worker

View File

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