aaudio: add MediaMetrics for MMAP streams
Log events from service.
Log start, stop, disconnect and other events.
Log underruns and bufferSize.
Bug: 154543374
Test: adb shell dumpsys media.metrics --clear
Test: run an app that uses MMAP, like OboeTester
Test: adb shell dumpsys media.metrics
Test: Expect to see lots of "audio.stream" events.
Change-Id: I690e5226b695d53d038d644f4438c759e08f9fbb
diff --git a/services/oboeservice/AAudioServiceStreamBase.h b/services/oboeservice/AAudioServiceStreamBase.h
index aaab567..79dd738 100644
--- a/services/oboeservice/AAudioServiceStreamBase.h
+++ b/services/oboeservice/AAudioServiceStreamBase.h
@@ -68,12 +68,15 @@
// does not include EOL
virtual std::string dump() const;
- // -------------------------------------------------------------------
/**
* Open the device.
*/
virtual aaudio_result_t open(const aaudio::AAudioStreamRequest &request) = 0;
+ // We log the CLOSE from the close() method. We needed this separate method to log the OPEN
+ // because we had to wait until we generated the handle.
+ void logOpen(aaudio_handle_t streamHandle);
+
virtual aaudio_result_t close();
/**
@@ -312,6 +315,8 @@
android::sp<AAudioServiceEndpoint> mServiceEndpoint;
android::wp<AAudioServiceEndpoint> mServiceEndpointWeak;
+ std::string mMetricsId; // set once during open()
+
private:
/**