diff options
author | 2019-02-06 21:53:41 -0800 | |
---|---|---|
committer | 2019-02-08 15:51:27 -0800 | |
commit | 9e02620e931c3aa5f9c6462eda0c3ce050e691cb (patch) | |
tree | ac2d428d4fbf1870d92f28676bc2b9894e0ffa74 /system/common/metrics.cc | |
parent | 7a98b40aca20bde252d941feba368ff096f20737 (diff) |
Metrics: Log manfuacturer information from Device ID profile to statsd
Bug: 112969790
Test: make, test drive with statsd
Change-Id: Ie22aaad07037f97017186ad1f1d9ad124e4756c0
Diffstat (limited to 'system/common/metrics.cc')
-rw-r--r-- | system/common/metrics.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/system/common/metrics.cc b/system/common/metrics.cc index f74234b3b9..cd58d0e579 100644 --- a/system/common/metrics.cc +++ b/system/common/metrics.cc @@ -827,6 +827,35 @@ void LogSocketConnectionState( } } +void LogManufacturerInfo(const RawAddress& address, + android::bluetooth::DeviceInfoSrcEnum source_type, + const std::string& source_name, + const std::string& manufacturer, + const std::string& model, + const std::string& hardware_version, + const std::string& software_version) { + 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_DEVICE_INFO_REPORTED, obfuscated_id_field, + source_type, source_name.c_str(), manufacturer.c_str(), model.c_str(), + hardware_version.c_str(), software_version.c_str()); + if (ret < 0) { + LOG(WARNING) << __func__ << ": failed for " << address << ", source_type " + << source_type << ", source_name " << source_name + << ", manufacturer " << manufacturer << ", model " << model + << ", hardware_version " << hardware_version + << ", software_version " << software_version << ", error " + << ret; + } +} + } // namespace common } // namespace bluetooth |