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

Commit 3b591260 authored by Eric Laurent's avatar Eric Laurent
Browse files

Fix issue 2604270 Device auto connects to Car Dock (Media profile) after undocking.

There was a regression introduced by change 4c637b9e
fixing issue 2578813. As the A2DP device disconnection is notified to the audio policy manager
after a delay, there is a period during which the A2DP device is actually not connected but the
A2DP output is considered present by audio framework. If a playback is started during this period,
The A2DP output requests the activation of the A2DP sink which in turn triggers a reconnection
of the A2DP sink.

The fix consists in suspending the A2DP output immediately when receiving the A2DP disconnection
intent so that any activity on A2DP output is ignored until the output is actually closed by the
audio policy manager.

Change-Id: I16eaace45e12bfc970f50836b46a73b756b493f0
parent 0a4ab1b9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1728,6 +1728,9 @@ public class AudioService extends IAudioService.Stub {
    }

    private void makeA2dpDeviceUnavailableLater(String address) {
        // prevent any activity on the A2DP audio output to avoid unwanted
        // reconnection of the sink.
        AudioSystem.setParameters("A2dpSuspended=true");
        // the device will be made unavailable later, so consider it disconnected right away
        mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
        // send the delayed message to make the device unavailable later