APM: cap earpiece voice in call by voice volume

The volume curves between AUDIO_STREAM_VOICE_CALL and other streams
  used during a call on AUDIO_DEVICE_OUT_EARPIECE can vary greatly,
  particularly when the volume curve is used to tune the voice signal
  going to earpiece, not just to select a desired curve shape.
This can be problematic during a call as a sound playing on a different
  stream may be assigned a much louder attenuation value than that
  of voice.
The fix consists in comparing the attenuation computed for earpiece
  to the one for VOICE_CALL, and using the lowest value (with a 3dB
  headroom).

Test: see bug
Bug: 63395386
Bug: 63976807
Bug: 38194285

Change-Id: Ia55e05e2a1d6fc55d45147f4234b693a905714cc
1 file changed