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

Commit df94e6a4 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

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



Change-Id: Ic0706ab9edd03738fdd9d0087ec9a47cae1ba39b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1c92befb 018b736d
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;
    }