AudioPolicy: manager: force gain on startSource when using HW Gain

When a setVolume is called for a given volume source on a SwOutput,
and if the SwOutput is connected to a device using HW Gain, the sync
of the gain on AudioHAL is guarded by the activity of this volume source.

When a new index is applied on a given volume source, if this source is
not active, the new index is cached but is not synced on AudioHAL.

Hence, once a client (aka a source) starts on a SwOutput,
SwAudioOutputDescriptor::setVolume is called, but as index has not changed,
setVolume will bail out before applying the gain to the AudioHAL.

This CL forces to sync the volume upon startSource event if the SwOutput
involved is connected to a device with HW Gain enabled.

Test: build & basic audio tests.

Signed-off-by: Francois Gaffie <francois.gaffie@renault.com>
Change-Id: Ief1d5314b7970de78298750550320e329283ee1a
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 55f5b9a..1375760 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -1721,7 +1721,8 @@
         checkAndSetVolume(curves, client->volumeSource(),
                           curves.getVolumeIndex(outputDesc->devices().types()),
                           outputDesc,
-                          outputDesc->devices().types());
+                          outputDesc->devices().types(), 0 /*delay*/,
+                          outputDesc->useHwGain() /*force*/);
 
         // update the outputs if starting an output with a stream that can affect notification
         // routing