Skip to content

Commit 3568681

Browse files
Mugdha LakhaniAndroid Build Coastguard Worker
authored andcommitted
DO NOT MERGE Isolated processes must fail registering BRs.
Broadcast Receivers should not be allowed to be registered by isolated processes. Bug: b/263358101 Test: atest SdkSandboxRestrictionsHostTest (cherry picked from commit 43b8a91) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d752ea5f24ce50f407504ce99f56535d4cece8e2) Merged-In: I5bb2ee3ce8a447105a18851fdffa5a769cc3fe49 Change-Id: I5bb2ee3ce8a447105a18851fdffa5a769cc3fe49
1 parent 359170f commit 3568681

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13087,12 +13087,17 @@ public Intent registerReceiver(IApplicationThread caller, String callerPackage,
1308713087
public Intent registerReceiverWithFeature(IApplicationThread caller, String callerPackage,
1308813088
String callerFeatureId, String receiverId, IIntentReceiver receiver,
1308913089
IntentFilter filter, String permission, int userId, int flags) {
13090+
enforceNotIsolatedCaller("registerReceiver");
13091+
1309013092
// Allow Sandbox process to register only unexported receivers.
13091-
if ((flags & Context.RECEIVER_NOT_EXPORTED) != 0) {
13092-
enforceNotIsolatedCaller("registerReceiver");
13093-
} else if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()) {
13094-
enforceNotIsolatedOrSdkSandboxCaller("registerReceiver");
13093+
boolean unexported = (flags & Context.RECEIVER_NOT_EXPORTED) != 0;
13094+
if (mSdkSandboxSettings.isBroadcastReceiverRestrictionsEnforced()
13095+
&& Process.isSdkSandboxUid(Binder.getCallingUid())
13096+
&& !unexported) {
13097+
throw new SecurityException("SDK sandbox process not allowed to call "
13098+
+ "registerReceiver");
1309513099
}
13100+
1309613101
ArrayList<Intent> stickyIntents = null;
1309713102
ProcessRecord callerApp = null;
1309813103
final boolean visibleToInstantApps

0 commit comments

Comments
 (0)