audio policy: rescale volume index in setStreamVolumeIndex
Fix a problem in setStreamVolumeIndex() introduced by commit dcd4ab18
where stream volumes where applied systematically when in call for
all streams regardless of streamsMatchForvolume().
Also add index rescaling as in theory two streams matching for volume
do not have necessarily the same index range.
Bug: 111194621
Test: repro steps in bug.
Change-Id: I713b35921d4df19b521fc98281636a9c17483998
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 136e522..8a0e2c3 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -353,6 +353,10 @@
int index,
audio_devices_t device);
+ // rescale volume index from srcStream within range of dstStream
+ int rescaleVolumeIndex(int srcIndex,
+ audio_stream_type_t srcStream,
+ audio_stream_type_t dstStream);
// check that volume change is permitted, compute and send new volume to audio hardware
virtual status_t checkAndSetVolume(audio_stream_type_t stream, int index,
const sp<AudioOutputDescriptor>& outputDesc,