Loading src/com/android/bluetooth/a2dp/A2dpService.java +17 −2 Original line number Diff line number Diff line Loading @@ -250,9 +250,24 @@ public class A2dpService extends ProfileService { synchronized (mStateMachines) { if (!connectionAllowedCheckMaxDevices(device)) { // when mMaxConnectedAudioDevices is one, disconnect current device first. if (mMaxConnectedAudioDevices == 1) { List<BluetoothDevice> sinks = getDevicesMatchingConnectionStates( new int[] {BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_CONNECTING, BluetoothProfile.STATE_DISCONNECTING}); for (BluetoothDevice sink : sinks) { if (sink.equals(device)) { Log.w(TAG, "Connecting to device " + device + " : disconnect skipped"); continue; } disconnect(sink); } } else { Log.e(TAG, "Cannot connect to " + device + " : too many connected devices"); return false; } } A2dpStateMachine smConnect = getOrCreateStateMachine(device); if (smConnect == null) { Log.e(TAG, "Cannot connect to " + device + " : no state machine"); Loading Loading
src/com/android/bluetooth/a2dp/A2dpService.java +17 −2 Original line number Diff line number Diff line Loading @@ -250,9 +250,24 @@ public class A2dpService extends ProfileService { synchronized (mStateMachines) { if (!connectionAllowedCheckMaxDevices(device)) { // when mMaxConnectedAudioDevices is one, disconnect current device first. if (mMaxConnectedAudioDevices == 1) { List<BluetoothDevice> sinks = getDevicesMatchingConnectionStates( new int[] {BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_CONNECTING, BluetoothProfile.STATE_DISCONNECTING}); for (BluetoothDevice sink : sinks) { if (sink.equals(device)) { Log.w(TAG, "Connecting to device " + device + " : disconnect skipped"); continue; } disconnect(sink); } } else { Log.e(TAG, "Cannot connect to " + device + " : too many connected devices"); return false; } } A2dpStateMachine smConnect = getOrCreateStateMachine(device); if (smConnect == null) { Log.e(TAG, "Cannot connect to " + device + " : no state machine"); Loading