audioflinger: add setCallerName() to AudioTrack
And also to AudioRecord.
Then log the callerName using MediaMetrics from the destructor.
This can be used to tell whether AAudio or OpenSL ES
or Java created the object.
Bug: 154543374
Test: adb shell dumpsys media.metrics --clear
Test: Run an app that uses audio.
Test: adb shell dumpsys media.metrics
Test: Look for "callerName" in the dump.
Change-Id: I000346e72f581d2e40ef4fd0410b579d2a1224e2
diff --git a/media/libaaudio/src/legacy/AudioStreamLegacy.h b/media/libaaudio/src/legacy/AudioStreamLegacy.h
index da9205f..cd5eb5a 100644
--- a/media/libaaudio/src/legacy/AudioStreamLegacy.h
+++ b/media/libaaudio/src/legacy/AudioStreamLegacy.h
@@ -128,6 +128,9 @@
return mFramesRead.increment(frames);
}
+ // This is used for exact matching by MediaMetrics. So do not change it.
+ static constexpr char kCallerName[] = "aaudio";
+
MonotonicCounter mFramesWritten;
MonotonicCounter mFramesRead;
MonotonicCounter mTimestampPosition;
@@ -139,6 +142,7 @@
const android::sp<StreamDeviceCallback> mDeviceCallback;
AtomicRequestor mRequestDisconnect;
+
};
} /* namespace aaudio */