Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aec5981b authored by Abodunrinwa Toki's avatar Abodunrinwa Toki
Browse files

Use FLAG_UPDATE_CURRENT for TC PendingIntents.

This way the newest PendingIntent will override any matching ones.

Bug: 78286917
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Change-Id: Ib130fa5979c3dab628e7be668331cb94d23e0829
parent 6db14d01
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -288,11 +288,12 @@ public final class TextClassification implements Parcelable {
    @Nullable
    public static PendingIntent createPendingIntent(
            @NonNull final Context context, @NonNull final Intent intent, int requestCode) {
        final int flags = PendingIntent.FLAG_UPDATE_CURRENT;
        switch (getIntentType(intent, context)) {
            case IntentType.ACTIVITY:
                return PendingIntent.getActivity(context, requestCode, intent, 0);
                return PendingIntent.getActivity(context, requestCode, intent, flags);
            case IntentType.SERVICE:
                return PendingIntent.getService(context, requestCode, intent, 0);
                return PendingIntent.getService(context, requestCode, intent, flags);
            default:
                return null;
        }