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

Commit 1c6d6ba0 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi Committed by Automerger Merge Worker
Browse files

Merge "floss: Modify connectable during suspend" am: 618990b6 am: e67b853e

parents cc555735 e67b853e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4442,6 +4442,12 @@ void bta_dm_set_event_filter_connection_setup_all_devices() {
void bta_dm_allow_wake_by_hid(
    std::vector<RawAddress> classic_hid_devices,
    std::vector<std::pair<RawAddress, uint8_t>> le_hid_devices) {
  // If there are any entries in the classic hid list, we should also make
  // the adapter connectable for classic.
  if (classic_hid_devices.size() > 0) {
    BTM_SetConnectability(BTA_DM_CONN);
  }

  bluetooth::shim::BTM_AllowWakeByHid(std::move(classic_hid_devices),
                                      std::move(le_hid_devices));
}
+12 −7
Original line number Diff line number Diff line
@@ -712,6 +712,17 @@ impl Bluetooth {
        Ok(())
    }

    /// Sets the adapter's connectable mode for classic connections.
    pub(crate) fn set_connectable_internal(&mut self, mode: bool) -> bool {
        self.is_connectable = mode;
        if mode && self.get_discoverable() {
            return true;
        }
        self.intf.lock().unwrap().set_adapter_property(BluetoothProperty::AdapterScanMode(
            if mode { BtScanMode::Connectable } else { BtScanMode::None_ },
        )) == 0
    }

    /// Returns all bonded and connected devices.
    pub(crate) fn get_bonded_and_connected_devices(&mut self) -> Vec<BluetoothDevice> {
        self.bonded_devices
@@ -2474,13 +2485,7 @@ impl IBluetoothQALegacy for Bluetooth {
    }

    fn set_connectable(&mut self, mode: bool) -> bool {
        self.is_connectable = mode;
        if mode && self.get_discoverable() {
            return true;
        }
        self.intf.lock().unwrap().set_adapter_property(BluetoothProperty::AdapterScanMode(
            if mode { BtScanMode::Connectable } else { BtScanMode::None_ },
        )) == 0
        self.set_connectable_internal(mode)
    }

    fn get_alias(&self) -> String {
+2 −0
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ impl ISuspend for Suspend {
        // Set suspend event mask
        self.intf.lock().unwrap().set_default_event_mask_except(MASKED_EVENTS_FOR_SUSPEND, 0u64);

        self.bt.lock().unwrap().set_connectable_internal(false);
        self.intf.lock().unwrap().clear_event_filter();
        self.intf.lock().unwrap().clear_filter_accept_list();

@@ -247,6 +248,7 @@ impl ISuspend for Suspend {
        self.intf.lock().unwrap().clear_event_filter();
        self.intf.lock().unwrap().clear_filter_accept_list();
        self.intf.lock().unwrap().restore_filter_accept_list();
        self.bt.lock().unwrap().set_connectable_internal(true);

        if !self.audio_reconnect_list.is_empty() {
            let reconnect_list = self.audio_reconnect_list.clone();