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

Commit 443ada20 authored by Jesse Melhuish's avatar Jesse Melhuish Committed by Michael Sun
Browse files

floss: Add Accepting state for HID host

Bug: 324120239
Test: mma packages/modules/Bluetooth
Flag: EXEMPT using default values
Change-Id: I9f4fc13c7584b582d9643748278a9bf54e8e48ee
parent d710b4c3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -448,6 +448,10 @@ static std::pair<uint32_t, uint32_t> ToProfileConnectionState(uint32_t profile,
        case BthhConnectionState::BTHH_CONN_STATE_DISCONNECTING:
          output.second = (uint32_t)ProfilesConnectionState::DISCONNECTING;
          break;
        case BthhConnectionState::BTHH_CONN_STATE_ACCEPTING:
          // For metric purpose, we map accepting to connecting.
          output.second = (uint32_t)ProfilesConnectionState::CONNECTING;
          break;
        case BthhConnectionState::BTHH_CONN_STATE_UNKNOWN:
          output.second = (uint32_t)ProfilesConnectionState::UNKNOWN;
          break;
+13 −1
Original line number Diff line number Diff line
@@ -2789,10 +2789,15 @@ impl IBluetooth for Bluetooth {
                                // TODO(b/328675014): Use BtAddrType
                                // and BtTransport from
                                // BluetoothDevice instead of default

                                // TODO(b/329837967): Determine
                                // correct reconnection behavior based
                                // on device instead of the default
                                self.hh.as_ref().unwrap().disconnect(
                                    &mut addr.unwrap(),
                                    BtAddrType::Public,
                                    BtTransport::Auto,
                                    /*reconnect_allowed=*/ true,
                                );
                            }

@@ -2970,7 +2975,14 @@ impl BtifHHCallbacks for Bluetooth {
                "[{}]: Rejecting a unbonded device's attempt to connect to HID/HOG profiles",
                DisplayAddress(&address)
            );
            self.hh.as_ref().unwrap().disconnect(&mut address, address_type, transport);
            // TODO(b/329837967): Determine correct reconnection
            // behavior based on device instead of the default
            self.hh.as_ref().unwrap().disconnect(
                &mut address,
                address_type,
                transport,
                /*reconnect_allowed=*/ true,
            );
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ pub enum BthhConnectionState {
    Connecting,
    Disconnected,
    Disconnecting,
    Accepting,
    Unknown = 0xff,
}

@@ -255,6 +256,7 @@ impl HidHost {
        addr: &mut RawAddress,
        address_type: BtAddrType,
        transport: BtTransport,
        reconnect_allowed: bool,
    ) -> BtStatus {
        let addr_ptr = LTCheckedPtrMut::from_ref(addr);
        BtStatus::from(ccall!(
@@ -262,7 +264,8 @@ impl HidHost {
            disconnect,
            addr_ptr.into(),
            address_type.into(),
            transport.into()
            transport.into(),
            reconnect_allowed
        ))
    }