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

Commit 48221250 authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioService: cleanup sco audio mode upon disconnection.

Clean up SCO forced usage and A2DP suspend state upon
SCO device or profile disconnection.
This is in case the Bluetooth Headset service does not
do it.

Bug: 24316765.
Change-Id: Ifc0305607c186be49b2eb42b7868647292e56137
parent e1de9f67
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -2531,7 +2531,10 @@ public class AudioService extends IAudioService.Stub {
        if (!checkAudioSettingsPermission("setBluetoothScoOn()")) {
            return;
        }
        setBluetoothScoOnInt(on);
    }

    public void setBluetoothScoOnInt(boolean on) {
        if (on) {
            mForcedUseForComm = AudioSystem.FORCE_BT_SCO;
        } else if (mForcedUseForComm == AudioSystem.FORCE_BT_SCO) {
@@ -2892,6 +2895,8 @@ public class AudioService extends IAudioService.Stub {
            mScoAudioState = SCO_STATE_INACTIVE;
            broadcastScoConnectionState(AudioManager.SCO_AUDIO_STATE_DISCONNECTED);
        }
        AudioSystem.setParameters("A2dpSuspended=false");
        setBluetoothScoOnInt(false);
    }

    private void broadcastScoConnectionState(int state) {