From dd12e9c10457665160bf01b12791568942a12dc7 Mon Sep 17 00:00:00 2001 From: Ashwini Oruganti Date: Mon, 5 Oct 2020 11:50:03 -0700 Subject: Enforce that a PendingIntent has an explicit mutability flag on creation. This was previously a log.e, this change enforces this requirement. See go/immutable-pendingintents for more context. Bug: 160794467 Test: atest PendingIntentTest Change-Id: If49be614125d7ac7eb556559ff32016f41beaef8 --- core/java/android/app/PendingIntent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core/java') diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 9dbf1ff6f7c9..b8b9d9fc4026 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -352,7 +352,9 @@ public final class PendingIntent implements Parcelable { if (Compatibility.isChangeEnabled(PENDING_INTENT_EXPLICIT_MUTABILITY_REQUIRED) && !flagImmutableSet && !flagMutableSet) { - Log.e(TAG, msg); + Log.wtf(TAG, msg); + throw new IllegalArgumentException( + "Please specify an explicit mutability flag (FLAG_IMMUTABLE or FLAG_MUTABLE)"); } } -- cgit v1.2.3