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

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

shim: Allow shim to remove connection_manager entry

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

Change-Id: Ic131259b92a6ec5920d5d556cceebf0acf3b5e8a
parent b9cd4554
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -126,6 +126,13 @@ void acl_ble_enhanced_connection_complete_from_shim(
    uint16_t conn_interval, uint16_t conn_latency, uint16_t conn_timeout,
    const RawAddress& local_rpa, const RawAddress& peer_rpa,
    uint8_t peer_addr_type) {
  if (!connection_manager::remove_unconditional_from_shim(
          address_with_type.bda)) {
    LOG_WARN(
        "Unable to remove from legacy connection manager accept list addr:%s",
        PRIVATE_ADDRESS(address_with_type.bda));
  }

  tBLE_BD_ADDR resolved_address_with_type;
  const bool is_in_security_db = maybe_resolve_received_address(
      address_with_type, &resolved_address_with_type);
+11 −0
Original line number Diff line number Diff line
@@ -133,6 +133,17 @@ bool remove_unconditional(const RawAddress& address) {
  return true;
}

/** Removes the registrations for connection for given device.
 * but does not change the controller acceptlist.  Used for
 * shim purposes.
 * Returns true if anything was removed, false otherwise */
bool remove_unconditional_from_shim(const RawAddress& address) {
  auto it = bgconn_dev.find(address);
  if (it == bgconn_dev.end()) return false;
  bgconn_dev.erase(it);
  return true;
}

/** Remove device from the background connection device list or listening to
 * advertising list.  Returns true if device was on the list and was succesfully
 * removed */
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ extern bool background_connect_add(tAPP_ID app_id, const RawAddress& address);
extern bool background_connect_remove(tAPP_ID app_id,
                                      const RawAddress& address);
extern bool remove_unconditional(const RawAddress& address);
extern bool remove_unconditional_from_shim(const RawAddress& address);

extern void reset(bool after_reset);

+5 −0
Original line number Diff line number Diff line
@@ -69,6 +69,11 @@ bool connection_manager::remove_unconditional(const RawAddress& address) {
  mock_function_count_map[__func__]++;
  return false;
}
bool connection_manager::remove_unconditional_from_shim(
    const RawAddress& address) {
  mock_function_count_map[__func__]++;
  return false;
}
std::set<tAPP_ID> connection_manager::get_apps_connecting_to(
    const RawAddress& address) {
  mock_function_count_map[__func__]++;