Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11b1b069 authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

Bluetooth Multi Connect

Allow automotive bluetooth profiles to connect to issue multiple connect
calls without disconnecting other devices.  These client side profiles
either support multiple connections or handle multiple connection
requests gracefully.

Bug: 36789202
Test: Manual, Connect to one paired device then attempt to connect to a
second paired device, observe that HFP and PBAP are both connected on
both devices.

Change-Id: I8bd6aea2b8411ba5585b34292d8c6ec62c5c2f96
(cherry picked from commit 43eba083)
parent 47347373
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -122,9 +122,6 @@ final class A2dpSinkProfile implements LocalBluetoothProfile {
                    return true;
                }
            }
            for (BluetoothDevice src : srcs) {
                mService.disconnect(src);
            }
        }
        return mService.connect(device);
    }
+0 −5
Original line number Diff line number Diff line
@@ -132,11 +132,6 @@ final class HfpClientProfile implements LocalBluetoothProfile {
                    return true;
                }
            }
            // Handsfree HF only supports one source connection and hence it is OK to disconnect
            // the only connected device here.
            for (BluetoothDevice src : srcs) {
                mService.disconnect(src);
            }
        }
        return mService.connect(device);
    }
+4 −4
Original line number Diff line number Diff line
@@ -115,10 +115,10 @@ public final class MapClientProfile implements LocalBluetoothProfile {
    public boolean connect(BluetoothDevice device) {
        if (mService == null) return false;
        List<BluetoothDevice> connectedDevices = getConnectedDevices();
        if (connectedDevices != null) {
            for (BluetoothDevice connectedDevice : connectedDevices) {
                mService.disconnect(connectedDevice);
            }
        if (connectedDevices != null && connectedDevices.contains(device)) {
            // Connect to same device, Ignore it
            Log.d(TAG,"Ignoring Connect");
            return true;
        }
        return mService.connect(device);
    }
+0 −3
Original line number Diff line number Diff line
@@ -144,9 +144,6 @@ final class PbapClientProfile implements LocalBluetoothProfile {
                    return true;
                }
            }
            for (BluetoothDevice src : srcs) {
                mService.disconnect(src);
            }
        }
        Log.d(TAG,"PBAPClientProfile attempting to connect to " + device.getAddress());