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

Commit 04ba436f authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi
Browse files

floss: Cancel inquiry before attempting connection

Connecting while inquiry is active will fail. As soon as a connect
attempt is made, we should cancel any active inquiry before connecting.

Bug: 254052855
Tag: #floss
Test: Start inquiry, connect, start inquiry while connecting.
Change-Id: I7d61c4e366170c59a12d15bf6eeaed02002badfb
parent 40e353a7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1389,6 +1389,11 @@ impl IBluetooth for Bluetooth {
    }

    fn start_discovery(&self) -> bool {
        // Short-circuit to avoid sending multiple start discovery calls.
        if self.is_discovering {
            return true;
        }

        self.intf.lock().unwrap().start_discovery() == 0
    }

@@ -1807,6 +1812,9 @@ impl IBluetooth for Bluetooth {
            metrics::acl_connect_attempt(addr, BtAclState::Connected);
        }

        // Cancel discovery before attempting to connect (or we'll get connection failures).
        self.cancel_discovery();

        // Check all remote uuids to see if they match enabled profiles and connect them.
        let mut has_enabled_uuids = false;
        let uuids = self.get_remote_uuids(device.clone());