Loading system/common/metrics.cc +7 −10 Original line number Diff line number Diff line Loading @@ -757,9 +757,8 @@ void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd, } } void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code) { void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t event_value) { std::string obfuscated_id; if (!address.IsEmpty()) { obfuscated_id = AddressObfuscator::GetInstance()->Obfuscate(address); Loading @@ -768,14 +767,12 @@ void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, android::util::BytesField obfuscated_id_field( address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? 0 : obfuscated_id.size()); int ret = android::util::stats_write( android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, obfuscated_id_field, handle, hci_cmd, hci_event, cmd_status, reason_code); int ret = android::util::stats_write(android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, obfuscated_id_field, handle, hci_cmd, hci_event, cmd_status, reason_code, event_value); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for " << address << ", handle " << handle << ", hci_cmd " << loghex(hci_cmd) << ", hci_event " << loghex(hci_event) << ", cmd_status " << loghex(cmd_status) << ", reason " << loghex(reason_code) << ", error " << ret; LOG(WARNING) << __func__ << ": failed for " << address << ", handle " << handle << ", hci_cmd " << loghex(hci_cmd) << ", hci_event " << loghex(hci_event) << ", cmd_status " << loghex(cmd_status) << ", reason " << loghex(reason_code) << ", event_value " << event_value << ", error " << ret; } } Loading system/common/metrics.h +3 −3 Original line number Diff line number Diff line Loading @@ -421,10 +421,10 @@ void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd, * @param hci_event HCI event associated with this event * @param cmd_status Command status associated with this event * @param reason_code Reason code associated with this event * @param event_value A status value related to this specific event */ void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code); void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t event_value); /** * Logs when certain Bluetooth SDP attributes are discovered Loading system/stack/btu/btu_hcif.cc +27 −44 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ void btu_hcif_log_event_metrics(uint8_t evt_code, uint8_t* p_event) { uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN; uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN; uint16_t handle = bluetooth::common::kUnknownConnectionHandle; int64_t value = 0; RawAddress bda = RawAddress::kEmpty; switch (evt_code) { Loading @@ -154,31 +155,26 @@ void btu_hcif_log_event_metrics(uint8_t evt_code, uint8_t* p_event) { case HCI_KEYPRESS_NOTIFY_EVT: case HCI_REMOTE_OOB_DATA_REQUEST_EVT: STREAM_TO_BDADDR(bda, p_event); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_SIMPLE_PAIRING_COMPLETE_EVT: case HCI_RMT_NAME_REQUEST_COMP_EVT: STREAM_TO_UINT8(status, p_event); STREAM_TO_BDADDR(bda, p_event); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_AUTHENTICATION_COMP_EVT: STREAM_TO_UINT8(status, p_event); STREAM_TO_UINT16(handle, p_event); handle = HCID_GET_HANDLE(handle); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_ENCRYPTION_CHANGE_EVT: { uint8_t encryption_enabled; STREAM_TO_UINT8(status, p_event); STREAM_TO_UINT16(handle, p_event); STREAM_TO_UINT8(encryption_enabled, p_event); // Use reason field to store encryption enabled bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, encryption_enabled); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, encryption_enabled); break; } case HCI_CONNECTION_COMP_EVT: { Loading Loading @@ -644,53 +640,44 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, break; } case HCI_READ_LOCAL_OOB_DATA: bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_WRITE_SIMPLE_PAIRING_MODE: { uint8_t simple_pairing_mode; STREAM_TO_UINT8(simple_pairing_mode, p_cmd); // Use reason field to log simple pairing mode bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, simple_pairing_mode); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, simple_pairing_mode); break; } case HCI_WRITE_SECURE_CONNS_SUPPORT: { uint8_t secure_conn_host_support; STREAM_TO_UINT8(secure_conn_host_support, p_cmd); // Use reason field to log secure connection host support bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, secure_conn_host_support); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, secure_conn_host_support); break; } case HCI_AUTHENTICATION_REQUESTED: STREAM_TO_UINT16(handle, p_cmd); bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_SET_CONN_ENCRYPTION: { STREAM_TO_UINT16(handle, p_cmd); uint8_t encryption_enable; STREAM_TO_UINT8(encryption_enable, p_cmd); // Use reason field to log encryption enable bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, encryption_enable); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, encryption_enable); break; } case HCI_DELETE_STORED_LINK_KEY: { uint8_t delete_all_flag; STREAM_TO_BDADDR(bd_addr, p_cmd); STREAM_TO_UINT8(delete_all_flag, p_cmd); // Use reason field to log delete_all_flag bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, delete_all_flag); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, delete_all_flag); break; } case HCI_RMT_NAME_REQUEST: Loading @@ -705,16 +692,14 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, case HCI_REM_OOB_DATA_REQ_REPLY: case HCI_REM_OOB_DATA_REQ_NEG_REPLY: STREAM_TO_BDADDR(bd_addr, p_cmd); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_IO_CAP_REQ_NEG_REPLY: STREAM_TO_BDADDR(bd_addr, p_cmd); STREAM_TO_UINT8(reason, p_cmd); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, reason); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, reason, 0); break; } } Loading Loading @@ -803,9 +788,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, case HCI_WRITE_SIMPLE_PAIRING_MODE: case HCI_WRITE_SECURE_CONNS_SUPPORT: STREAM_TO_UINT8(status, p_return_params); bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason, 0); break; case HCI_LINK_KEY_REQUEST_REPLY: case HCI_LINK_KEY_REQUEST_NEG_REPLY: Loading @@ -819,9 +803,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, case HCI_REM_OOB_DATA_REQ_NEG_REPLY: STREAM_TO_UINT8(status, p_return_params); STREAM_TO_BDADDR(bd_addr, p_return_params); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason, 0); break; } } Loading Loading
system/common/metrics.cc +7 −10 Original line number Diff line number Diff line Loading @@ -757,9 +757,8 @@ void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd, } } void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code) { void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t event_value) { std::string obfuscated_id; if (!address.IsEmpty()) { obfuscated_id = AddressObfuscator::GetInstance()->Obfuscate(address); Loading @@ -768,14 +767,12 @@ void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, android::util::BytesField obfuscated_id_field( address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? 0 : obfuscated_id.size()); int ret = android::util::stats_write( android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, obfuscated_id_field, handle, hci_cmd, hci_event, cmd_status, reason_code); int ret = android::util::stats_write(android::util::BLUETOOTH_CLASSIC_PAIRING_EVENT_REPORTED, obfuscated_id_field, handle, hci_cmd, hci_event, cmd_status, reason_code, event_value); if (ret < 0) { LOG(WARNING) << __func__ << ": failed for " << address << ", handle " << handle << ", hci_cmd " << loghex(hci_cmd) << ", hci_event " << loghex(hci_event) << ", cmd_status " << loghex(cmd_status) << ", reason " << loghex(reason_code) << ", error " << ret; LOG(WARNING) << __func__ << ": failed for " << address << ", handle " << handle << ", hci_cmd " << loghex(hci_cmd) << ", hci_event " << loghex(hci_event) << ", cmd_status " << loghex(cmd_status) << ", reason " << loghex(reason_code) << ", event_value " << event_value << ", error " << ret; } } Loading
system/common/metrics.h +3 −3 Original line number Diff line number Diff line Loading @@ -421,10 +421,10 @@ void LogSmpPairingEvent(const RawAddress& address, uint8_t smp_cmd, * @param hci_event HCI event associated with this event * @param cmd_status Command status associated with this event * @param reason_code Reason code associated with this event * @param event_value A status value related to this specific event */ void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code); void LogClassicPairingEvent(const RawAddress& address, uint16_t handle, uint32_t hci_cmd, uint16_t hci_event, uint16_t cmd_status, uint16_t reason_code, int64_t event_value); /** * Logs when certain Bluetooth SDP attributes are discovered Loading
system/stack/btu/btu_hcif.cc +27 −44 Original line number Diff line number Diff line Loading @@ -141,6 +141,7 @@ void btu_hcif_log_event_metrics(uint8_t evt_code, uint8_t* p_event) { uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN; uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN; uint16_t handle = bluetooth::common::kUnknownConnectionHandle; int64_t value = 0; RawAddress bda = RawAddress::kEmpty; switch (evt_code) { Loading @@ -154,31 +155,26 @@ void btu_hcif_log_event_metrics(uint8_t evt_code, uint8_t* p_event) { case HCI_KEYPRESS_NOTIFY_EVT: case HCI_REMOTE_OOB_DATA_REQUEST_EVT: STREAM_TO_BDADDR(bda, p_event); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_SIMPLE_PAIRING_COMPLETE_EVT: case HCI_RMT_NAME_REQUEST_COMP_EVT: STREAM_TO_UINT8(status, p_event); STREAM_TO_BDADDR(bda, p_event); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_AUTHENTICATION_COMP_EVT: STREAM_TO_UINT8(status, p_event); STREAM_TO_UINT16(handle, p_event); handle = HCID_GET_HANDLE(handle); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, value); break; case HCI_ENCRYPTION_CHANGE_EVT: { uint8_t encryption_enabled; STREAM_TO_UINT8(status, p_event); STREAM_TO_UINT16(handle, p_event); STREAM_TO_UINT8(encryption_enabled, p_event); // Use reason field to store encryption enabled bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, encryption_enabled); bluetooth::common::LogClassicPairingEvent(bda, handle, cmd, evt_code, status, reason, encryption_enabled); break; } case HCI_CONNECTION_COMP_EVT: { Loading Loading @@ -644,53 +640,44 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, break; } case HCI_READ_LOCAL_OOB_DATA: bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_WRITE_SIMPLE_PAIRING_MODE: { uint8_t simple_pairing_mode; STREAM_TO_UINT8(simple_pairing_mode, p_cmd); // Use reason field to log simple pairing mode bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, simple_pairing_mode); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, simple_pairing_mode); break; } case HCI_WRITE_SECURE_CONNS_SUPPORT: { uint8_t secure_conn_host_support; STREAM_TO_UINT8(secure_conn_host_support, p_cmd); // Use reason field to log secure connection host support bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, secure_conn_host_support); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, secure_conn_host_support); break; } case HCI_AUTHENTICATION_REQUESTED: STREAM_TO_UINT16(handle, p_cmd); bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_SET_CONN_ENCRYPTION: { STREAM_TO_UINT16(handle, p_cmd); uint8_t encryption_enable; STREAM_TO_UINT8(encryption_enable, p_cmd); // Use reason field to log encryption enable bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, encryption_enable); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, handle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, encryption_enable); break; } case HCI_DELETE_STORED_LINK_KEY: { uint8_t delete_all_flag; STREAM_TO_BDADDR(bd_addr, p_cmd); STREAM_TO_UINT8(delete_all_flag, p_cmd); // Use reason field to log delete_all_flag bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, delete_all_flag); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, delete_all_flag); break; } case HCI_RMT_NAME_REQUEST: Loading @@ -705,16 +692,14 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, case HCI_REM_OOB_DATA_REQ_REPLY: case HCI_REM_OOB_DATA_REQ_NEG_REPLY: STREAM_TO_BDADDR(bd_addr, p_cmd); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0); break; case HCI_IO_CAP_REQ_NEG_REPLY: STREAM_TO_BDADDR(bd_addr, p_cmd); STREAM_TO_UINT8(reason, p_cmd); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, reason); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status, reason, 0); break; } } Loading Loading @@ -803,9 +788,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, case HCI_WRITE_SIMPLE_PAIRING_MODE: case HCI_WRITE_SECURE_CONNS_SUPPORT: STREAM_TO_UINT8(status, p_return_params); bluetooth::common::LogClassicPairingEvent( RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason); bluetooth::common::LogClassicPairingEvent(RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason, 0); break; case HCI_LINK_KEY_REQUEST_REPLY: case HCI_LINK_KEY_REQUEST_NEG_REPLY: Loading @@ -819,9 +803,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, case HCI_REM_OOB_DATA_REQ_NEG_REPLY: STREAM_TO_UINT8(status, p_return_params); STREAM_TO_BDADDR(bd_addr, p_return_params); bluetooth::common::LogClassicPairingEvent( bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason); bluetooth::common::LogClassicPairingEvent(bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, status, reason, 0); break; } } Loading