Merge "Remove hidden Bluetooth dependencies" am: 2e6f2dcfff
am: 19d5264723
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1989146 Change-Id: I59f5ddaa559331d6efd974e7abd719db3d05aafb
This commit is contained in:
@@ -193,7 +193,7 @@ public class AccessibilityHearingAidPreferenceControllerTest {
|
||||
private void setupBluetoothEnvironment() {
|
||||
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
|
||||
mLocalBluetoothManager = Utils.getLocalBtManager(mContext);
|
||||
mBluetoothManager = new BluetoothManager(mContext);
|
||||
mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
when(mLocalBluetoothManager.getCachedDeviceManager()).thenReturn(mCachedDeviceManager);
|
||||
when(mLocalBluetoothManager.getProfileManager()).thenReturn(mLocalBluetoothProfileManager);
|
||||
|
@@ -76,7 +76,7 @@ public abstract class BluetoothDetailsControllerTestBase {
|
||||
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
|
||||
mLifecycleOwner = () -> mLifecycle;
|
||||
mLifecycle = spy(new Lifecycle(mLifecycleOwner));
|
||||
mBluetoothManager = new BluetoothManager(mContext);
|
||||
mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import android.bluetooth.BluetoothClass;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
|
||||
@@ -40,12 +41,22 @@ import org.robolectric.annotation.Config;
|
||||
@Config(shadows = {ShadowBluetoothAdapter.class})
|
||||
public class BluetoothPairingControllerTest {
|
||||
private final BluetoothClass mBluetoothClass =
|
||||
new BluetoothClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
||||
createBtClass(BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE);
|
||||
@Mock
|
||||
private BluetoothDevice mBluetoothDevice;
|
||||
private Context mContext;
|
||||
private BluetoothPairingController mBluetoothPairingController;
|
||||
|
||||
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
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
@@ -137,7 +137,7 @@ public class AudioOutputSwitchPreferenceControllerTest {
|
||||
mPackageManager = Shadow.extract(mContext.getPackageManager());
|
||||
mPackageManager.setSystemFeature(PackageManager.FEATURE_BLUETOOTH, true);
|
||||
|
||||
mBluetoothManager = new BluetoothManager(mContext);
|
||||
mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
|
||||
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
|
||||
|
@@ -129,7 +129,7 @@ public class HandsFreeProfileOutputPreferenceControllerTest {
|
||||
when(mLocalBluetoothProfileManager.getHeadsetProfile()).thenReturn(mHeadsetProfile);
|
||||
when(mLocalBluetoothProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile);
|
||||
|
||||
mBluetoothManager = new BluetoothManager(mContext);
|
||||
mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
|
||||
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
|
||||
|
@@ -170,7 +170,7 @@ public class MediaOutputPreferenceControllerTest {
|
||||
when(mLocalBluetoothProfileManager.getA2dpProfile()).thenReturn(mA2dpProfile);
|
||||
when(mLocalBluetoothProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile);
|
||||
|
||||
mBluetoothManager = new BluetoothManager(mContext);
|
||||
mBluetoothManager = mContext.getSystemService(BluetoothManager.class);
|
||||
mBluetoothAdapter = mBluetoothManager.getAdapter();
|
||||
|
||||
mBluetoothDevice = spy(mBluetoothAdapter.getRemoteDevice(TEST_DEVICE_ADDRESS_1));
|
||||
|
Reference in New Issue
Block a user