}
}
-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);
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;
}
}
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) {
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: {
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:
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;
}
}
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:
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;
}
}