Add the mutability flag to BluetoothDevicesSlice.

Starting Android S, all PendingIntent has to have a explicit mutability
flag set.

Fixes: 172207505
Fixes: 172811893
Test: Enable BluetoothDevicesSlice and play on it.
Play on the volume panel.

Change-Id: I618455de683d619fe300309e31864b3c64f12ad1
This commit is contained in:
Yi-Ling Chuang
2020-12-11 15:32:23 +08:00
parent c0f50f59b3
commit 32e7118161
2 changed files with 9 additions and 6 deletions

View File

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