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

Commit 87bb3939 authored by AnubhavGupta's avatar AnubhavGupta Committed by Linux Build Service Account
Browse files

Bluetooth: Ignore second connect request

If due to UI sluggishness or because of some faulty
third-party app triggering multiple connect requests,
frameworks receives two back to back connect requests
for the same device, ignore the second connect request
in frameworks itself.

Change-Id: I77de0c2bde91891260e6198b2236ca27d253b839
parent 85b4a8a7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -116,7 +116,11 @@ public final class A2dpProfile implements LocalBluetoothProfile {
        List<BluetoothDevice> sinks = getConnectedDevices();
        if (sinks != null) {
            for (BluetoothDevice sink : sinks) {
                mService.disconnect(sink);
                if (sink.equals(device)) {
                    // Connect to same device, Ignore it
                    Log.d(TAG,"Not disconnecting device = " + sink);
                    return true;
                }
            }
        }
        return mService.connect(device);
+5 −1
Original line number Diff line number Diff line
@@ -115,7 +115,11 @@ public final class HeadsetProfile implements LocalBluetoothProfile {
        List<BluetoothDevice> sinks = mService.getConnectedDevices();
        if (sinks != null) {
            for (BluetoothDevice sink : sinks) {
                if (sink.equals(device)) {
                    // Connect to same device, Ignore it
                    Log.d(TAG,"Not disconnecting device = " + sink);
                    return true;
                }
            }
        }
        return mService.connect(device);