summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ashwini Oruganti <ashfall@google.com> 2020-09-29 12:33:36 -0700
committer Ashwini Oruganti <ashfall@google.com> 2020-09-29 12:40:24 -0700
commit127e497477d56b4fa90b6f4400869742fd07d229 (patch)
tree5f9067b7a03e8efa165d8d3a6da99b6840e85345
parent46c6d7279ba834ee13b8f46bf6dd726e8bf65681 (diff)
Update docs to hint when to use FLAG_MUTABLE
Any PI that needs to be used with inline reply or bubbles needs to keep their PI mutable. This change updates the messaging around FLAG_MUTABLE docs and logs at the mutability flag check to add this use case. Bug: 160794467 Test: docs change, green builds Change-Id: I641b35f92de5843be2fad3ef4621ffc9c6456899
-rw-r--r--core/java/android/app/PendingIntent.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java
index 8e3ee0cbceff..e8937a8da911 100644
--- a/core/java/android/app/PendingIntent.java
+++ b/core/java/android/app/PendingIntent.java
@@ -199,7 +199,8 @@ public final class PendingIntent implements Parcelable {
* either (@link #FLAG_IMMUTABLE} or {@link #FLAG_MUTABLE}. It is strongly
* recommended to use {@link #FLAG_IMMUTABLE} when creating a
* PendingIntent. {@link #FLAG_MUTABLE} should only be used when some
- * functionality relies on modifying the underlying intent.
+ * functionality relies on modifying the underlying intent, e.g. any
+ * PendingIntent that needs to be used with inline reply or bubbles.
*/
public static final int FLAG_MUTABLE = 1<<25;
@@ -320,7 +321,10 @@ public final class PendingIntent implements Parcelable {
final boolean flagMutableSet = (flags & PendingIntent.FLAG_MUTABLE) != 0;
String msg = packageName + ": Targeting S+ (version " + Build.VERSION_CODES.S
+ " and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE"
- + " be specified when creating a PendingIntent";
+ + " be specified when creating a PendingIntent.\nStrongly consider"
+ + " using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality"
+ + " depends on the PendingIntent being mutable, e.g. if it needs to"
+ + " be used with inline replies or bubbles.";
if (flagImmutableSet && flagMutableSet) {
throw new IllegalArgumentException(