[Invisalign2] use btm_find_or_alloc_dev in btm_ble_connected
Bug: 301661850
Test: m com.android.btservices
Change-Id: I2741b5cbac9af0ff5aa4bb1c6b7f62c4388d325e
diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc
index cf20cbe..20b45a4 100644
--- a/system/stack/btm/btm_ble_sec.cc
+++ b/system/stack/btm/btm_ble_sec.cc
@@ -1496,19 +1496,11 @@
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");
- // TODO() Why is timestamp a counter ?
- p_dev_rec->timestamp = btm_sec_cb.dev_rec_count++;
- }
+ 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);