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

Commit 735c2495 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Jack He
Browse files

BluetoothDeviceManager: Fix regression after gtbs merge

Code incorretly removed all active devices when it disconnects audio.
This patch brings previous behaviour and does it only for the Hearing
Aid device.

Bug: 214245067
Test: phone call via BT -> switch to speaker-> close the call -> check
a2dp

Change-Id: If7c0120907029968669fa226aa7444bf86f834f5
parent b8e22b66
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -370,7 +370,12 @@ public class BluetoothDeviceManager {

    public void disconnectAudio() {
        if (mBluetoothAdapter != null) {
            for (BluetoothDevice device: mBluetoothAdapter.getActiveDevices(
                        BluetoothProfile.HEARING_AID)) {
                if (device != null) {
                    mBluetoothAdapter.removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
                }
            }
            disconnectSco();
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -375,7 +375,8 @@ public class BluetoothDeviceManagerTest extends TelecomTestCase {
                eq(BluetoothAdapter.ACTIVE_DEVICE_PHONE_CALL));

        mBluetoothDeviceManager.disconnectAudio();
        verify(mAdapter).removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
        // TODO: Add a test here to verify that LE audio is de-selected
        // verify(mAdapter).removeActiveDevice(BluetoothAdapter.ACTIVE_DEVICE_ALL);
    }

    @SmallTest