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

Commit e07e8765 authored by Chris Manton's avatar Chris Manton
Browse files

shim: Back out gd acl acceptlist gymnastics

Bug: 183374320
Test: gd/cert/run
Tag: #refactor

Change-Id: I07d787e70e0da353f7b9f200536d6d6ef1ae7452
parent cc058e4b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -481,7 +481,6 @@ cc_test {
    ],
    srcs: [
        "gatt/gatt_utils.cc",
        "test/common/mock_acl.cc",
        "test/common/mock_eatt.cc",
        "test/common/mock_gatt_layer.cc",
        "test/common/mock_main_shim.cc",
@@ -610,7 +609,6 @@ cc_test {
        "gatt/gatt_db.cc",
        "gatt/gatt_sr_hash.cc",
        "gatt/gatt_utils.cc",
        "test/common/mock_acl.cc",
        "test/common/mock_eatt.cc",
        "test/common/mock_gatt_layer.cc",
        "test/common/mock_main_shim.cc",
+0 −23
Original line number Diff line number Diff line
@@ -47,26 +47,3 @@ void tACL_CONN::Reset() {
  switch_role_state_ = BTM_ACL_SWKEY_STATE_IDLE;
  sca = 0;
}

// When the local device initiates an le ACL disconnect the address
// should not be re-added to the acceptlist.
void tACL_CB::AddToIgnoreAutoConnectAfterDisconnect(const RawAddress& bd_addr) {
  if (!ignore_auto_connect_after_disconnect_set_.insert(bd_addr).second) {
    LOG_WARN(
        "Unexpectedly found device address already in ignore auto connect "
        "device:%s",
        PRIVATE_ADDRESS(bd_addr));
  }
}

// A check and clear mechanism used to determine if the address should be
// re-added to the acceptlist after an le ACL disconnect is received from a
// peer.
bool tACL_CB::CheckAndClearIgnoreAutoConnectAfterDisconnect(
    const RawAddress& bd_addr) {
  return (ignore_auto_connect_after_disconnect_set_.erase(bd_addr) > 0);
}

void tACL_CB::ClearAllIgnoreAutoConnectAfterDisconnect() {
  ignore_auto_connect_after_disconnect_set_.clear();
}
+0 −8
Original line number Diff line number Diff line
@@ -412,12 +412,4 @@ struct tACL_CB {
    }
    return cnt;
  }

 private:
  std::unordered_set<RawAddress> ignore_auto_connect_after_disconnect_set_;

 public:
  void AddToIgnoreAutoConnectAfterDisconnect(const RawAddress& bd_addr);
  bool CheckAndClearIgnoreAutoConnectAfterDisconnect(const RawAddress& bd_addr);
  void ClearAllIgnoreAutoConnectAfterDisconnect();
};
+0 −14
Original line number Diff line number Diff line
@@ -2921,20 +2921,6 @@ bool ACL_SupportTransparentSynchronousData(const RawAddress& bd_addr) {
  return HCI_LMP_TRANSPNT_SUPPORTED(p_acl->peer_lmp_feature_pages[0]);
}

void acl_add_to_ignore_auto_connect_after_disconnect(
    const RawAddress& bd_addr) {
  btm_cb.acl_cb_.AddToIgnoreAutoConnectAfterDisconnect(bd_addr);
}

bool acl_check_and_clear_ignore_auto_connect_after_disconnect(
    const RawAddress& bd_addr) {
  return btm_cb.acl_cb_.CheckAndClearIgnoreAutoConnectAfterDisconnect(bd_addr);
}

void acl_clear_all_ignore_auto_connect_after_disconnect() {
  btm_cb.acl_cb_.ClearAllIgnoreAutoConnectAfterDisconnect();
}

/**
 * Confusingly, immutable device features are stored in the
 * ephemeral connection data structure while connection security
+0 −7
Original line number Diff line number Diff line
@@ -533,12 +533,6 @@ bool BTM_AcceptlistAdd(const RawAddress& address) {
  }

  if (bluetooth::shim::is_gd_acl_enabled()) {
    if (acl_check_and_clear_ignore_auto_connect_after_disconnect(address)) {
      LOG_WARN(
          "Unexpectedly found device address already in ignore auto connect "
          "device:%s",
          PRIVATE_ADDRESS(address));
    }
    return bluetooth::shim::ACL_AcceptLeConnectionFrom(
        convert_to_address_with_type(address, btm_find_dev(address)),
        /* is_direct */ false);
@@ -588,7 +582,6 @@ void BTM_AcceptlistClear() {
  }

  if (bluetooth::shim::is_gd_acl_enabled()) {
    acl_clear_all_ignore_auto_connect_after_disconnect();
    bluetooth::shim::ACL_IgnoreAllLeConnections();
    return;
  }
Loading