From 78333dd750c7353e47163407a662ef39a3c6b24a Mon Sep 17 00:00:00 2001 From: Jaikumar Ganesh Date: Wed, 26 Aug 2009 19:42:09 -0700 Subject: [PATCH] Set Routing to A2DP only when state is Connected. We were setting the routing to A2DP when the state was Connecting too. This was incorrect and can cause problems. One such problem was when handling an incoming connection we set the routing to A2DP before authorization. And even if authorization succeeds we get out sync with AVDTP command state. --- media/java/android/media/AudioService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index d1b9351196e2f..754d5a2d754fc 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1381,7 +1381,8 @@ public class AudioService extends IAudioService.Stub { address); mConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP); } else if (!isConnected && - (state == BluetoothA2dp.STATE_CONNECTED || state != BluetoothA2dp.STATE_PLAYING)){ + (state == BluetoothA2dp.STATE_CONNECTED || + state == BluetoothA2dp.STATE_PLAYING)) { AudioSystem.setDeviceConnectionState(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, AudioSystem.DEVICE_STATE_AVAILABLE, address);