Merge "Add the mutability flag to BluetoothDevicesSlice."

This commit is contained in:
TreeHugger Robot
2020-12-14 02:47:41 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 6 deletions

View File

@@ -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());