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

Commit 0d7f0a69 authored by Eric Laurent's avatar Eric Laurent
Browse files

audiodevicebroker: restart SCO audio when disconnected externally

Allow to restart a pending internal SCO audio request when the SCO audio
link was disconnecting from an external source.

Bug: 330843134
Test: make
Flag: EXEMPT bug fix
Change-Id: If09eee197554aeb49db149c77300664e9317bae2
parent 083c7fec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -414,7 +414,8 @@ public class AudioDeviceBroker {
        }
        if (!mScoManagedByAudio) {
            boolean isBtScoRequested = isBluetoothScoRequested();
            if (isBtScoRequested && (!wasBtScoRequested || !isBluetoothScoActive())) {
            if (isBtScoRequested && (!wasBtScoRequested || !isBluetoothScoActive()
                    || !mBtHelper.isBluetoothScoRequestedInternally())) {
                if (!mBtHelper.startBluetoothSco(scoAudioMode, eventSource)) {
                    Log.w(TAG, "setCommunicationRouteForClient: failure to start BT SCO for uid: "
                            + uid);
+5 −0
Original line number Diff line number Diff line
@@ -488,6 +488,11 @@ public class BtHelper {
                == BluetoothHeadset.STATE_AUDIO_CONNECTED;
    }

    /*package*/ synchronized boolean isBluetoothScoRequestedInternally() {
        return mScoAudioState == SCO_STATE_ACTIVE_INTERNAL
              || mScoAudioState == SCO_STATE_ACTIVATE_REQ;
    }

    // @GuardedBy("mDeviceBroker.mSetModeLock")
    @GuardedBy("AudioDeviceBroker.this.mDeviceStateLock")
    /*package*/ synchronized boolean startBluetoothSco(int scoAudioMode,