diff --git a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java index 19de4030e30..bfdd13a3ad2 100644 --- a/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java +++ b/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSlice.java @@ -206,7 +206,7 @@ public class BluetoothDevicesSlice implements CustomSliceable { return PendingIntent .getActivity(mContext, device.hashCode() /* requestCode */, subSettingLauncher.toIntent(), - 0 /* flags */); + PendingIntent.FLAG_IMMUTABLE); } @VisibleForTesting @@ -236,7 +236,8 @@ public class BluetoothDevicesSlice implements CustomSliceable { .setClass(mContext, SliceBroadcastReceiver.class) .putExtra(EXTRA_ENABLE_BLUETOOTH, true); final SliceAction action = SliceAction.create(PendingIntent.getBroadcast(mContext, - 0 /* requestCode */, intent, 0 /* flags */), icon, ListBuilder.ICON_IMAGE, title); + 0 /* requestCode */, intent, PendingIntent.FLAG_IMMUTABLE), icon, + ListBuilder.ICON_IMAGE, title); return new ListBuilder.RowBuilder() .setTitleItem(icon, ListBuilder.ICON_IMAGE) @@ -252,7 +253,7 @@ public class BluetoothDevicesSlice implements CustomSliceable { final IconCompat icon = Utils.createIconWithDrawable(drawable); final CharSequence title = mContext.getText(R.string.bluetooth_devices); final PendingIntent primaryActionIntent = PendingIntent.getActivity(mContext, - 0 /* requestCode */, getIntent(), 0 /* flags */); + 0 /* requestCode */, getIntent(), PendingIntent.FLAG_IMMUTABLE); final SliceAction primarySliceAction = SliceAction.createDeeplink(primaryActionIntent, icon, ListBuilder.ICON_IMAGE, title); @@ -274,7 +275,7 @@ public class BluetoothDevicesSlice implements CustomSliceable { .setSourceMetricsCategory(SettingsEnums.BLUETOOTH_PAIRING) .toIntent(); final PendingIntent pi = PendingIntent.getActivity(mContext, intent.hashCode(), intent, - 0 /* flags */); + PendingIntent.FLAG_IMMUTABLE); return SliceAction.createDeeplink(pi, icon, ListBuilder.ICON_IMAGE, title); } @@ -341,7 +342,8 @@ public class BluetoothDevicesSlice implements CustomSliceable { .putExtra(BLUETOOTH_DEVICE_HASH_CODE, bluetoothDevice.hashCode()); return SliceAction.create( - PendingIntent.getBroadcast(mContext, bluetoothDevice.hashCode(), intent, 0), + PendingIntent.getBroadcast(mContext, bluetoothDevice.hashCode(), intent, + PendingIntent.FLAG_IMMUTABLE), getBluetoothDeviceIcon(bluetoothDevice), ListBuilder.ICON_IMAGE, bluetoothDevice.getName()); diff --git a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java index e139469b60e..cbd43909644 100644 --- a/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java +++ b/tests/robotests/src/com/android/settings/homepage/contextualcards/slices/BluetoothDevicesSliceTest.java @@ -97,7 +97,8 @@ public class BluetoothDevicesSliceTest { // Mock the icon and detail intent of Bluetooth. mIcon = IconCompat.createWithResource(mContext, com.android.internal.R.drawable.ic_settings_bluetooth); - mDetailIntent = PendingIntent.getActivity(mContext, 0, new Intent("test action"), 0); + mDetailIntent = PendingIntent.getActivity(mContext, 0, new Intent("test action"), + PendingIntent.FLAG_IMMUTABLE); doReturn(mIcon).when(mBluetoothDevicesSlice).getBluetoothDeviceIcon(any()); doReturn(mDetailIntent).when(mBluetoothDevicesSlice).getBluetoothDetailIntent(any());