MediaMetrics: Prepare audio device usage protos for statsd
MediaMetricsAudioRecordDeviceUsageReported
MediaMetricsAudioThreadDeviceUsageReported
MediaMetricsAudioTrackDeviceUsageReported
MediaMetricsAudioDeviceConnectionReported
Add track traits to identify static AudioTracks.
Fix AudioTrack/AudioRecord flag communication.
Move debug logging to verbose (delivered protos show in dumpsys).
Unknown strings which fail validation become empty.
Test statsd type validation.
Test: atest mediametrics_tests
Test: adb shell dumpsys media.metrics (after BT connection)
Test: statsd_testdrive (294-297)
Bug: 149850236
Change-Id: I53c5d18a346af54941007b9938a8ab10e34b7038
diff --git a/services/audioflinger/TrackMetrics.h b/services/audioflinger/TrackMetrics.h
index 12bd341..af16448 100644
--- a/services/audioflinger/TrackMetrics.h
+++ b/services/audioflinger/TrackMetrics.h
@@ -68,6 +68,7 @@
}
void logConstructor(pid_t creatorPid, uid_t creatorUid,
+ const std::string& traits = {},
audio_stream_type_t streamType = AUDIO_STREAM_DEFAULT) const {
// Once this item is logged by the server, the client can add properties.
// no lock required, all local or const variables.
@@ -76,7 +77,8 @@
.setUid(creatorUid)
.set(AMEDIAMETRICS_PROP_ALLOWUID, (int32_t)creatorUid)
.set(AMEDIAMETRICS_PROP_EVENT,
- AMEDIAMETRICS_PROP_PREFIX_SERVER AMEDIAMETRICS_PROP_EVENT_VALUE_CTOR);
+ AMEDIAMETRICS_PROP_PREFIX_SERVER AMEDIAMETRICS_PROP_EVENT_VALUE_CTOR)
+ .set(AMEDIAMETRICS_PROP_TRAITS, traits);
// log streamType from the service, since client doesn't know chosen streamType.
if (streamType != AUDIO_STREAM_DEFAULT) {
item.set(AMEDIAMETRICS_PROP_STREAMTYPE, toString(streamType).c_str());