Metrics: Add metrics item for profile usage
Item A: Add messages to log profile connections
* Add ProfileUsageStats message in bluetooth.proto
* Add BluetoothProfileId enum to represent each profile
* Add num_times_connected item to log how many times a profile is
connected
Item B: Add messages to log headset profile connections for HSP and HFP
* Add HeadsetProfileConnectionStats message in bluetooth.proto
* Add HeadsetProfileType enum to represent each headset profile type
* Add num_times_connected item to log how many times each headset
profile is connected
* Add unit tests in metrics_tests
* Remove "clear" flag in various metrics dumping methods to make sure
that we clean up metrics every time we dump
Bug: 77476285
Test: make, net_test_osi, BtFunhausMetricsTest,
adb shell dumpsys bluetooth_manager --proto-bin
Change-Id: Ib18948c50ddb98ab7472f7b51a9bb98d153071c7
Merged-In: Ib18948c50ddb98ab7472f7b51a9bb98d153071c7
diff --git a/osi/include/metrics.h b/osi/include/metrics.h
index c64fd4a..4f968d2 100644
--- a/osi/include/metrics.h
+++ b/osi/include/metrics.h
@@ -18,6 +18,7 @@
#pragma once
+#include <bta/include/bta_api.h>
#include <stdint.h>
#include <memory>
#include <string>
@@ -209,13 +210,20 @@
*/
void LogA2dpSession(const A2dpSessionMetrics& a2dp_session_metrics);
- /*
- * Writes the metrics, in base64 protobuf format, into the descriptor FD
- * If CLEAR is true, metrics events are cleared afterwards.
+ /**
+ * Log Headset profile RFCOMM connection event
+ *
+ * @param service_id the BTA service ID for this headset connection
*/
- void WriteBase64(int fd, bool clear);
- void WriteBase64String(std::string* serialized, bool clear);
- void WriteString(std::string* serialized, bool clear);
+ void LogHeadsetProfileRfcConnection(tBTA_SERVICE_ID service_id);
+
+ /*
+ * Writes the metrics, in base64 protobuf format, into the descriptor FD,
+ * metrics events are always cleared after dump
+ */
+ void WriteBase64(int fd);
+ void WriteBase64String(std::string* serialized);
+ void WriteString(std::string* serialized);
/*
* Reset the metrics logger by cleaning up its staging queues and existing