alsa_sound: Increase the stop threshold of proxy driver for a2dp

-The stop threshold for proxy port for bt playback is buffer size.
 So if data is not read from proxy for duration of the buffer size
 alsa kernel framework issue a stop . This results in the fd being
 invalid. subsequently playback over bt is stopped.
-Increase the stop threshold to a higher value so that stop is not
 issued while bt hal is not ready to consume data.

Change-Id: I4e41186ee0b4c889a092fd696e6c0fd1ffeda354
  alsa_sound: Fix to avoid Ringtone leaks to speaker in Skype MO call

  - Observed Ringtone leaks to speaker sometimes during VoIP MO call
    end.

  - Skype is not sending stopOutput() on AUDIO_STREAM_RING immediately
    after sending stopOutput() on AUDIO_STREAM_VOICE_CALL.

  - Fix is to "Mute the AUDIO_STREAM_RING if HAL gets stopOutput() on
    AUDIO_STREAM_VOICE_CALL and there is a AUDIO_STREAM_RING still
    exists in the system.

    CRs-Fixed: 477665

Change-Id: I4f964a779a0e15bd982b8ee634b1549109f0f304
  alsa_sound: Fix to route Skype call through HDMI.

  - Observed that Skype call is not routing through HDMI sometimes.

  - 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: Ie0c470d38b2d5cbcdec5616ad684d353afd34a59
Revert "audio: getNewDevice on primaryOutput for strategy phone and enforced audio"

This reverts commit 694d88c26e0c778fb27b4a389dc6c59fab54b2f6.

Conflicts:

	alsa_sound/AudioPolicyManagerALSA.cpp

CRs-Fixed: 482213
Change-Id: I54b54838efa0f714c070dc7118bcddf76e02debb
alsa_sound: Fix for sound burst for short duration

-Audio data volume is high for some time when TV is switch off and on
 when HDMI is connected.
-The delay calculation for unmute is not correct.
-Correct the calculation for unmute.

CRs-Fixed: 486123
Change-Id: Id3360a092b9d3803c6679ec7e455c96ae123ec8c
alsa_sound: Fix for IMS hold issue

- doRouting is not called for going from
  IMS hold to IMS active. Hence, there is
  no audio.
- Add check for hold state also along with
  active to call doRouting.

Change-Id: Idc894dbad1ea14b3afff6062cff411108bfeced7
CRs-fixed: 493474
Merge "  alsa_sound: Fix to avoid Ringtone leaks to speaker in Skype MO call"
Merge "  alsa_sound: Fix to route Skype call through HDMI."
alsa_sound: Add initial volume setting for USB headset

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

CRs-Fixed: 478906
Change-Id: I8d38325ac9ba2d48c2be3fa627efde86e7a9d33c
 alsa_sound: Fix to avoid mute of an already muted stream.

-Sound is not audible for a video file in the following
scenario: play a video file, receive an alarm notification,
connect wired headset and BT headset, and now remove BT
headset and wired headset, dismiss alarm and resume video
playback. Video playback continues with out any audio.

-In the above scenario, when we connect wired headset all
streams on strategy media gets muted (as media strategy takes
in wired headset as device and alarm considers combo device
speaker+headset as new device) and mMuteCount gets incremented as
its a device switch, similarly when BT headset is connected, all
media streams are muted again and mMuteCount is incremented. And
when BT headset is removed mMuteCount gets incremented again as its
a device switch from BT to wired headset, and mMuteCount is incremented
accordingly. Finally when wired headset is disconnected, media streams
are unmuted and mMuteCount is decremented. However effectively
mMuteCount is still greater than zero because of which all media
streams in non-LPA mode are muted.

-Avoiding mute of an already muted stream resolves this.

CRs-Fixed: 482262

Change-Id: I204d434fd7b0abd0fff6afcb6de0250f4e86ba21
Merge " alsa_sound: Fix to avoid mute of an already muted stream."
Merge "alsa_sound: Increase the stop threshold of proxy driver for a2dp"
Merge "alsa_sound: Fix for sound burst for short duration"
Merge "alsa_sound: Fix for IMS hold issue"
Merge "Revert "audio: getNewDevice on primaryOutput for strategy phone and enforced audio""
Merge "alsa_sound: Add initial volume setting for USB headset"
Merge remote-tracking branch 'caf/jb_2.5' into HEAD

Conflicts:
	alsa_sound/ALSADevice.cpp

Change-Id: Ibc60d3694d814a4ad8ad464e95217ccca8b31936