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

Commit f232c698 authored by Abhishek Pandit-Subedi's avatar Abhishek Pandit-Subedi
Browse files

floss: Refactor le reconnection during suspend

During system suspend, we need to use a separate set of LE scan window
and intervals that are specifically tuned for this purpose. In order to
do this only when suspended, we add |SetSystemSuspendState| to indicate
when we're entering and existing suspend.

We set the suspend state via |AllowWakeByHid| and remove the suspend
state via |RestoreFilterAcceptList|. Currently, we only restore LE hid
devices on resume to the accept list but we should also restore
non-direct gatt connections in the future.

Bug: 271159571
Tag: #floss
Test: Manual test, ChromeOS Autotest and unit tests
Change-Id: I3e67f06f7667dec69379468cc51b8405cf10de10
parent 8d4c318c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -4408,9 +4408,10 @@ void bta_dm_allow_wake_by_hid(
 * Parameters
 *
 *******************************************************************************/
void bta_dm_restore_filter_accept_list() {
void bta_dm_restore_filter_accept_list(
    std::vector<std::pair<RawAddress, uint8_t>> le_devices) {
  // Autoplumbed
  bluetooth::shim::BTM_RestoreFilterAcceptList();
  bluetooth::shim::BTM_RestoreFilterAcceptList(le_devices);
}

/*******************************************************************************
+4 −2
Original line number Diff line number Diff line
@@ -742,9 +742,11 @@ void BTA_DmAllowWakeByHid(
                                          std::move(le_hid_devices)));
}

void BTA_DmRestoreFilterAcceptList() {
void BTA_DmRestoreFilterAcceptList(
    std::vector<std::pair<RawAddress, uint8_t>> le_devices) {
  APPL_TRACE_API("BTA_DmRestoreFilterAcceptList");
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_restore_filter_accept_list));
  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_restore_filter_accept_list,
                                          std::move(le_devices)));
}

void BTA_DmSetDefaultEventMaskExcept(uint64_t mask, uint64_t le_mask) {
+2 −1
Original line number Diff line number Diff line
@@ -585,7 +585,8 @@ extern void bta_dm_set_event_filter_connection_setup_all_devices();
extern void bta_dm_allow_wake_by_hid(
    std::vector<RawAddress> classic_hid_devices,
    std::vector<std::pair<RawAddress, uint8_t>> le_hid_devices);
extern void bta_dm_restore_filter_accept_list();
extern void bta_dm_restore_filter_accept_list(
    std::vector<std::pair<RawAddress, uint8_t>> le_devices);
extern void bta_dm_set_default_event_mask_except(uint64_t mask,
                                                 uint64_t le_mask);
extern void bta_dm_set_event_filter_inquiry_result_all_devices();
+2 −1
Original line number Diff line number Diff line
@@ -1324,7 +1324,8 @@ extern void BTA_DmAllowWakeByHid(
 * Parameters
 *
 *******************************************************************************/
extern void BTA_DmRestoreFilterAcceptList();
extern void BTA_DmRestoreFilterAcceptList(
    std::vector<std::pair<RawAddress, uint8_t>> le_devices);

/*******************************************************************************
 *
+2 −1
Original line number Diff line number Diff line
@@ -104,7 +104,8 @@ void btif_dm_set_event_filter_connection_setup_all_devices();
void btif_dm_allow_wake_by_hid(
    std::vector<RawAddress> classic_addrs,
    std::vector<std::pair<RawAddress, uint8_t>> le_addrs);
void btif_dm_restore_filter_accept_list();
void btif_dm_restore_filter_accept_list(
    std::vector<std::pair<RawAddress, uint8_t>> le_devices);
void btif_dm_set_default_event_mask_except(uint64_t mask, uint64_t le_mask);
void btif_dm_set_event_filter_inquiry_result_all_devices();
void btif_dm_metadata_changed(const RawAddress& remote_bd_addr, int key,
Loading