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

Commit 2ed15ad6 authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioService: fix BT SCO audio reconnect

Fix regression in commit 6ac41ac3 preventing SCO audio automatic reconnection
when an HFP device is connected and a communication route client exist with an
active route to this device.
The commit made the communication device check synchronous which broke
the active Bluetooth device check in BtHelper.

Bug: 436347080
Test: repro steps in the bug
Flag: EXEMPT bug fix
Change-Id: Ie5901420ac42953567b5279b7fbc975cc78e8295
parent d6aea705
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -979,13 +979,16 @@ public class BtHelper {
            Log.w(TAG, "onSetBtScoActiveDevice() failed to remove previous device "
                    + getAnonymizedAddress(previousActiveDevice));
        }
        // mBluetoothHeadsetDevice must correspond to previous device until now and new device from
        // now on for SCO activation/deactivation requests made by
        // AudioDeviceBroker.onUpdateCommunicationRouteClient() to succeed.
        mBluetoothHeadsetDevice = btDevice;
        if (!handleBtScoActiveDeviceChange(btDevice, true, false /*deviceSwitch*/)) {
            Log.e(TAG, "onSetBtScoActiveDevice() failed to add new device "
                    + getAnonymizedAddress(btDevice));
            // set mBluetoothHeadsetDevice to null when failing to add new device
            btDevice = null;
            mBluetoothHeadsetDevice = null;
        }
        mBluetoothHeadsetDevice = btDevice;
        if (mBluetoothHeadsetDevice == null) {
            resetBluetoothSco();
        }