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

Commit eccd5c64 authored by Ying Hsu's avatar Ying Hsu Committed by Automerger Merge Worker
Browse files

Merge "Floss: Avoid LE connection for classic devices" am: e4538e5d am: 295933ff

parents d90d5518 295933ff
Loading
Loading
Loading
Loading
+15 −9
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ use crate::bluetooth_media::{BluetoothMedia, MediaActions};
use crate::socket_manager::{BluetoothSocketManager, SocketActions};
use crate::socket_manager::{BluetoothSocketManager, SocketActions};
use crate::suspend::Suspend;
use crate::suspend::Suspend;
use bt_topshim::{
use bt_topshim::{
    btif::BaseCallbacks,
    btif::{BaseCallbacks, BtDeviceType},
    profiles::{
    profiles::{
        a2dp::A2dpCallbacks, avrcp::AvrcpCallbacks, gatt::GattAdvCallbacks,
        a2dp::A2dpCallbacks, avrcp::AvrcpCallbacks, gatt::GattAdvCallbacks,
        gatt::GattAdvInbandCallbacks, gatt::GattClientCallbacks, gatt::GattScannerCallbacks,
        gatt::GattAdvInbandCallbacks, gatt::GattClientCallbacks, gatt::GattScannerCallbacks,
@@ -240,20 +240,26 @@ impl Stack {
                // update method triggered from here rather than needing a
                // update method triggered from here rather than needing a
                // reference to Bluetooth.
                // reference to Bluetooth.
                Message::OnAclConnected(device) => {
                Message::OnAclConnected(device) => {
                    let dev_type = bluetooth.lock().unwrap().get_remote_type(device.clone());
                    if dev_type == BtDeviceType::Ble {
                        battery_service
                        battery_service
                            .lock()
                            .lock()
                            .unwrap()
                            .unwrap()
                            .handle_action(BatteryServiceActions::Connect(device));
                            .handle_action(BatteryServiceActions::Connect(device));
                    }
                    }
                }


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


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