summaryrefslogtreecommitdiff
path: root/system/common/metrics.cc
diff options
context:
space:
mode:
Diffstat (limited to 'system/common/metrics.cc')
-rw-r--r--system/common/metrics.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/system/common/metrics.cc b/system/common/metrics.cc
index 1f6653861b..8355e03eb8 100644
--- a/system/common/metrics.cc
+++ b/system/common/metrics.cc
@@ -757,6 +757,28 @@ 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) {
+ std::string obfuscated_id;
+ if (!address.IsEmpty()) {
+ obfuscated_id = AddressObfuscator::GetInstance()->Obfuscate(address);
+ }
+ // nullptr and size 0 represent missing value for obfuscated_id
+ 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);
+ 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;
+ }
+}
+
} // namespace common
} // namespace bluetooth