audio policy: fix absolute volume mute
The gain applied to the leading use case whne absolute volume
is used must not be max if the stream is muted.
Test: repro steps in bug
Flag: com.android.media.audio.abs_volume_index_fix
Bug: 349244832
Change-Id: Ie099eaa809101eda70f27a3600ce9746bf3bfb6d
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 7d2dfbc..3a65376 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -8171,7 +8171,7 @@
VolumeSource vsToDriveAbs = toVolumeSource(groupToDriveAbs);
if (vsToDriveAbs == volumeSource) {
// attenuation is applied by the abs volume controller
- return volumeDbMax;
+ return (index != 0) ? volumeDbMax : volumeDb;
} else {
IVolumeCurves &curvesAbs = getVolumeCurves(vsToDriveAbs);
int indexAbs = curvesAbs.getVolumeIndex({volumeDevice});