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

Commit 1e3a86cf authored by Chris Manton's avatar Chris Manton
Browse files

gd_acl: Resolve address after connection

Bug: 171568335
Tag: #refactor
Test: acts/bin/act.py -tp ~/Goog/tools/test/connectivity -tc BleCocTest
Test: atest --host bluetooth_test_gd

Change-Id: I0cabfa9cbe894d754269591c64292d6ed412d7a3
parent 774a56ea
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ void btm_ble_advertiser_notify_terminated_legacy(uint8_t status,
                                                 uint16_t connection_handle);
void btm_ble_increment_link_topology_mask(uint8_t link_role);

bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type);

static bool acl_ble_common_connection(const tBLE_BD_ADDR& address_with_type,
                                      uint16_t handle, uint8_t role,
                                      bool is_in_security_db,
@@ -106,15 +108,29 @@ void acl_ble_enhanced_connection_complete(
    btm_ble_advertiser_notify_terminated_legacy(HCI_SUCCESS, handle);
}

static bool maybe_resolve_received_address(
    const tBLE_BD_ADDR& address_with_type,
    tBLE_BD_ADDR* resolved_address_with_type) {
  ASSERT(resolved_address_with_type != nullptr);

  *resolved_address_with_type = address_with_type;
  return maybe_resolve_address(&resolved_address_with_type->bda,
                               &resolved_address_with_type->type);
}

void acl_ble_enhanced_connection_complete_from_shim(
    const tBLE_BD_ADDR& address_with_type, uint16_t handle, uint8_t role,
    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) {
  bool match = false;  // TODO look up in database
  acl_ble_enhanced_connection_complete(
      address_with_type, handle, role, match, conn_interval, conn_latency,
      conn_timeout, local_rpa, peer_rpa, peer_addr_type);
  tBLE_BD_ADDR resolved_address_with_type;
  const bool is_in_security_db = maybe_resolve_received_address(
      address_with_type, &resolved_address_with_type);

  acl_ble_enhanced_connection_complete(resolved_address_with_type, handle, role,
                                       is_in_security_db, conn_interval,
                                       conn_latency, conn_timeout, local_rpa,
                                       peer_rpa, peer_addr_type);

  // The legacy stack continues the LE connection after the read remote version
  // complete has been received.
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ void btm_ble_create_ll_conn_complete(uint8_t status) {
  }
}

static bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) {
bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) {
  bool is_in_security_db = false;
  tBLE_ADDR_TYPE peer_addr_type = *bda_type;
  bool addr_is_rpa =