From eb067ba741f0dc55cd3b8c0f84776191c6d01809 Mon Sep 17 00:00:00 2001 From: Pavlin Radoslavov Date: Wed, 16 Nov 2016 20:51:06 -0800 Subject: Don't disconnect an A2DP device when connecting to same device When processing a connect request for an A2DP device, Settings would trigger a disconnect request for all A2DP devices that have state of CONNECTED, CONNECTING or DISCONNECTING, including eventually the device we are connecting to. This could create timing-related issues, and is not necessary. Now we explicitly check to avoid disconnecting the device we are connecting to. Test: Manual A2DP testing with a phone and wireless headsets Bug: 32688022 Change-Id: I572dd87c071829b734513c4b928a4d65fe539520 --- .../src/com/android/settingslib/bluetooth/A2dpProfile.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java index 9608daad70e9..24ede164fbdd 100755 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java @@ -116,6 +116,10 @@ public final class A2dpProfile implements LocalBluetoothProfile { List sinks = getConnectedDevices(); if (sinks != null) { for (BluetoothDevice sink : sinks) { + if (sink.equals(device)) { + Log.w(TAG, "Connecting to device " + device + " : disconnect skipped"); + continue; + } mService.disconnect(sink); } } -- cgit v1.2.3-59-g8ed1b