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

Commit d00f87c9 authored by Zemiao Zhu's avatar Zemiao Zhu
Browse files

Add FLAG_IMMUTABLE for PendingIntents.

Bug: 178054993
Test: atest DocumentsUIGoogleTests
Change-Id: I147e07ccb7f68d4d1de9cfd65db2b59cc84a5e48
parent a4005b9a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -187,7 +187,8 @@ class CopyJob extends ResolvedResourcesJob {
                .setContentText(service.getString(
                        R.string.notification_touch_for_details))
                .setContentIntent(PendingIntent.getActivity(appContext, 0, navigateIntent,
                        PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT))
                        PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT
                                | PendingIntent.FLAG_IMMUTABLE))
                .setCategory(Notification.CATEGORY_ERROR)
                .setSmallIcon(R.drawable.ic_menu_copy)
                .setAutoCancel(true);
+2 −1
Original line number Diff line number Diff line
@@ -327,7 +327,8 @@ abstract public class Job implements Runnable {
                .setContentTitle(title)
                .setContentIntent(
                        PendingIntent.getActivity(appContext, 0,
                                buildNavigateIntent(INTENT_TAG_PROGRESS), 0))
                                buildNavigateIntent(INTENT_TAG_PROGRESS),
                                PendingIntent.FLAG_IMMUTABLE))
                .setCategory(Notification.CATEGORY_PROGRESS)
                .setSmallIcon(icon)
                .setOngoing(true);
+2 −1
Original line number Diff line number Diff line
@@ -95,7 +95,8 @@ public class DemoProvider extends TestRootProvider {
            case DIR_AUTH:
                Intent intent = new Intent("com.android.documentsui.test.action.AUTHENTICATE");
                PendingIntent pIntent = PendingIntent.getActivity(getContext(),
                        AbstractActionHandler.CODE_AUTHENTICATION, intent, 0);
                        AbstractActionHandler.CODE_AUTHENTICATION, intent,
                        PendingIntent.FLAG_IMMUTABLE);
                throw new AuthenticationRequiredException(new UnsupportedOperationException(),
                        pIntent);

+1 −1
Original line number Diff line number Diff line
@@ -586,7 +586,7 @@ public class ActionHandlerTest {
    public void testAuthentication() throws Exception {
        PendingIntent intent = PendingIntent.getActivity(
                InstrumentationRegistry.getInstrumentation().getTargetContext(), 0, new Intent(),
                0);
                PendingIntent.FLAG_IMMUTABLE);

        mHandler.startAuthentication(intent);
        assertEquals(intent.getIntentSender(), mActivity.startIntentSender.getLastValue().first);