Only send exposed broadcasts to Instant Apps
In order to prevent Instant Apps from receiving potentially sensitive
broadcasts they will only receive those that the sender explicitly
exposes to Instant Apps by setting
Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS.
Bug:33350280
Test: `adb shell am broadcast` does not get delivered to Instant App
Test: `adb shell am broadcast -f 0x0x200000` gets delivered to Instant
App
Test: Verified that an Instant App can send a broadcast to itself
without FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS
Change-Id: Ie363448bf224abba530dd4caf69258939fff00af
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e0dc10d..e14bb28 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -4977,6 +4977,14 @@
public static final int FLAG_RECEIVER_FROM_SHELL = 0x00400000;
/**
+ * If set, the broadcast will be visible to receivers in Instant Apps. By default Instant Apps
+ * will not receive broadcasts.
+ *
+ * <em>This flag has no effect when used by an Instant App.</em>
+ */
+ public static final int FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 0x00200000;
+
+ /**
* @hide Flags that can't be changed with PendingIntent.
*/
public static final int IMMUTABLE_FLAGS = FLAG_GRANT_READ_URI_PERMISSION