summaryrefslogtreecommitdiff
path: root/system/common/metrics.cc
diff options
context:
space:
mode:
author Jack He <siyuanh@google.com> 2019-02-01 18:30:21 -0800
committer Jack He <siyuanh@google.com> 2019-02-06 17:40:22 -0800
commit3c162a868dfb7795b40c1cebd3b7db59ead3f1ec (patch)
tree78c7c3b04e0edacfe48d3b0f4f78afc7e8580cde /system/common/metrics.cc
parent720ab5fcea35fa5f14b5947ad67d45df6a087228 (diff)
Metrics: Log SDP attributes to statsd
* Log ProtocolDescriptorList's protocol version field to statsd * Log BluetoothProfileDescriptorList's profile version field to statsd * Log SupportedFeatures for A2DP, HFP, AVRCP, PBAP, MAP to statsd * Log SDP metrics before we disconnect from L2CAP during SDP discovery * Values are logged in small endian array * Do this logging before we declare an SDP search is done Bug: 112969790 Test: make, test drive with statsd Change-Id: Idd340e495ecb85abc27de2b2d71305ee5218b43c
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 8355e03eb8..377476fc97 100644
--- a/system/common/metrics.cc
+++ b/system/common/metrics.cc
@@ -779,6 +779,28 @@ void LogClassicPairingEvent(const RawAddress& address, uint16_t handle,
}
}
+void LogSdpAttribute(const RawAddress& address, uint16_t protocol_uuid,
+ uint16_t attribute_id, size_t attribute_size,
+ const char* attribute_value) {
+ 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());
+ android::util::BytesField attribute_field(attribute_value, attribute_size);
+ int ret = android::util::stats_write(
+ android::util::BLUETOOTH_SDP_ATTRIBUTE_REPORTED, obfuscated_id_field,
+ protocol_uuid, attribute_id, attribute_field);
+ if (ret < 0) {
+ LOG(WARNING) << __func__ << ": failed for " << address << ", protocol_uuid "
+ << loghex(protocol_uuid) << ", attribute_id "
+ << loghex(attribute_id) << ", error " << ret;
+ }
+}
+
} // namespace common
} // namespace bluetooth