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/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 9386a42..be2f687 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -602,7 +602,8 @@
     }
 
     // Once this item is logged by the server, the client can add properties.
-    mTrackMetrics.logConstructor(creatorPid, uid, streamType);
+    const char * const traits = sharedBuffer == 0 ? "" : "static";
+    mTrackMetrics.logConstructor(creatorPid, uid, traits, streamType);
 }
 
 AudioFlinger::PlaybackThread::Track::~Track()