Minor APM dump improvements
- print system usages as enum strings;
- indicate that the 'id' of the communication strategy is
printed;
- add accidentally removed "is soundtrigger" flag to
RecordClientDescriptor.
Bug: 205884982
Test: adb shell dumpsys media.audio_policy
Change-Id: Iccb847c971864e4781ccc92cbf078303ef35d51b
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 61e2af6..9b08044 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -585,13 +585,23 @@
snprintf(buffer, SIZE, "Command Thread: %p\n", mAudioCommandThread.get());
result.append(buffer);
- snprintf(buffer, SIZE, "Supported System Usages:\n");
+ snprintf(buffer, SIZE, "Supported System Usages:\n ");
result.append(buffer);
- for (std::vector<audio_usage_t>::iterator it = mSupportedSystemUsages.begin();
- it != mSupportedSystemUsages.end(); ++it) {
- snprintf(buffer, SIZE, "\t%d\n", *it);
- result.append(buffer);
+ std::stringstream msg;
+ size_t i = 0;
+ for (auto usage : mSupportedSystemUsages) {
+ if (i++ != 0) msg << ", ";
+ if (const char* strUsage = audio_usage_to_string(usage); strUsage) {
+ msg << strUsage;
+ } else {
+ msg << usage << " (unknown)";
+ }
}
+ if (i == 0) {
+ msg << "None";
+ }
+ msg << std::endl;
+ result.append(msg.str().c_str());
write(fd, result.string(), result.size());