Loading system/gd/metrics/chromeos/metrics.cc +25 −0 Original line number Diff line number Diff line Loading @@ -309,5 +309,30 @@ void LogMetricsSuspendIdState(uint32_t state) { .Record(); } void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state) { int64_t ll_privacy_state = 0; int64_t addr_privacy_state = 0; int64_t boot_time; std::string boot_id; if (!GetBootId(&boot_id)) { return; } boot_time = bluetooth::common::time_get_os_boottime_us(); ll_privacy_state = (int64_t)ToLLPrivacyState(llp_state); addr_privacy_state = (int64_t)ToAddressPrivacyState(rpa_state); log::debug("LLPrivacyState: {}, {}, {}, {}", boot_id, boot_time, ll_privacy_state, addr_privacy_state); ::metrics::structured::events::bluetooth::BluetoothLLPrivacyState() .SetBootId(boot_id) .SetSystemTime(boot_time) .SetLLPrivacyState(ll_privacy_state) .SetAddressPrivacyState(addr_privacy_state) .Record(); } } // namespace metrics } // namespace bluetooth system/gd/metrics/chromeos/metrics_event.cc +8 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,14 @@ SuspendIdState ToSuspendIdState(uint32_t state) { return state == 1 ? SuspendIdState::Recorded : SuspendIdState::NoRecord; } LLPrivacyState ToLLPrivacyState(uint32_t state) { return state == 1 ? LLPrivacyState::Enabled : LLPrivacyState::Disabled; } AddressPrivacyState ToAddressPrivacyState(uint32_t state) { return state == 1 ? AddressPrivacyState::Enabled : AddressPrivacyState::Disabled; } ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type) { // A map stores the pending ConnectionType used to match a pairing event with unknown type. // map<address, type> Loading system/gd/metrics/chromeos/metrics_event.h +14 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,14 @@ enum class MetricTransportType { // BluetoothSuspendIdStateChanged/SuspendIdState. enum class SuspendIdState : int64_t { NoRecord = 0, Recorded = 1 }; // ENUM definition for LL Privacy that in sync with ChromeOS structured metrics // BluetoothLLPrivacyState/LLPrivacyState. enum class LLPrivacyState : int64_t { Disabled = 0, Enabled = 1 }; // ENUM definition for Host RPA that in sync with ChromeOS structured metrics // BluetoothLLPrivacyState/AddressPrivacyState. enum class AddressPrivacyState : int64_t { Disabled = 0, Enabled = 1 }; // A struct holds the parsed profile connection event. struct ProfileConnectionEvent { int64_t type; Loading @@ -215,6 +223,12 @@ AdapterState ToAdapterState(uint32_t state); // Convert to SuspendIdState. SuspendIdState ToSuspendIdState(uint32_t state); // Convert to LLPrivacyState. LLPrivacyState ToLLPrivacyState(uint32_t state); // Convert to AddressPrivacyState. AddressPrivacyState ToAddressPrivacyState(uint32_t state); // Convert topshim::btif::BtDeviceType to ConnectionType ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type); Loading system/gd/metrics/linux/metrics.cc +2 −0 Original line number Diff line number Diff line Loading @@ -44,5 +44,7 @@ void LogMetricsChipsetInfoReport() {} void LogMetricsSuspendIdState(uint32_t state) {} void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state) {} } // namespace metrics } // namespace bluetooth system/gd/metrics/metrics.h +2 −0 Original line number Diff line number Diff line Loading @@ -39,5 +39,7 @@ void LogMetricsChipsetInfoReport(); void LogMetricsSuspendIdState(uint32_t state); void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state); } // namespace metrics } // namespace bluetooth Loading
system/gd/metrics/chromeos/metrics.cc +25 −0 Original line number Diff line number Diff line Loading @@ -309,5 +309,30 @@ void LogMetricsSuspendIdState(uint32_t state) { .Record(); } void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state) { int64_t ll_privacy_state = 0; int64_t addr_privacy_state = 0; int64_t boot_time; std::string boot_id; if (!GetBootId(&boot_id)) { return; } boot_time = bluetooth::common::time_get_os_boottime_us(); ll_privacy_state = (int64_t)ToLLPrivacyState(llp_state); addr_privacy_state = (int64_t)ToAddressPrivacyState(rpa_state); log::debug("LLPrivacyState: {}, {}, {}, {}", boot_id, boot_time, ll_privacy_state, addr_privacy_state); ::metrics::structured::events::bluetooth::BluetoothLLPrivacyState() .SetBootId(boot_id) .SetSystemTime(boot_time) .SetLLPrivacyState(ll_privacy_state) .SetAddressPrivacyState(addr_privacy_state) .Record(); } } // namespace metrics } // namespace bluetooth
system/gd/metrics/chromeos/metrics_event.cc +8 −0 Original line number Diff line number Diff line Loading @@ -243,6 +243,14 @@ SuspendIdState ToSuspendIdState(uint32_t state) { return state == 1 ? SuspendIdState::Recorded : SuspendIdState::NoRecord; } LLPrivacyState ToLLPrivacyState(uint32_t state) { return state == 1 ? LLPrivacyState::Enabled : LLPrivacyState::Disabled; } AddressPrivacyState ToAddressPrivacyState(uint32_t state) { return state == 1 ? AddressPrivacyState::Enabled : AddressPrivacyState::Disabled; } ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type) { // A map stores the pending ConnectionType used to match a pairing event with unknown type. // map<address, type> Loading
system/gd/metrics/chromeos/metrics_event.h +14 −0 Original line number Diff line number Diff line Loading @@ -202,6 +202,14 @@ enum class MetricTransportType { // BluetoothSuspendIdStateChanged/SuspendIdState. enum class SuspendIdState : int64_t { NoRecord = 0, Recorded = 1 }; // ENUM definition for LL Privacy that in sync with ChromeOS structured metrics // BluetoothLLPrivacyState/LLPrivacyState. enum class LLPrivacyState : int64_t { Disabled = 0, Enabled = 1 }; // ENUM definition for Host RPA that in sync with ChromeOS structured metrics // BluetoothLLPrivacyState/AddressPrivacyState. enum class AddressPrivacyState : int64_t { Disabled = 0, Enabled = 1 }; // A struct holds the parsed profile connection event. struct ProfileConnectionEvent { int64_t type; Loading @@ -215,6 +223,12 @@ AdapterState ToAdapterState(uint32_t state); // Convert to SuspendIdState. SuspendIdState ToSuspendIdState(uint32_t state); // Convert to LLPrivacyState. LLPrivacyState ToLLPrivacyState(uint32_t state); // Convert to AddressPrivacyState. AddressPrivacyState ToAddressPrivacyState(uint32_t state); // Convert topshim::btif::BtDeviceType to ConnectionType ConnectionType ToPairingDeviceType(std::string addr, uint32_t device_type); Loading
system/gd/metrics/linux/metrics.cc +2 −0 Original line number Diff line number Diff line Loading @@ -44,5 +44,7 @@ void LogMetricsChipsetInfoReport() {} void LogMetricsSuspendIdState(uint32_t state) {} void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state) {} } // namespace metrics } // namespace bluetooth
system/gd/metrics/metrics.h +2 −0 Original line number Diff line number Diff line Loading @@ -39,5 +39,7 @@ void LogMetricsChipsetInfoReport(); void LogMetricsSuspendIdState(uint32_t state); void LogMetricsLLPrivacyState(uint32_t llp_state, uint32_t rpa_state); } // namespace metrics } // namespace bluetooth