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:
Jake Hamby
2011-01-10 17:02:26 -08:00
parent 7edb513181
commit a0d39a39c2
2 changed files with 13 additions and 19 deletions

View File

@@ -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);
}