VolumeShaper: improve logging and dumpsys
Test: CTS and dumpsys
Bug: 37536598
Change-Id: I9a838a8605defde3aaf42a872e48f01425df0f0e
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 5e07e3b..5480513 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -489,7 +489,7 @@
/*static*/ void AudioFlinger::PlaybackThread::Track::appendDumpHeader(String8& result)
{
result.append(" Name Active Client Type Fmt Chn mask Session fCount S F SRate "
- "L dB R dB Server Main buf Aux buf Flags UndFrmCnt Flushed\n");
+ "L dB R dB VS dB Server Main buf Aux buf Flags UndFrmCnt Flushed\n");
}
void AudioFlinger::PlaybackThread::Track::dump(char* buffer, size_t size, bool active)
@@ -555,8 +555,11 @@
nowInUnderrun = '?';
break;
}
- snprintf(&buffer[8], size-8, " %6s %6u %4u %08X %08X %7u %6zu %1c %1d %5u %5.2g %5.2g "
- "%08X %08zX %08zX 0x%03X %9u%c %7u\n",
+
+ std::pair<float /* volume */, bool /* active */> vsVolume = mVolumeHandler->getLastVolume();
+ snprintf(&buffer[8], size - 8, " %6s %6u %4u %08X %08X %7u %6zu %1c %1d %5u "
+ "%5.2g %5.2g %5.2g%c "
+ "%08X %08zX %08zX 0x%03X %9u%c %7u\n",
active ? "yes" : "no",
(mClient == 0) ? getpid_cached : mClient->pid(),
mStreamType,
@@ -569,6 +572,8 @@
mAudioTrackServerProxy->getSampleRate(),
20.0 * log10(float_from_gain(gain_minifloat_unpack_left(vlr))),
20.0 * log10(float_from_gain(gain_minifloat_unpack_right(vlr))),
+ 20.0 * log10(vsVolume.first), // VolumeShaper(s) total volume
+ vsVolume.second ? 'A' : ' ', // if any VolumeShapers active
mCblk->mServer,
(size_t)mMainBuffer, // use %zX as %p appends 0x
(size_t)mAuxBuffer, // use %zX as %p appends 0x