Allow multiple simultaneous connections for BT input devices.
Move responsibility for disconnecting devices before connecting a new profile from CachedBluetoothDevice to LocalBluetoothProfileManager. The ProfileManager subclasses of LocalBluetoothProfileManager will handle disconnecting the previously connected device, if necessary, as part of connect(). The HID profile allows multiple simultaneous connected devices, while the other supported profiles do not. Bug: 3333975 Change-Id: Id51b26e64f7c3ee7d54af3a03ca82a669f305b52
This commit is contained in:
@@ -471,6 +471,12 @@ abstract class LocalBluetoothProfileManager {
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
List<BluetoothDevice> sinks = getConnectedDevices();
|
||||
if (sinks != null) {
|
||||
for (BluetoothDevice sink : sinks) {
|
||||
mService.disconnect(sink);
|
||||
}
|
||||
}
|
||||
return mService.connect(device);
|
||||
}
|
||||
|
||||
@@ -727,6 +733,12 @@ abstract class LocalBluetoothProfileManager {
|
||||
|
||||
@Override
|
||||
public boolean connect(BluetoothDevice device) {
|
||||
List<BluetoothDevice> sinks = getConnectedDevices();
|
||||
if (sinks != null) {
|
||||
for (BluetoothDevice sink : sinks) {
|
||||
mService.disconnect(sink);
|
||||
}
|
||||
}
|
||||
return mService.connect(device);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user