Use proper resolved address upon connection fail or timeout
Also add LOG_ERROR for error path
Bug: 235552757
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines
Ignore-AOSP-First: Cherry-pick
Merged-In: I5086ad669df914cfbe3f2a0f7c5e3100c6aaee7a
Change-Id: I5086ad669df914cfbe3f2a0f7c5e3100c6aaee7a
(cherry picked from commit 476f0434cbbfea9c3b0ebb3488fcf8c830d01801)
Merged-In: I5086ad669df914cfbe3f2a0f7c5e3100c6aaee7a
diff --git a/system/stack/acl/ble_acl.cc b/system/stack/acl/ble_acl.cc
index 08b7448..18759f9 100644
--- a/system/stack/acl/ble_acl.cc
+++ b/system/stack/acl/ble_acl.cc
@@ -147,8 +147,15 @@
if (status != HCI_ERR_ADVERTISING_TIMEOUT) {
btm_cb.ble_ctr_cb.set_connection_state_idle();
btm_ble_clear_topology_mask(BTM_BLE_STATE_INIT_BIT);
+ tBLE_BD_ADDR resolved_address_with_type;
+ maybe_resolve_received_address(address_with_type,
+ &resolved_address_with_type);
connection_manager::on_connection_timed_out_from_shim(
- address_with_type.bda);
+ resolved_address_with_type.bda);
+ LOG_WARN("LE connection fail peer:%s bd_addr:%s hci_status:%s",
+ PRIVATE_ADDRESS(address_with_type),
+ PRIVATE_ADDRESS(resolved_address_with_type.bda),
+ hci_status_code_text(status).c_str());
} else {
btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE;
}
diff --git a/system/stack/gatt/gatt_utils.cc b/system/stack/gatt/gatt_utils.cc
index 661fc6f..1311500 100644
--- a/system/stack/gatt/gatt_utils.cc
+++ b/system/stack/gatt/gatt_utils.cc
@@ -1567,7 +1567,13 @@
VLOG(1) << __func__;
tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(bda, transport);
- if (!p_tcb) return;
+ if (!p_tcb) {
+ LOG_ERROR(
+ "Disconnect for unknown connection bd_addr:%s reason:%s transport:%s",
+ PRIVATE_ADDRESS(bda), gatt_disconnection_reason_text(reason).c_str(),
+ bt_transport_text(transport).c_str());
+ return;
+ }
gatt_set_ch_state(p_tcb, GATT_CH_CLOSE);
for (uint8_t i = 0; i < GATT_CL_MAX_LCB; i++) {