From 4724ea7ef7bfe698cace7213772f866349bcc676 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 23 May 2017 10:39:38 -0700 Subject: [PATCH] audio service: fix rapid succession of A2DP devices connections commit dae476f7330 introduced a potential problem when a different BT A2DP device is connected just after disconnecting one. Bug: 37499793 Test: check connection to new BT A2DP device when one is already connected. Change-Id: I8055844822fcc1640cca67fab2cba629c93f7cfa --- .../core/java/com/android/server/audio/AudioService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index e9555f7870d78..e5c31061feabb 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -3931,7 +3931,7 @@ public class AudioService extends IAudioService.Stub public int setBluetoothA2dpDeviceConnectionState(BluetoothDevice device, int state, int profile) { - if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE)) { + if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE, device)) { return 0; } return setBluetoothA2dpDeviceConnectionStateInt( @@ -5070,7 +5070,7 @@ public class AudioService extends IAudioService.Stub private void onSetA2dpSinkConnectionState(BluetoothDevice btDevice, int state) { - if (DEBUG_VOL) { + if (DEBUG_DEVICES) { Log.d(TAG, "onSetA2dpSinkConnectionState btDevice=" + btDevice+"state=" + state); } if (btDevice == null) { @@ -5173,7 +5173,7 @@ public class AudioService extends IAudioService.Stub int device = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP; synchronized (mConnectedDevices) { - if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE)) { + if (mAudioHandler.hasMessages(MSG_SET_A2DP_SINK_CONNECTION_STATE, btDevice)) { return; } final String key = makeDeviceListKey(device, address);