Loading system/common/metrics.cc +22 −0 Original line number Original line Diff line number Diff line Loading @@ -597,6 +597,28 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, } } } } void LogHciTimeoutEvent(uint32_t hci_cmd) { int ret = android::util::stats_write(android::util::BLUETOOTH_HCI_TIMEOUT_REPORTED, static_cast<int64_t>(hci_cmd)); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for opcode " << loghex(hci_cmd) << ", error " << ret; } } void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version, uint16_t manufacturer_name, uint16_t subversion) { int ret = android::util::stats_write( android::util::BLUETOOTH_REMOTE_VERSION_INFO_REPORTED, handle, status, version, manufacturer_name, subversion); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for handle " << handle << ", status " << loghex(status) << ", version " << loghex(version) << ", manufacturer_name " << loghex(manufacturer_name) << ", subversion " << loghex(subversion) << ", error " << ret; } } } // namespace common } // namespace common } // namespace bluetooth } // namespace bluetooth system/common/metrics.h +24 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,30 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, uint32_t hci_event, uint32_t hci_ble_event, uint32_t hci_event, uint32_t hci_ble_event, uint32_t cmd_status, uint32_t reason_code); uint32_t cmd_status, uint32_t reason_code); /** * Logs when Bluetooth controller failed to reply with command status within * a timeout period after receiving an HCI command from the host * * @param hci_cmd opcode of HCI command that caused this timeout */ void LogHciTimeoutEvent(uint32_t hci_cmd); /** * Logs when we receive Bluetooth Read Remote Version Information Complete * Event from the remote device, as documented by the Bluetooth Core HCI * specification * * Reference: 5.0 Core Specification, Vol 2, Part E, Page 1118 * * @param handle handle of associated ACL connection * @param status HCI command status of this event * @param version version code from read remote version complete event * @param manufacturer_name manufacturer code from read remote version complete * event * @param subversion subversion code from read remote version complete event */ void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version, uint16_t manufacturer_name, uint16_t subversion); } // namespace common } // namespace common } // namespace bluetooth } // namespace bluetooth system/hci/src/hci_layer.cc +4 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <base/run_loop.h> #include <base/run_loop.h> #include <base/sequenced_task_runner.h> #include <base/sequenced_task_runner.h> #include <base/threading/thread.h> #include <base/threading/thread.h> #include <frameworks/base/core/proto/android/bluetooth/hci/enums.pb.h> #include <signal.h> #include <signal.h> #include <string.h> #include <string.h> Loading @@ -38,6 +39,7 @@ #include "btsnoop.h" #include "btsnoop.h" #include "buffer_allocator.h" #include "buffer_allocator.h" #include "common/message_loop_thread.h" #include "common/message_loop_thread.h" #include "common/metrics.h" #include "hci_inject.h" #include "hci_inject.h" #include "hci_internals.h" #include "hci_internals.h" #include "hcidefs.h" #include "hcidefs.h" Loading Loading @@ -481,6 +483,7 @@ static void command_timed_out_log_info(void* original_wait_entry) { } } LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); bluetooth::common::LogHciTimeoutEvent(wait_entry->opcode); } } } } Loading @@ -493,6 +496,7 @@ static void command_timed_out(void* original_wait_entry) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); bluetooth::common::LogHciTimeoutEvent(android::bluetooth::hci::CMD_UNKNOWN); } else { } else { command_timed_out_log_info(original_wait_entry); command_timed_out_log_info(original_wait_entry); lock.unlock(); lock.unlock(); Loading system/stack/btm/btm_acl.cc +6 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "btm_api.h" #include "btm_api.h" #include "btm_int.h" #include "btm_int.h" #include "btu.h" #include "btu.h" #include "common/metrics.h" #include "device/include/controller.h" #include "device/include/controller.h" #include "device/include/interop.h" #include "device/include/interop.h" #include "hcidefs.h" #include "hcidefs.h" Loading Loading @@ -888,6 +889,11 @@ void btm_read_remote_version_complete(uint8_t* p) { if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { btm_read_remote_features(p_acl_cb->hci_handle); btm_read_remote_features(p_acl_cb->hci_handle); } } bluetooth::common::LogRemoteVersionInfo( handle, status, p_acl_cb->lmp_version, p_acl_cb->manufacturer, p_acl_cb->lmp_subversion); } else { bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0); } } if (p_acl_cb->transport == BT_TRANSPORT_LE) { if (p_acl_cb->transport == BT_TRANSPORT_LE) { Loading Loading
system/common/metrics.cc +22 −0 Original line number Original line Diff line number Diff line Loading @@ -597,6 +597,28 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, } } } } void LogHciTimeoutEvent(uint32_t hci_cmd) { int ret = android::util::stats_write(android::util::BLUETOOTH_HCI_TIMEOUT_REPORTED, static_cast<int64_t>(hci_cmd)); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for opcode " << loghex(hci_cmd) << ", error " << ret; } } void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version, uint16_t manufacturer_name, uint16_t subversion) { int ret = android::util::stats_write( android::util::BLUETOOTH_REMOTE_VERSION_INFO_REPORTED, handle, status, version, manufacturer_name, subversion); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for handle " << handle << ", status " << loghex(status) << ", version " << loghex(version) << ", manufacturer_name " << loghex(manufacturer_name) << ", subversion " << loghex(subversion) << ", error " << ret; } } } // namespace common } // namespace common } // namespace bluetooth } // namespace bluetooth
system/common/metrics.h +24 −0 Original line number Original line Diff line number Diff line Loading @@ -304,6 +304,30 @@ void LogLinkLayerConnectionEvent(const RawAddress* address, uint32_t hci_event, uint32_t hci_ble_event, uint32_t hci_event, uint32_t hci_ble_event, uint32_t cmd_status, uint32_t reason_code); uint32_t cmd_status, uint32_t reason_code); /** * Logs when Bluetooth controller failed to reply with command status within * a timeout period after receiving an HCI command from the host * * @param hci_cmd opcode of HCI command that caused this timeout */ void LogHciTimeoutEvent(uint32_t hci_cmd); /** * Logs when we receive Bluetooth Read Remote Version Information Complete * Event from the remote device, as documented by the Bluetooth Core HCI * specification * * Reference: 5.0 Core Specification, Vol 2, Part E, Page 1118 * * @param handle handle of associated ACL connection * @param status HCI command status of this event * @param version version code from read remote version complete event * @param manufacturer_name manufacturer code from read remote version complete * event * @param subversion subversion code from read remote version complete event */ void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version, uint16_t manufacturer_name, uint16_t subversion); } // namespace common } // namespace common } // namespace bluetooth } // namespace bluetooth
system/hci/src/hci_layer.cc +4 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <base/run_loop.h> #include <base/run_loop.h> #include <base/sequenced_task_runner.h> #include <base/sequenced_task_runner.h> #include <base/threading/thread.h> #include <base/threading/thread.h> #include <frameworks/base/core/proto/android/bluetooth/hci/enums.pb.h> #include <signal.h> #include <signal.h> #include <string.h> #include <string.h> Loading @@ -38,6 +39,7 @@ #include "btsnoop.h" #include "btsnoop.h" #include "buffer_allocator.h" #include "buffer_allocator.h" #include "common/message_loop_thread.h" #include "common/message_loop_thread.h" #include "common/metrics.h" #include "hci_inject.h" #include "hci_inject.h" #include "hci_internals.h" #include "hci_internals.h" #include "hcidefs.h" #include "hcidefs.h" Loading Loading @@ -481,6 +483,7 @@ static void command_timed_out_log_info(void* original_wait_entry) { } } LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, wait_entry->opcode); bluetooth::common::LogHciTimeoutEvent(wait_entry->opcode); } } } } Loading @@ -493,6 +496,7 @@ static void command_timed_out(void* original_wait_entry) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { COMMAND_PENDING_MUTEX_ACQUIRE_TIMEOUT_MS))) { LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_ERROR(LOG_TAG, "%s: Cannot obtain the mutex", __func__); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); LOG_EVENT_INT(BT_HCI_TIMEOUT_TAG_NUM, HCI_UNKNOWN_COMMAND_TIMED_OUT); bluetooth::common::LogHciTimeoutEvent(android::bluetooth::hci::CMD_UNKNOWN); } else { } else { command_timed_out_log_info(original_wait_entry); command_timed_out_log_info(original_wait_entry); lock.unlock(); lock.unlock(); Loading
system/stack/btm/btm_acl.cc +6 −0 Original line number Original line Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include "btm_api.h" #include "btm_api.h" #include "btm_int.h" #include "btm_int.h" #include "btu.h" #include "btu.h" #include "common/metrics.h" #include "device/include/controller.h" #include "device/include/controller.h" #include "device/include/interop.h" #include "device/include/interop.h" #include "hcidefs.h" #include "hcidefs.h" Loading Loading @@ -888,6 +889,11 @@ void btm_read_remote_version_complete(uint8_t* p) { if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR) { btm_read_remote_features(p_acl_cb->hci_handle); btm_read_remote_features(p_acl_cb->hci_handle); } } bluetooth::common::LogRemoteVersionInfo( handle, status, p_acl_cb->lmp_version, p_acl_cb->manufacturer, p_acl_cb->lmp_subversion); } else { bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0); } } if (p_acl_cb->transport == BT_TRANSPORT_LE) { if (p_acl_cb->transport == BT_TRANSPORT_LE) { Loading