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

Commit f74b2284 authored by Ying Hsu's avatar Ying Hsu
Browse files

Floss: Avoid LE connection for classic devices

Open a GATT client creates an LE connection with peer, if this happens
in the pairing process with an classic keyboard with wrong passkey,
the bluetooth controller might not be reset or not be able to connect
with other peer devices. This patch avoids to connect/disconnect to
battery service for classic devices.

Bug: 258283982
Tag: #floss
Test: Manual - Pair CL keyboard with wrong key and then pair with LE mouse
Change-Id: I8d7e94058bda2a0f840f090f15d33b6a32fb2181
parent 3603a03c
Loading
Loading
Loading
Loading
+15 −9
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ use crate::bluetooth_media::{BluetoothMedia, MediaActions};
use crate::socket_manager::{BluetoothSocketManager, SocketActions};
use crate::suspend::Suspend;
use bt_topshim::{
    btif::BaseCallbacks,
    btif::{BaseCallbacks, BtDeviceType},
    profiles::{
        a2dp::A2dpCallbacks, avrcp::AvrcpCallbacks, gatt::GattAdvCallbacks,
        gatt::GattAdvInbandCallbacks, gatt::GattClientCallbacks, gatt::GattScannerCallbacks,
@@ -240,20 +240,26 @@ impl Stack {
                // update method triggered from here rather than needing a
                // reference to Bluetooth.
                Message::OnAclConnected(device) => {
                    let dev_type = bluetooth.lock().unwrap().get_remote_type(device.clone());
                    if dev_type == BtDeviceType::Ble {
                        battery_service
                            .lock()
                            .unwrap()
                            .handle_action(BatteryServiceActions::Connect(device));
                    }
                }

                // For battery service, use this to clean up internal handles. GATT connection is
                // already dropped if ACL disconnect has occurred.
                Message::OnAclDisconnected(device) => {
                    let dev_type = bluetooth.lock().unwrap().get_remote_type(device.clone());
                    if dev_type == BtDeviceType::Ble {
                        battery_service
                            .lock()
                            .unwrap()
                            .handle_action(BatteryServiceActions::Disconnect(device));
                    }
                }

                Message::SuspendCallbackRegistered(id) => {
                    suspend.lock().unwrap().callback_registered(id);