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

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

Merge "Fix call audio switch issue for BT LE to speaker and back to BT switch"

parents 054514cb 8a6bd8a5
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class BluetoothDeviceManager {
    private boolean mLeAudioCallbackRegistered = false;
    private BluetoothLeAudio mBluetoothLeAudioService;
    private boolean mLeAudioSetAsCommunicationDevice = false;
    private String mLeAudioDevice;
    private boolean mHearingAidSetAsCommunicationDevice = false;
    private BluetoothDevice mBluetoothHearingAidActiveDeviceCache;
    private BluetoothAdapter mBluetoothAdapter;
@@ -417,10 +418,17 @@ public class BluetoothDeviceManager {
    }

    public void clearLeAudioCommunicationDevice() {
        Log.i(this, "clearLeAudioCommunicationDevice: mLeAudioSetAsCommunicationDevice = " +
                mLeAudioSetAsCommunicationDevice + " device = " + mLeAudioDevice);
        if (!mLeAudioSetAsCommunicationDevice) {
            return;
        }
        mLeAudioSetAsCommunicationDevice = false;
        if (mLeAudioDevice != null) {
            mBluetoothRouteManager.onAudioLost(mLeAudioDevice);
            mLeAudioDevice = null;
        }

        if (mAudioManager == null) {
            Log.i(this, "clearLeAudioCommunicationDevice: mAudioManager is null");
            return;
@@ -428,7 +436,6 @@ public class BluetoothDeviceManager {
        if (mAudioManager.getCommunicationDevice() != null
                && mAudioManager.getCommunicationDevice().getType()
                == AudioDeviceInfo.TYPE_BLE_HEADSET) {
            mBluetoothRouteManager.onAudioLost(mAudioManager.getCommunicationDevice().getAddress());
            mAudioManager.clearCommunicationDevice();
        }
    }
@@ -493,6 +500,7 @@ public class BluetoothDeviceManager {
            Log.i(this, " bleHeadset device set");
            mBluetoothRouteManager.onAudioOn(bleHeadset.getAddress());
            mLeAudioSetAsCommunicationDevice = true;
            mLeAudioDevice = bleHeadset.getAddress();
        }
        return result;
    }