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/AudioStreamTrack.cpp b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
index 2bdc26b..1120f05 100644
--- a/media/libaaudio/src/legacy/AudioStreamTrack.cpp
+++ b/media/libaaudio/src/legacy/AudioStreamTrack.cpp
@@ -173,6 +173,9 @@
selectedDeviceId
);
+ // Set it here so it can be logged by the destructor if the open failed.
+ mAudioTrack->setCallerName(kCallerName);
+
// Did we get a valid track?
status_t status = mAudioTrack->initCheck();
if (status != NO_ERROR) {