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

Commit 597b95bf authored by Michael Sun's avatar Michael Sun
Browse files

btif: Improve ACL connection failure reporting

This commit enhances the reporting of ACL connection failures by providing more specific error codes. Instead of always reporting `BT_STATUS_FAIL` when a link up fails, we now map the underlying HCI error code to a more informative `bt_status_t` value. This allows higher-level components to better understand the cause of the connection failure. E.g., Floss metrics system which tracks connection failure reasons.

Bug: 353527430
Test: mmm packages/modules/Bluetooth
Test: manually verified new error code are used
Flag: EXEMPT, error code refactoring, no logic change
Change-Id: Icafe9fd5032f732477beb9e680dc6b69cb0035a1
parent 98f51566
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2207,8 +2207,9 @@ void btif_dm_acl_evt(tBTA_DM_ACL_EVT event, tBTA_DM_ACL* p_data) {

    case BTA_DM_LINK_UP_FAILED_EVT:
      GetInterfaceToProfiles()->events->invoke_acl_state_changed_cb(
              BT_STATUS_FAIL, p_data->link_up_failed.bd_addr, BT_ACL_STATE_DISCONNECTED,
              p_data->link_up_failed.transport_link_type, p_data->link_up_failed.status,
              hci_error_to_bt_status(p_data->link_up_failed.status), p_data->link_up_failed.bd_addr,
              BT_ACL_STATE_DISCONNECTED, p_data->link_up_failed.transport_link_type,
              p_data->link_up_failed.status,
              btm_is_acl_locally_initiated() ? bt_conn_direction_t::BT_CONN_DIRECTION_OUTGOING
                                             : bt_conn_direction_t::BT_CONN_DIRECTION_INCOMING,
              INVALID_ACL_HANDLE);