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

Commit de906733 authored by Joanne Chung's avatar Joanne Chung Committed by Android (Google) Code Review
Browse files

Merge "Explicitly set PendingIntent.FLAG_IMMUTABLE"

parents 82c2a800 cd740df7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,8 @@ public final class ConversationActionTest {
    @Test
    public void toBuilder() {
        final Context context = InstrumentationRegistry.getTargetContext();
        final PendingIntent intent = PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_MUTABLE_UNAUDITED);
        final PendingIntent intent = PendingIntent.getActivity(
                context, 0, new Intent(), PendingIntent.FLAG_IMMUTABLE);
        final Icon icon = Icon.createWithData(new byte[]{0}, 0, 1);
        final Bundle extras = new Bundle();
        extras.putInt("key", 5);
+7 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.view.textclassifier;

import static android.app.PendingIntent.FLAG_IMMUTABLE;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,7 +81,7 @@ public class TextClassificationTest {
        final String primaryDescription = "primaryDescription";
        final Intent primaryIntent = new Intent("primaryIntentAction");
        final PendingIntent primaryPendingIntent = PendingIntent.getActivity(context, 0,
                primaryIntent, PendingIntent.FLAG_MUTABLE_UNAUDITED);
                primaryIntent, FLAG_IMMUTABLE);
        final RemoteAction remoteAction0 = new RemoteAction(primaryIcon, primaryLabel,
                primaryDescription, primaryPendingIntent);

@@ -88,7 +90,7 @@ public class TextClassificationTest {
        final String secondaryDescription = "secondaryDescription";
        final Intent secondaryIntent = new Intent("secondaryIntentAction");
        final PendingIntent secondaryPendingIntent = PendingIntent.getActivity(context, 0,
                secondaryIntent, PendingIntent.FLAG_MUTABLE_UNAUDITED);
                secondaryIntent, FLAG_IMMUTABLE);
        final RemoteAction remoteAction1 = new RemoteAction(secondaryIcon, secondaryLabel,
                secondaryDescription, secondaryPendingIntent);

@@ -156,7 +158,7 @@ public class TextClassificationTest {
        final int iconColor = Color.RED;
        final String label = "label";
        final PendingIntent pendingIntent = PendingIntent.getActivity(
                context, 0, new Intent("ACTION_0"), PendingIntent.FLAG_MUTABLE_UNAUDITED);
                context, 0, new Intent("ACTION_0"), FLAG_IMMUTABLE);
        final RemoteAction remoteAction = new RemoteAction(
                generateTestIcon(width, height, iconColor),
                label,
@@ -239,7 +241,8 @@ public class TextClassificationTest {
                .setIntent(new Intent("action"))
                .setOnClickListener(view -> { })
                .addAction(new RemoteAction(icon1, "title1", "desc1",
                          PendingIntent.getActivity(context, 0, new Intent("action1"), PendingIntent.FLAG_MUTABLE_UNAUDITED)))
                        PendingIntent.getActivity(
                                context, 0, new Intent("action1"), FLAG_IMMUTABLE)))
                .addAction(new RemoteAction(icon1, "title2", "desc2",
                          PendingIntent.getActivity(context, 0, new Intent("action2"), 0)))
                .setEntityType(TextClassifier.TYPE_EMAIL, 0.5f)
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.view.textclassifier;

import static android.app.PendingIntent.FLAG_IMMUTABLE;

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertEquals;
@@ -128,7 +130,8 @@ public class TextSelectionTest {

        final TextClassification classification = new TextClassification.Builder()
                .addAction(new RemoteAction(icon1, "title1", "desc1",
                        PendingIntent.getActivity(context, 0, new Intent("action1"), 0)))
                        PendingIntent.getActivity(
                                context, 0, new Intent("action1"), FLAG_IMMUTABLE)))
                .setEntityType(TextClassifier.TYPE_ADDRESS, 1.0f)
                .build();
        final TextSelection textSelection = new TextSelection.Builder(startIndex, endIndex)