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

Commit d26f9669 authored by Azhara Assanova's avatar Azhara Assanova Committed by Android (Google) Code Review
Browse files

Merge "Make mutable PendingIntent explicit"

parents f9a39022 edf53308
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1073,7 +1073,9 @@ public class RecoverableKeyStoreManagerTest {
        int uid = Binder.getCallingUid();
        PendingIntent intent = PendingIntent.getBroadcast(
                InstrumentationRegistry.getTargetContext(), /*requestCode=*/1,
                new Intent(), /*flags=*/ PendingIntent.FLAG_MUTABLE_UNAUDITED);
                new Intent()
                        .setPackage(InstrumentationRegistry.getTargetContext().getPackageName()),
                /*flags=*/ PendingIntent.FLAG_MUTABLE);
        mRecoverableKeyStoreManager.setSnapshotCreatedPendingIntent(intent);
        verify(mMockListenersStorage).setSnapshotListener(eq(uid), any(PendingIntent.class));
    }
+9 −3
Original line number Diff line number Diff line
@@ -41,7 +41,9 @@ public class RecoverySnapshotListenersStorageTest {
        int recoveryAgentUid = 1000;
        PendingIntent intent = PendingIntent.getBroadcast(
                InstrumentationRegistry.getTargetContext(), /*requestCode=*/ 1,
                new Intent(), /*flags=*/ PendingIntent.FLAG_MUTABLE_UNAUDITED);
                new Intent()
                        .setPackage(InstrumentationRegistry.getTargetContext().getPackageName()),
                /*flags=*/ PendingIntent.FLAG_MUTABLE);
        mStorage.setSnapshotListener(recoveryAgentUid, intent);

        assertTrue(mStorage.hasListener(recoveryAgentUid));
@@ -54,7 +56,9 @@ public class RecoverySnapshotListenersStorageTest {
        int recoveryAgentUid = 1000;
        mStorage.recoverySnapshotAvailable(recoveryAgentUid);
        PendingIntent intent = PendingIntent.getBroadcast(
                context, /*requestCode=*/ 0, new Intent(TEST_INTENT_ACTION), /*flags=*/PendingIntent.FLAG_MUTABLE_UNAUDITED);
                context, /*requestCode=*/ 0,
                new Intent(TEST_INTENT_ACTION).setPackage(context.getPackageName()),
                /*flags=*/PendingIntent.FLAG_MUTABLE);
        CountDownLatch latch = new CountDownLatch(1);
        context.registerReceiver(new BroadcastReceiver() {
            @Override
@@ -75,7 +79,9 @@ public class RecoverySnapshotListenersStorageTest {
        int recoveryAgentUid = 1000;
        mStorage.recoverySnapshotAvailable(recoveryAgentUid);
        PendingIntent intent = PendingIntent.getBroadcast(
                context, /*requestCode=*/ 0, new Intent(TEST_INTENT_ACTION), /*flags=*/PendingIntent.FLAG_MUTABLE_UNAUDITED);
                context, /*requestCode=*/ 0,
                new Intent(TEST_INTENT_ACTION).setPackage(context.getPackageName()),
                /*flags=*/PendingIntent.FLAG_MUTABLE);
        CountDownLatch latch = new CountDownLatch(2);
        BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
            @Override
+3 −1
Original line number Diff line number Diff line
@@ -327,7 +327,9 @@ public class ShortcutManagerTest8 extends BaseShortcutManagerTest {
    }

    private IntentSender makeResultIntent() {
        return PendingIntent.getActivity(getTestContext(), 0, new Intent(), PendingIntent.FLAG_MUTABLE_UNAUDITED).getIntentSender();
        return PendingIntent.getActivity(getTestContext(), 0,
                new Intent().setPackage(getTestContext().getPackageName()),
                PendingIntent.FLAG_MUTABLE).getIntentSender();
    }

    public void testRequestPinShortcut_withCallback() {
+3 −1
Original line number Diff line number Diff line
@@ -150,7 +150,9 @@ public class ShortcutManagerTest9 extends BaseShortcutManagerTest {

    public void testRequestPinAppWidget_withCallback() {
        final PendingIntent resultIntent =
                PendingIntent.getActivity(getTestContext(), 0, new Intent(), PendingIntent.FLAG_MUTABLE_UNAUDITED);
                PendingIntent.getActivity(getTestContext(), 0,
                        new Intent().setPackage(getTestContext().getPackageName()),
                        PendingIntent.FLAG_MUTABLE);

        checkRequestPinAppWidget(resultIntent);
    }