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

Commit 8cc34b9f authored by Yun-Hao Chung's avatar Yun-Hao Chung Committed by Yun-hao Chung
Browse files

Floss: Don't disconnect unbonded HID when disconnected or disconnecting

Don't disconnect the incoming HID connection from an unbonded device
when the state is disconnected or disconnecting, otherwise we will disconnect it twice.

Bug: 374242303
Tag: #floss
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, Floss-only changes
Change-Id: Id2c6cab895e1ed9fea6d7f2e4cfdde224572ce3f
parent 43b80335
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -3047,7 +3047,10 @@ impl BtifHHCallbacks for Bluetooth {
            state as u32,
        );

        if BtBondState::Bonded != self.get_bond_state_by_addr(&address) {
        if BtBondState::Bonded != self.get_bond_state_by_addr(&address)
            && (state != BthhConnectionState::Disconnecting
                && state != BthhConnectionState::Disconnected)
        {
            warn!(
                "[{}]: Rejecting a unbonded device's attempt to connect to HID/HOG profiles",
                DisplayAddress(&address)
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ use topshim_macros::{cb_variant, profile_enabled_or};

use log::warn;

#[derive(Debug, FromPrimitive, PartialEq, PartialOrd)]
#[derive(Debug, FromPrimitive, PartialEq, PartialOrd, Copy, Clone)]
#[repr(u32)]
pub enum BthhConnectionState {
    Connected = 0,