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

Commit 98d7636d authored by Chris Manton's avatar Chris Manton
Browse files

Streamline stack/btm/btm_ble_add::btm_identity_addr_to_random_pseudo

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I3bb822f62f5c60d5bb54e45d5c38246e9c9612ad
parent 3499ab83
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -254,24 +254,25 @@ bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr,
                                        uint8_t* p_addr_type, bool refresh) {
  tBTM_SEC_DEV_REC* p_dev_rec =
      btm_find_dev_by_identity_addr(*bd_addr, *p_addr_type);
  if (p_dev_rec == nullptr) {
    return false;
  }

  BTM_TRACE_EVENT("%s", __func__);
  /* evt reported on static address, map static address to random pseudo */
  if (p_dev_rec != NULL) {
  /* if RPA offloading is supported, or 4.2 controller, do RPA refresh */
  if (refresh &&
        controller_get_interface()->get_ble_resolving_list_max_size() != 0)
      controller_get_interface()->get_ble_resolving_list_max_size() != 0) {
    btm_ble_read_resolving_list_entry(p_dev_rec);
  }

  /* assign the original address to be the current report address */
    if (!btm_ble_init_pseudo_addr(p_dev_rec, *bd_addr))
  if (!btm_ble_init_pseudo_addr(p_dev_rec, *bd_addr)) {
    *bd_addr = p_dev_rec->ble.pseudo_addr;
  }

  *p_addr_type = p_dev_rec->ble.ble_addr_type;
  return true;
}
  return false;
}

bool btm_identity_addr_to_random_pseudo_from_address_with_type(
    tBLE_BD_ADDR* address_with_type, bool refresh) {