diff options
| author | paulhu <paulhu@google.com> | 2021-03-03 11:44:31 +0800 |
|---|---|---|
| committer | Remi NGUYEN VAN <reminv@google.com> | 2021-03-08 11:37:18 +0900 |
| commit | e48076b31f39fb58642777009fc54e5aea706407 (patch) | |
| tree | 32a38d34d0bc4ac89af6d2984efc25695a83cfcc /core/java/android | |
| parent | f72cf3cd484aaa34818cf4e3236a9484e6f86aa7 (diff) | |
New API for comparing two intents of PendingIntent object.
Bug: 174237997
Test: atest PendingIntentTest
Change-Id: Ic5eb20f94ff6fd6953315a5f848effa25b813da7
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/PendingIntent.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/java/android/app/PendingIntent.java b/core/java/android/app/PendingIntent.java index 009c9366b1d6..11adc5a60fb3 100644 --- a/core/java/android/app/PendingIntent.java +++ b/core/java/android/app/PendingIntent.java @@ -1257,6 +1257,30 @@ public final class PendingIntent implements Parcelable { } /** + * Comparison operator on two PendingIntent objects, such that true is returned when they + * represent {@link Intent}s that are equal as per {@link Intent#filterEquals}. + * + * @param other The other PendingIntent to compare against. + * @return True if action, data, type, class, and categories on two intents are the same. + * + * @hide + */ + @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) + @TestApi + @RequiresPermission(android.Manifest.permission.GET_INTENT_SENDER_INTENT) + public boolean intentFilterEquals(@Nullable PendingIntent other) { + if (other == null) { + return false; + } + try { + return ActivityManager.getService().getIntentForIntentSender(other.mTarget) + .filterEquals(getIntent()); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + + /** * Comparison operator on two PendingIntent objects, such that true * is returned then they both represent the same operation from the * same package. This allows you to use {@link #getActivity}, |
