From 3b5912602bec6ccbe8eef8a576730b1565f0067c Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 20 Apr 2010 07:01:00 -0700 Subject: Fix issue 2604270 Device auto connects to Car Dock (Media profile) after undocking. There was a regression introduced by change 4c637b9e34f4c8db69a64ad21a4e2bcfa7485b5f 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 --- media/java/android/media/AudioService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index a38be4854670..44596bfc2c24 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -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 -- cgit v1.2.3-59-g8ed1b