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

Commit 671db6f3 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

Fix startBluetoothSco race

Change-Id: I8b711bd3c6b12f2e3e92144c0dadac72261bf914
parent 535e8f35
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -1347,11 +1347,10 @@ public class AudioService extends IAudioService.Stub {
                    // currently controlled by the same client process.
                    if ((AudioService.this.mMode == AudioSystem.MODE_NORMAL ||
                            mSetModeDeathHandlers.get(0).getPid() == mCreatorPid) &&
                            mBluetoothHeadsetDevice != null &&
                            (mScoAudioState == SCO_STATE_INACTIVE ||
                             mScoAudioState == SCO_STATE_DEACTIVATE_REQ)) {
                        if (mScoAudioState == SCO_STATE_INACTIVE) {
                            if (mBluetoothHeadset != null) {
                            if (mBluetoothHeadset != null && mBluetoothHeadsetDevice != null) {
                                if (mBluetoothHeadset.startScoUsingVirtualVoiceCall(
                                        mBluetoothHeadsetDevice)) {
                                    mScoAudioState = SCO_STATE_ACTIVE_INTERNAL;
@@ -1370,11 +1369,10 @@ public class AudioService extends IAudioService.Stub {
                        broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED);
                    }
                } else if (state == BluetoothHeadset.STATE_AUDIO_DISCONNECTED &&
                              mBluetoothHeadsetDevice != null &&
                              (mScoAudioState == SCO_STATE_ACTIVE_INTERNAL ||
                               mScoAudioState == SCO_STATE_ACTIVATE_REQ)) {
                    if (mScoAudioState == SCO_STATE_ACTIVE_INTERNAL) {
                        if (mBluetoothHeadset != null) {
                        if (mBluetoothHeadset != null && mBluetoothHeadsetDevice != null) {
                            if (!mBluetoothHeadset.stopScoUsingVirtualVoiceCall(
                                    mBluetoothHeadsetDevice)) {
                                mScoAudioState = SCO_STATE_INACTIVE;