Loading system/gd/metrics/bluetooth_event.cc +22 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include "main/shim/helpers.h" #include "os/metrics.h" namespace bluetooth { Loading Loading @@ -48,6 +49,8 @@ State MapErrorCodeToState(ErrorCode reason) { return State::KEY_MISSING; case ErrorCode::PAIRING_NOT_ALLOWED: return State::PAIRING_NOT_ALLOWED; case ErrorCode::CONNECTION_REJECTED_LIMITED_RESOURCES: return State::RESOURCES_EXCEEDED; default: return State::STATE_UNKNOWN; } Loading @@ -60,5 +63,24 @@ void LogAclCompletionEvent(const hci::Address& address, ErrorCode reason, : EventType::ACL_CONNECTION_RESPONDER, MapErrorCodeToState(reason)); } void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status) { hci::Address address = bluetooth::ToGdAddress(raw_address); switch (status) { case BTM_SUCCESS: bluetooth::os::LogMetricBluetoothEvent(address, EventType::ACL_CONNECTION_INITIATOR, State::ALREADY_CONNECTED); break; case BTM_NO_RESOURCES: bluetooth::os::LogMetricBluetoothEvent( address, EventType::ACL_CONNECTION_INITIATOR, MapErrorCodeToState(ErrorCode::CONNECTION_REJECTED_LIMITED_RESOURCES)); break; default: break; } } } // namespace metrics } // namespace bluetooth system/gd/metrics/bluetooth_event.h +5 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include "hci/address.h" #include "hci/hci_packets.h" #include "stack/include/btm_status.h" #include "types/raw_address.h" namespace bluetooth { namespace metrics { Loading @@ -25,5 +27,8 @@ namespace metrics { void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason, bool is_locally_initiated); void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status); } // namespace metrics } // namespace bluetooth system/stack/btm/btm_sec.cc +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "main/shim/acl_api.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" #include "metrics/bluetooth_event.h" #include "osi/include/allocator.h" #include "osi/include/properties.h" #include "stack/btm/btm_ble_int.h" Loading Loading @@ -2318,6 +2319,7 @@ void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr, const uint8_ /* Both we and the peer are 2.1 - continue to create connection */ else { tBTM_STATUS req_status = btm_sec_dd_create_conn(p_dev_rec); bluetooth::metrics::LogAclAfterRemoteNameRequest(bd_addr, req_status); if (req_status == tBTM_STATUS::BTM_SUCCESS) { await_connection = false; } else if (req_status != BTM_CMD_STARTED) { Loading Loading
system/gd/metrics/bluetooth_event.cc +22 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include "main/shim/helpers.h" #include "os/metrics.h" namespace bluetooth { Loading Loading @@ -48,6 +49,8 @@ State MapErrorCodeToState(ErrorCode reason) { return State::KEY_MISSING; case ErrorCode::PAIRING_NOT_ALLOWED: return State::PAIRING_NOT_ALLOWED; case ErrorCode::CONNECTION_REJECTED_LIMITED_RESOURCES: return State::RESOURCES_EXCEEDED; default: return State::STATE_UNKNOWN; } Loading @@ -60,5 +63,24 @@ void LogAclCompletionEvent(const hci::Address& address, ErrorCode reason, : EventType::ACL_CONNECTION_RESPONDER, MapErrorCodeToState(reason)); } void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status) { hci::Address address = bluetooth::ToGdAddress(raw_address); switch (status) { case BTM_SUCCESS: bluetooth::os::LogMetricBluetoothEvent(address, EventType::ACL_CONNECTION_INITIATOR, State::ALREADY_CONNECTED); break; case BTM_NO_RESOURCES: bluetooth::os::LogMetricBluetoothEvent( address, EventType::ACL_CONNECTION_INITIATOR, MapErrorCodeToState(ErrorCode::CONNECTION_REJECTED_LIMITED_RESOURCES)); break; default: break; } } } // namespace metrics } // namespace bluetooth
system/gd/metrics/bluetooth_event.h +5 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include "hci/address.h" #include "hci/hci_packets.h" #include "stack/include/btm_status.h" #include "types/raw_address.h" namespace bluetooth { namespace metrics { Loading @@ -25,5 +27,8 @@ namespace metrics { void LogAclCompletionEvent(const hci::Address& address, hci::ErrorCode reason, bool is_locally_initiated); void LogAclAfterRemoteNameRequest(const RawAddress& raw_address, tBTM_STATUS status); } // namespace metrics } // namespace bluetooth
system/stack/btm/btm_sec.cc +2 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "main/shim/acl_api.h" #include "main/shim/entry.h" #include "main/shim/helpers.h" #include "metrics/bluetooth_event.h" #include "osi/include/allocator.h" #include "osi/include/properties.h" #include "stack/btm/btm_ble_int.h" Loading Loading @@ -2318,6 +2319,7 @@ void btm_sec_rmt_name_request_complete(const RawAddress* p_bd_addr, const uint8_ /* Both we and the peer are 2.1 - continue to create connection */ else { tBTM_STATUS req_status = btm_sec_dd_create_conn(p_dev_rec); bluetooth::metrics::LogAclAfterRemoteNameRequest(bd_addr, req_status); if (req_status == tBTM_STATUS::BTM_SUCCESS) { await_connection = false; } else if (req_status != BTM_CMD_STARTED) { Loading