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

Commit 9af88688 authored by Hui Peng's avatar Hui Peng
Browse files

[Invisalign2] use btm_find_or_alloc_dev in btm_ble_connected

Bug: 301661850
Test: m com.android.btservices

Change-Id: I2741b5cbac9af0ff5aa4bb1c6b7f62c4388d325e
parent 37fa1a33
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -1496,19 +1496,11 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode,
                       uint8_t role, tBLE_ADDR_TYPE addr_type,
                       bool addr_matched,
                       bool can_read_discoverable_characteristics) {
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
  if (!p_dev_rec) {
    LOG_INFO("Creating new device record for new ble connection");
    p_dev_rec = btm_sec_alloc_dev(bda);
    if (p_dev_rec == nullptr) {
      LOG_WARN("Unable to create device record for new ble connection");
      return;
    }
  } else {
    LOG_INFO("Updating device record timestamp for existing ble connection");
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_or_alloc_dev(bda);

  LOG_INFO("Updating device record timestamp for the ble connection");
  // TODO() Why is timestamp a counter ?
  p_dev_rec->timestamp = btm_sec_cb.dev_rec_count++;
  }

  if (is_ble_addr_type_known(addr_type))
    p_dev_rec->ble.SetAddressType(addr_type);