Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e6f2dcf authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Gerrit Code Review
Browse files

Merge "Remove hidden Bluetooth dependencies"

parents 8109ad80 a95180f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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();
    }

+12 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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));
+1 −1
Original line number Diff line number Diff line
@@ -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));
Loading