alsa_sound: Fix for Tunnelplayer IOCTL drain block

-IOCTL drain was getting stuck when standby was
called after seeking to EOS
-This happens when seek was done to the
end of the stream which would lead to only
a zero length buffer being sent.
In this case, IOCTL drain will block forever
-To solve this, IOCTL drain was interrupted
by calling flush from the context of standby

CRs-Fixed: 467166

Change-Id: I0d119c362670fd4f99b023dd4a1fdebde7832c02
alsa_sound: set ALSADevice::mInChannels to 0 after voice call finishes

When a voice call is established, through  enableVoiceCall()
mInChannels is set to non-zero value, so during disableVoiceCall()
it should be reset to zero.

Change-Id: Ic3f39990c7e1820e5c61e063b8c84e160cdd20bb
CRs-Fixed: 467775
alsa_sound: Fix for audio loss on switching from BT to AOA

-When AOA is connected to device while playback is on BT, usb stream is
 created. The external out stream gets updated with usb stream even
 when a2dp stream is active.
-Update external out stream with a2dp or usb stream in openExtOut only
 if it does not refer to any other stream.

Change-Id: I625ee20ac91ef1be4b21e91fd5e9fffc54a08033
CRs-Fixed: 464457
alsa_sound: Patch to remove delay in second MT call during hold

-When voice call is on hold, when another MT call comes, the ringtone
 is delayed by 6sec.
-This is a special case for fusion, when the voice call is on hold and
 there is another incoming MT call, telephony will set MODE_IN_RINGTONE
 During this there is a change in device from Handset to Speaker,
 this is not propagated to MDM.
-Fix is to propagate device change to MDM during MODE_IN_RINGTONE
 if there is a call on hold already.

CRs-Fixed: 447560

Change-Id: Ia29729bc97a585bd45657e558d04374104e1ce9c
Change to handle A2dp suspend setparameter, which will suspend the thread

When A2dp suspend setparameter is called we were not suspending the thread.
We were suspending it only during stop. This will make sure we suspend the
thread even during the suspend setparameter call

CRs-Fixed: 415399
Change-Id: I49ae25fc028e9d4927fd3d3131c8f97f3e873fc1
alsa_sound: Fix corruption in recording over usb.

-Sometimes the hardware pointer for proxy driver is not updated for
 successive callbacks. This is because in the recording case proxy
 driver and usb driver runs at real time. This does not mandate
 that the data is read by proxy driver as soon as data is written
 from userspace. Any delay in getting dat from usb also can cause
 the issue.
-Fix is to increase the start threshold of proxy side for recording
 so that playback is not started without sufficient data.

Change-Id: I86384bfc96b8262309a1402ca9fe5744af3b436d
CRs-Fixed: 465317
hardware/qcom/audio: Fix for Crash during Gtalk startup

 -Crash is observed when Hangouts and Gtalk start running
  simultaneously
 -Dirver does not support multiple instances of voip call.
 -Avoid creating multiple voip session if mVoipStreamCount
  is already 2
CRs-Fixed: 440160
(cherry picked from commit b9f1299e4ca8b96907f97914a0cf65fd5a3d3174)

Change-Id: I7ef3cf76394e1469db9d21a1484aacf1251c4f25
alsa_audio:remove the device from device list if open fails

-Opening second record session is failed,which is
expected but  after that user is no more able to
open record session
-The device is already got added in alsa_handle after
calling mALSADevice->open but if this open fails, need
to be deleted from device list.
-If mALSADevice->open is failed then erase the device from from
mDeviceList so that next time it can opened.

Change-Id: I9847f65718d8330292f312dffe18dfcb672f2d3d
alsa_sound: Increase delay in temp mute

-Silence for small time when headset is inserted
 and then touch tone is played.
-Stream is unmuted in checkDeviceMuteStrategies before
 device switch occurs.
-Increase delay in temp mute to ensure unmute after
 device switch.

CRs-Fixed: 470160
Change-Id: I6bc443abf77e5600675846086a57090f49bf9bd7
alsa_sound : Fix for audio routing speaker though BT is connected

- Speaker device is selected by getDeviceForStrategy() though BT is
  connected as mA2dpSuspended is still remaining as 'true' even
  after ending the voice call.
- This flag is not updated by checkA2dpSuspend() as force usage
  for communication and record is still FORCE_BT_SCO after ending
  voice call.
- Modified condition check to set mA2dpSuspended to 'false' as soon
  as phone state is changed to MODE_NORMAL

Change-Id: Ibc0d19b361755d8715c446401d2e14d914fd7020
CRs-Fixed: 464404
alsa_sound: Add metadata mode changes for LPA playback

-Seek to EOS was causing playback to hang for 3 seconds before
 switching to the next clip.
-This is because the lpa driver works on period size. Partial
 buffers are not handled.
-Add metadata mode changes to AudioSessionout for LPA playback to
 support partial frames.

CRs-Fixed: 458904
Change-Id: Ibe3225d50e1c4248ba5c41e8d2a7067fc20108d9
msm8660: Fix mic in Hangouts

 * Add higher sample rates and stereo input to VOIP device

Change-Id: I7b2a439325d1b427cb33b16f3ab5473edc352833
alsa_sound: Support ES325 2Mic and Samsung CSD client

 * The dual mic feature on the Audience ES325 needs to be enabled via
   csd-client on the Galaxy S4. Add support for this.
 * Samsung is using a non-standard name for the functions in csd-client.
   Add support for this.

Change-Id: I764ead9ea17729055da701a423edec97d96b8319
Merge "alsa_sound: Add metadata mode changes for LPA playback" into cm-10.1
Revert "alsa_sound: Add metadata mode changes for LPA playback"

This reverts commit 5496a3c345320c4340820daf06333828040418a9

Change-Id: Id26b862abb362a481afbd6af58dc6d932aa0901e
Merge "Revert "alsa_sound: Add metadata mode changes for LPA playback"" into cm-10.1
Merge remote-tracking branch 'cm/cm-10.1' into jellybean-4.2