audiopolicy: optimize set volume call sequence

This CL simplifies call flow to set volume from stream or attributes.
It also removes unused parameter from mute setter and fix a volume
source comparison.
Also refactor logic in setVolumeIndexForAttributes() by removing the
loop on all volume sources on a given output given it was ignoring all
sources not equal to current source anyway.

Bug: 124767636
Test: AudioPolicyTests --gtest_filter=StreamTypeVolumeTest.*
  AudioPolicyTests --gtest_filter=AttributeVolume/AttributeVolumeTest.*
  AudioPolicyTests --gtest_filter=AudioProductStrategiesPlaybackVolume/AudioProductStrategiesPlaybackVolumeTest.*

Change-Id: Id816de023e917b0c0e34bb0888c8b0ad29029f8b
Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.h b/services/audiopolicy/managerdefault/AudioPolicyManager.h
index 1fc61e5..1c98684 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.h
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.h
@@ -171,9 +171,6 @@
 
         virtual status_t getMinVolumeIndexForAttributes(const audio_attributes_t &attr, int &index);
 
-        status_t setVolumeGroupIndex(IVolumeCurves &volumeCurves, volume_group_t group, int index,
-                                     audio_devices_t device, const audio_attributes_t attributes);
-
         status_t setVolumeCurveIndex(int index,
                                      audio_devices_t device,
                                      IVolumeCurves &volumeCurves);
@@ -425,8 +422,8 @@
 
         // rescale volume index from srcStream within range of dstStream
         int rescaleVolumeIndex(int srcIndex,
-                               audio_stream_type_t srcStream,
-                               audio_stream_type_t dstStream);
+                               VolumeSource fromVolumeSource,
+                               VolumeSource toVolumeSource);
         // check that volume change is permitted, compute and send new volume to audio hardware
         virtual status_t checkAndSetVolume(IVolumeCurves &curves,
                                            VolumeSource volumeSource, int index,
@@ -461,14 +458,12 @@
          * @param outputDesc on which the client following the volume group shall be muted/umuted
          * @param delayMs
          * @param device
-         * @param activeOnly if true, mute only if the volume group is active on the output.
          */
         void setVolumeSourceMute(VolumeSource volumeSource,
                                  bool on,
                                  const sp<AudioOutputDescriptor>& outputDesc,
                                  int delayMs = 0,
-                                 audio_devices_t device = AUDIO_DEVICE_NONE,
-                                 bool activeOnly = false);
+                                 audio_devices_t device = AUDIO_DEVICE_NONE);
 
         audio_mode_t getPhoneState();