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

Commit d63d2456 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Use removeActiveDevice() when set phone as active device"

parents d5579959 666e8fae
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -164,7 +164,9 @@ public class A2dpProfile implements LocalBluetoothProfile {
        if (mBluetoothAdapter == null) {
            return false;
        }
        return mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_AUDIO);
        return device == null
                ? mBluetoothAdapter.removeActiveDevice(ACTIVE_DEVICE_AUDIO)
                : mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_AUDIO);
    }

    public BluetoothDevice getActiveDevice() {
+4 −1
Original line number Diff line number Diff line
@@ -125,7 +125,10 @@ public class HeadsetProfile implements LocalBluetoothProfile {
        if (mBluetoothAdapter == null) {
            return false;
        }
        return mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_PHONE_CALL);

        return device == null
                ? mBluetoothAdapter.removeActiveDevice(ACTIVE_DEVICE_PHONE_CALL)
                : mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_PHONE_CALL);
    }

    public BluetoothDevice getActiveDevice() {
+3 −1
Original line number Diff line number Diff line
@@ -162,7 +162,9 @@ public class HearingAidProfile implements LocalBluetoothProfile {
        if (mBluetoothAdapter == null) {
            return false;
        }
        return mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_ALL);
        return device == null
                ? mBluetoothAdapter.removeActiveDevice(ACTIVE_DEVICE_ALL)
                : mBluetoothAdapter.setActiveDevice(device, ACTIVE_DEVICE_ALL);
    }

    public List<BluetoothDevice> getActiveDevices() {
+6 −0
Original line number Diff line number Diff line
@@ -203,4 +203,10 @@ public class A2dpProfileTest {
        assertThat(mProfile.getHighQualityAudioOptionLabel(mDevice)).isEqualTo(
                String.format(KNOWN_CODEC_LABEL, config.getCodecName()));
    }

    @Test
    public void setActiveDevice_returnTrue() {
        assertThat(mProfile.setActiveDevice(null)).isTrue();
        assertThat(mProfile.setActiveDevice(mDevice)).isTrue();
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -75,4 +75,10 @@ public class HeadsetProfileTest {
        assertThat(mProfile.getAudioState(mBluetoothDevice)).
                isEqualTo(BluetoothHeadset.STATE_AUDIO_CONNECTED);
    }

    @Test
    public void setActiveDevice_returnTrue() {
        assertThat(mProfile.setActiveDevice(null)).isTrue();
        assertThat(mProfile.setActiveDevice(mBluetoothDevice)).isTrue();
    }
}
Loading