From cfd031a9fb6000414708f5c35a0b89edb295056e Mon Sep 17 00:00:00 2001 From: Ashwini Oruganti Date: Mon, 12 Apr 2021 14:53:29 -0700 Subject: [PATCH] Enforce the PI mutability flag requirement for test apps We relaxed the enforcement for apps under instrumentation to give us some buffer time to help transition all the test apps. This change enforces the mutability flag requirement even for apps under instrumentation. Bug: 178092897 Test: TH Change-Id: Idb7ac5ea5bb84f52f7da058f6a43e3397e6f4601 --- core/java/android/app/PendingIntent.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 4cf3a8059b3e4..ca0868310deec 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -53,7 +53,6 @@ import android.os.RemoteException; import android.os.UserHandle; import android.util.AndroidException; import android.util.ArraySet; -import android.util.Log; import android.util.proto.ProtoOutputStream; import com.android.internal.os.IResultReceiver; @@ -371,19 +370,9 @@ public final class PendingIntent implements Parcelable { "Cannot set both FLAG_IMMUTABLE and FLAG_MUTABLE for PendingIntent"); } - // TODO(b/178092897) Remove the below instrumentation check and enforce - // the explicit mutability requirement for apps under instrumentation. - ActivityThread thread = ActivityThread.currentActivityThread(); - Instrumentation mInstrumentation = thread.getInstrumentation(); - if (Compatibility.isChangeEnabled(PENDING_INTENT_EXPLICIT_MUTABILITY_REQUIRED) && !flagImmutableSet && !flagMutableSet) { - - if (mInstrumentation.isInstrumenting()) { - Log.e(TAG, msg); - } else { throw new IllegalArgumentException(msg); - } } }