alsa_sound: Initial commit for Audio HAL.

Change-Id: Ie1b32383feae5b4b50463a97a3513c86bf985679
legacy/alsa_sound: Add support for FM feature.

Change-Id: Ide18fa63ae589cf6278baf4a02da874c839b272b
Merge "legacy/alsa_sound: Add support for FM feature."
alsa_sound:Port Audio fixes for concurrency and misc issues.

Issues:
 Support for echo supression .
   Fix:Add echo cancellation key to HAL getparameters

 Fix for IMS hold Issue. CRs-Fixed: 493474
   Fix:Add check for hold state also along with
       active to call doRouting.

 Increase the stop threshold of proxy driver for a2dp .
   Fix:Increase the stop threshold to a higher value so that stop is not
        issued while bt hal is not ready to consume data.

 If two back to back notifications are started immediately during a
 call, the second notification is still heard sometimes though it
 should be muted . CRs-Fixed: 501013
   Fix:Fix this issue by handling in call sonification even when refcount
       of output is 1, so that mute count is properly maintained in such
       scenarios

 Sound burst on switching from speaker to headset. CRs-Fixed: 480077
   Fix:Set the stream mute for other output(LPA or Compressed) followed
       by device setting for lpa or compressed output and then set the
       device for primary output

 Sudden burst for short duration. CRs-Fixed: 486123
   Fix:The delay calculation for unmute is not correct.
       Correct the calculation for unmute.

 Fix to avoid mute of an already muted stream. CRs-Fixed: 482262

 Fix to avoid Ringtone leaks to speaker in Skype MO call. CRs-Fixed: 477665

 When BT is in A2DP profile, try to do a Voice call,unable to
 hear any voice on BT/earpiece/Speaker when in call. enablevoicecall()
 is failed due to BTA2DP is not supported. CRs-Fixed: 462159
 Fix:Added check to detect voice path setup failures, such that
       later requests to setup voice path can be processed

 Observed that Skype call is not routing through HDMI sometimes.
   Fix: HDMI device pair gets overwritten by Earpiece & Mic when Skype
       closes current input stream and opens another one.
       Fix is to check the current rx device in audio HAL and picking up
       proper rx instead of handset_rx. CRs-Fixed: 478276

Change-Id: I242a0e37de6d3292ca564624f859ab3e5f16415d
Merge "alsa_sound:Port Audio fixes for concurrency and misc issues."
libalsa-intf: Fix for no audio on specific USB device

- Playback volume is not initialized for USB device due to this
  on some specific headsets no audio heard even if we increase
  the playback volume to maximum.
- Fix is to explicitly initialize the volume for USB headset
  before starting the playback using mixer control. As USB
  driver supports DB_MINMAX for volume control add support
  for same in alsa_mixer.

Change-Id: Icaa5e0072ce95439418c61d60aed819ac98b3f63
CRs-Fixed: 478906
alsa_sound: port fixes for USB audio and misc issues

Issues:
 Music audio lost on headset when we end call and call volume in silent
 mode.
  Fix:Ensure that proper suspend and resume happens while we get a2dp
      state as playing while in a call
  CRs-Fixed: 482213

 Some USB headsets start at 0 volume because of this even
 if the Media Player volume is maximum cannot hear any audio.
  Fix : Initialize device volume before starting the playback.
  CRs-Fixed: 478906

Change-Id: I29275497982d932c32f7bc6e12078090f6d99bf7
legacy/alsa_sound: Replace STREAM_FM with STREAM_MUSIC.

- FM changes to move back to STREAM_MUSIC instead of STREAM_FM.
- This is done as, STREAM_FM changes from frameworks/base
has been replaced by STREAM_MUSIC.

Change-Id: I674fc148a85f722164aab42f9d4015f7923c13ec
Merge "legacy/alsa_sound: Replace STREAM_FM with STREAM_MUSIC."
legacy/alsa_sound: Fix for Music and FM volume concurrency.

- Call music volume and FM volume subsequently, as both use
STREAM_MUSIC, and change in one should get effective in other
application.
- Initialize FM volume to zero in Audio HAL. Store FM volume
even if FM is not active.

Change-Id: I29eb30f30a42dd2cac05fb8566e5f0725618df89
legacy/alsa_sound: Return bytes written to HAL for tunnel playback.

- Return bytes written to HAL on successful pcm_write for tunnel and
lpa playback. Return error value returned by pcm write in other
condition.

Change-Id: I554df079e56fcbc8f24e5f50f4c7469ad3c2a686
Merge "legacy/alsa_sound: Fix for Music and FM volume concurrency."
Merge "legacy/alsa_sound: Return bytes written to HAL for tunnel playback."
Update copyright to The Linux Foundation

Change-Id: I4bf8121b09abe1480f0ae1aba27e2b70510d2722
legacy/alsa_sound: Fix for a crash in Audio Policy Service

- isStreamActiveRemotely is missing in audio policy module
  This is resulting in a crash when this call is made on
  AudioPolicyService.
- Fix is to implement this method in audio policy hal so that
  the call is routed to audio policy manager

CRs-Fixed: 508811

Change-Id: I3b4bb723ea5bbc25cb39b12fa06743873465a144
alsa_sound: Changed mDevices to mCurRxDevice for StreamOut

- mDevices will be updated during route call and
  current device can change in between the start
  and write call of stream.
- In which case only the mCurRxDevice was updated
  and during write the device would not be updated
- This would create problem when switch device happens
  in session where it was alreasy set and device switch
  is ignored.
- here we use mCurRxDevice so even if there is a switch
  device in between the cur device will be used for
  routing in Stream

Change-Id: I94af59d7c8735b09e9adf2683e31533bf0f2be8e
CRs-Fixed: 490814
alsa_sound: Extend setparameters to support vsid and call_state

Telephony will set call state per session using
setparameters() with session id and corresponding
call state instead of setting bitmasked value.
Extend set_parameters() to support vsid and call_state.

Change-Id: If2d27d1f8e428d203a212fea1f4c43c218737194
Merge "Update copyright to The Linux Foundation"
Merge "legacy/alsa_sound: Fix for a crash in Audio Policy Service"
Merge "alsa_sound: Extend setparameters to support vsid and call_state"