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

Commit 91134782 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

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

Merge "Fix call audio switch issue for BT LE to speaker and back to BT switch" am: 10e81add am: 018b736d am: df94e6a4

Original change: https://android-review.googlesource.com/c/platform/packages/services/Telecomm/+/2173509



Change-Id: Ib2de1e535ccdbda8a94aba9feccb154208817ab1
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents dee59e03 df94e6a4
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;
    }