Relax protected broadcast checks for shell.
On userdebug/eng devices, the shell can run as non-shell UIDs, so
define a flag to identify broadcasts coming from the shell, and
don't yell if they're non-protected.
Test: builds, boots, root shell can send broadcasts
Bug: 32369665
Change-Id: I5f55930ee434cb8318c86aaf05eba3c59a326694
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 16af5e1..d68160a 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -4785,6 +4785,11 @@
* @hide
*/
public static final int FLAG_RECEIVER_EXCLUDE_BACKGROUND = 0x00800000;
+ /**
+ * If set, this broadcast is being sent from the shell.
+ * @hide
+ */
+ public static final int FLAG_RECEIVER_FROM_SHELL = 0x00400000;
/**
* @hide Flags that can't be changed with PendingIntent.
@@ -7969,6 +7974,7 @@
*
* @see #getFlags
* @see #addFlags
+ * @see #removeFlags
*
* @see #FLAG_GRANT_READ_URI_PERMISSION
* @see #FLAG_GRANT_WRITE_URI_PERMISSION
@@ -8002,15 +8008,13 @@
}
/**
- * Add additional flags to the intent (or with existing flags
- * value).
+ * Add additional flags to the intent (or with existing flags value).
*
* @param flags The new flags to set.
- *
- * @return Returns the same Intent object, for chaining multiple calls
- * into a single statement.
- *
- * @see #setFlags
+ * @return Returns the same Intent object, for chaining multiple calls into
+ * a single statement.
+ * @see #setFlags(int)
+ * @see #removeFlags(int)
*/
public Intent addFlags(int flags) {
mFlags |= flags;
@@ -8018,6 +8022,17 @@
}
/**
+ * Remove these flags from the intent.
+ *
+ * @param flags The flags to remove.
+ * @see #setFlags(int)
+ * @see #addFlags(int)
+ */
+ public void removeFlags(int flags) {
+ mFlags &= ~flags;
+ }
+
+ /**
* (Usually optional) Set an explicit application package name that limits
* the components this Intent will resolve to. If left to the default
* value of null, all components in all applications will considered.