Merge "Remove hidden Bluetooth dependencies" am: 2eebe9a0bc am: 9b7753af92
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1988929 Change-Id: I1d0bb525b09eb059313b95a93208666ab7a7df08
This commit is contained in:
@@ -206,9 +206,8 @@ public class A2dpProfileTest {
|
|||||||
|
|
||||||
when(config.isMandatoryCodec()).thenReturn(false);
|
when(config.isMandatoryCodec()).thenReturn(false);
|
||||||
when(config.getCodecType()).thenReturn(4);
|
when(config.getCodecType()).thenReturn(4);
|
||||||
when(config.getCodecName()).thenReturn("LDAC");
|
|
||||||
assertThat(mProfile.getHighQualityAudioOptionLabel(mDevice)).isEqualTo(
|
assertThat(mProfile.getHighQualityAudioOptionLabel(mDevice)).isEqualTo(
|
||||||
String.format(KNOWN_CODEC_LABEL, config.getCodecName()));
|
String.format(KNOWN_CODEC_LABEL, "LDAC"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.bluetooth.BluetoothClass;
|
|||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothUuid;
|
import android.bluetooth.BluetoothUuid;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Parcel;
|
||||||
import android.os.ParcelUuid;
|
import android.os.ParcelUuid;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -60,9 +61,9 @@ public class CachedBluetoothDeviceManagerTest {
|
|||||||
private final static Map<Integer, ParcelUuid> CAP_GROUP2 =
|
private final static Map<Integer, ParcelUuid> CAP_GROUP2 =
|
||||||
Map.of(2, BluetoothUuid.CAP);
|
Map.of(2, BluetoothUuid.CAP);
|
||||||
private final BluetoothClass DEVICE_CLASS_1 =
|
private final BluetoothClass DEVICE_CLASS_1 =
|
||||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES);
|
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES);
|
||||||
private final BluetoothClass DEVICE_CLASS_2 =
|
private final BluetoothClass DEVICE_CLASS_2 =
|
||||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
||||||
@Mock
|
@Mock
|
||||||
private LocalBluetoothProfileManager mLocalProfileManager;
|
private LocalBluetoothProfileManager mLocalProfileManager;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -92,6 +93,16 @@ public class CachedBluetoothDeviceManagerTest {
|
|||||||
private HearingAidDeviceManager mHearingAidDeviceManager;
|
private HearingAidDeviceManager mHearingAidDeviceManager;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
|
private BluetoothClass createBtClass(int deviceClass) {
|
||||||
|
Parcel p = Parcel.obtain();
|
||||||
|
p.writeInt(deviceClass);
|
||||||
|
p.setDataPosition(0); // reset position of parcel before passing to constructor
|
||||||
|
|
||||||
|
BluetoothClass bluetoothClass = BluetoothClass.CREATOR.createFromParcel(p);
|
||||||
|
p.recycle();
|
||||||
|
return bluetoothClass;
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.bluetooth.BluetoothDevice;
|
|||||||
import android.bluetooth.BluetoothHearingAid;
|
import android.bluetooth.BluetoothHearingAid;
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Parcel;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -48,7 +49,7 @@ public class HearingAidDeviceManagerTest {
|
|||||||
private final static String DEVICE_ADDRESS_1 = "AA:BB:CC:DD:EE:11";
|
private final static String DEVICE_ADDRESS_1 = "AA:BB:CC:DD:EE:11";
|
||||||
private final static String DEVICE_ADDRESS_2 = "AA:BB:CC:DD:EE:22";
|
private final static String DEVICE_ADDRESS_2 = "AA:BB:CC:DD:EE:22";
|
||||||
private final BluetoothClass DEVICE_CLASS =
|
private final BluetoothClass DEVICE_CLASS =
|
||||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
||||||
@Mock
|
@Mock
|
||||||
private LocalBluetoothProfileManager mLocalProfileManager;
|
private LocalBluetoothProfileManager mLocalProfileManager;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -67,6 +68,16 @@ public class HearingAidDeviceManagerTest {
|
|||||||
private HearingAidDeviceManager mHearingAidDeviceManager;
|
private HearingAidDeviceManager mHearingAidDeviceManager;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
|
private BluetoothClass createBtClass(int deviceClass) {
|
||||||
|
Parcel p = Parcel.obtain();
|
||||||
|
p.writeInt(deviceClass);
|
||||||
|
p.setDataPosition(0); // reset position of parcel before passing to constructor
|
||||||
|
|
||||||
|
BluetoothClass bluetoothClass = BluetoothClass.CREATOR.createFromParcel(p);
|
||||||
|
p.recycle();
|
||||||
|
return bluetoothClass;
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import android.bluetooth.BluetoothDevice;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.MediaRoute2Info;
|
import android.media.MediaRoute2Info;
|
||||||
import android.media.MediaRouter2Manager;
|
import android.media.MediaRouter2Manager;
|
||||||
|
import android.os.Parcel;
|
||||||
|
|
||||||
import com.android.settingslib.bluetooth.A2dpProfile;
|
import com.android.settingslib.bluetooth.A2dpProfile;
|
||||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||||
@@ -65,9 +66,9 @@ public class MediaDeviceTest {
|
|||||||
private static final String ROUTER_ID_3 = "RouterId_3";
|
private static final String ROUTER_ID_3 = "RouterId_3";
|
||||||
private static final String TEST_PACKAGE_NAME = "com.test.playmusic";
|
private static final String TEST_PACKAGE_NAME = "com.test.playmusic";
|
||||||
private final BluetoothClass mHeadreeClass =
|
private final BluetoothClass mHeadreeClass =
|
||||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES);
|
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES);
|
||||||
private final BluetoothClass mCarkitClass =
|
private final BluetoothClass mCarkitClass =
|
||||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO);
|
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO);
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private BluetoothDevice mDevice1;
|
private BluetoothDevice mDevice1;
|
||||||
@@ -118,6 +119,16 @@ public class MediaDeviceTest {
|
|||||||
private List<MediaDevice> mMediaDevices = new ArrayList<>();
|
private List<MediaDevice> mMediaDevices = new ArrayList<>();
|
||||||
private PhoneMediaDevice mPhoneMediaDevice;
|
private PhoneMediaDevice mPhoneMediaDevice;
|
||||||
|
|
||||||
|
private BluetoothClass createBtClass(int deviceClass) {
|
||||||
|
Parcel p = Parcel.obtain();
|
||||||
|
p.writeInt(deviceClass);
|
||||||
|
p.setDataPosition(0); // reset position of parcel before passing to constructor
|
||||||
|
|
||||||
|
BluetoothClass bluetoothClass = BluetoothClass.CREATOR.createFromParcel(p);
|
||||||
|
p.recycle();
|
||||||
|
return bluetoothClass;
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user