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
Change-Id: I5bb2ee3ce8a447105a18851fdffa5a769cc3fe49
(cherry picked from commit 43b8a91b05)
This commit is contained in:
@@ -13089,12 +13089,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
|
||||||
|
|||||||
Reference in New Issue
Block a user