alsa_sound: Fix for voice volume restore after reboot

  - Maximum volume is heard for call after reboot even if it
    was set to minimum during the last call before reboot.

  - During call after reboot, mLastvoiceVolume is getting
    updated improperly and hence proper volume is not
    being applied.

  - Fix is to cache the voice Volume properly.

  CRs-Fixed: 517731

Change-Id: Ia9512afaab94407f04011541db1b49b41cd5707a

Conflicts:
	alsa_sound/AudioPolicyManagerALSA.cpp
Clean code

N/A

Change-Id: Id65781612963cb285a1db5d6ad14e0c7b168a3ef
Signed-off-by: huangqiwu <huangqiwu@xiaomi.com>
Remove DOCK_USBAUDIO_ENABLED

N/A

Change-Id: I5e036b6650565ee2e1a22d33ae7e88fb827091e6
Signed-off-by: huangqiwu <huangqiwu@xiaomi.com>

Conflicts:
	alsa_sound/ALSADevice.cpp
alsa_sound: Untangle VOIP/voice speaker handling

Change-Id: Ieedac3af120a08f567a6575fdb06e6e22946307d
alsa_sound: Fix audio over Miracast

 * We're not using QC's proprietary WFD solution, so pick the remote
   submix instead of the proxy.

Change-Id: Ie32a4591a27f17e2a1d0b87b5f5a7b8b320ff169

Conflicts:
	alsa_sound/AudioPolicyManagerALSA.cpp
alsa_sound :Starting "UsbRecordingThread" if not started

- Recorder stop() was getting called in hangout app before the
  call got connected, this will stop UsbRecordingThread.
  Recorder set() is called with a sample rate of 48k due to which
  the USB recording thread doesnt get re-started because for VOIP
  the sample rate expected is 8/16k.

- UsbRecordingThread has to get started when the call
  gets connected.

Change-Id: I12c4d1f473224de7df2041f22fdc45cf77ac4acb
CRs-Fixed: 516270
Remove High water mark check in ALSA Device

- High water mark framecount check while reading from proxy
  device is causing issues during A2DP Music Playback
- Remove this check to avoid freeze during A2DP Playback

Change-Id: If066438c9f1886aa29ad57ccba154e0ca970a5f3

Conflicts:
	alsa_sound/AudioHardwareALSA.cpp
alsa_sound: primary desc check for sonification

- Audio glitches on alarm expiry if alarm starts
  on screen lock/standby mode

- On alarm expiry alarm tone will start play on combo device
  &screen unlock tone try to play on headset which results
  multiple device switch, as a result audio glitches are audible

- If sonfication strategy is used by primary desc , we will
  treat all non music streams with sonfication stragey which
  will avoid device switch

CRs-Fixed: 514467

Change-Id: I89320c5a685afa070f49fa4ebd60af73768e73f9
alsa_sound:  Fix to avoid crash while erasing item from mDeviceList

-In AudioHardwareALSA's destructor,while erasing item from mDeviceList
is leading to crash in current implementation, if List containing
more than one item.
-This is happening because of Invalid iterator value after deleting
current item from List, then using same iterator for next operation.
-It can avoid returning an Iterator item form List's erase function
and then use it for next operation.

Change-Id: I30ba5b5a9904c1d3cad1f470f9fae84d23a90aa5
CRs-Fixed: 517101
(cherry picked from commit 41d7bad968b94bc8ac1d6ea92849b2792604963e)
audio: fix for volume burst during FM device switch

- Issue: Volume burst is heard during device switch
  (headphone and speaker) for FM playback
- Root cause: delayMs passed to CheckAndSetVolume is
  not applied for FM playback
- Fix: Double delayMs and apply FM volume with this delay

Change-Id: Ib7c7bd59ed584f85ea79a7606c635d60dffa3471
CRs-Fixed: 526553
  alsa_sound: Fix Echo reference logic

  Echo reference should be set even before enabling the
  devices.

Change-Id: I4535b98dd4489ccc4b287eab842cda3d2265b65c