hal: SSR support for pcm playback,pcm record usecases

- Added SSR event handling support in HAL

- Added support to drop incoming pcm data for pcm playback
  usecase during SSR

- Added support to send dummy input(mute/zero buffer) for
  record usecase during SSR

Change-Id: I158b62fa443bb523091128fe1308c9a9b1415502
Audio: Enhance logging in AudioPolicyManager

Enable msg logging
-To print playback clip attributes
-Offload supported or denied

Change-Id: Ifafb8c01ecca41aa2e09a134123d56a695494db4
hal: improve logging.

-log to print open/close/standby of out/in streams
-log to print the the device switches

Change-Id: I1b3bf3d6ba19faa4df804f781fc15c0f96a5b80f
hal: Fix teardown during back to back pause/play of WFD session

- When an active WFD session is paused/played continuously from
  the WFDClient app, the session tears down after a few iterations
  if touch tones are enabled.
- The output device is switched back and forth between speaker and
  proxy when the session is paused and played continuously.
  When this happens, sometimes, there is no backend to write the
  low latency output which results in pcm_write getting blocked.
- Fix the issue by not routing the low latency output to speaker
  if the previous device is proxy.

CRs-Fixed: 630234
Change-Id: I6bbe82badd3d5ee857e920430304c3a45c5b44c7
post_proc: improve logging

Make logs more meaningful and remove
ones not necessary.

Change-Id: I9562cf34a5dee406b1c0347a9004db08de9cd5df
post_proc: disable Bassboost and Virtualizer for USB_ACCESSORY

USB_ACCESSORY is not intended to be applied with SA+ bassboost
and virtualizer, so add into invalid devices list.

CRs-Fixed: 659191
Change-Id: If1f3421f9935ce624dc21895d9244d36d195b2bd
post_proc: fix post and pre process KW issues

KW issue fix includes:
- handle memory allocation failure
- array index boundary check

Change-Id: I083952ba58d348a5b650601a83e6f492b0d686bb
audio: Force route call on HAL during device disconnection

- When a wired accessory is connected/disconnected,
  setDeviceConnectionState updates the current device
  only for active outputs and also makes the corresponding
  route call on Audio HAL when the current device is not
  same as the previous device for the active outputs. As
  inactive outputs are not updated in this case, sometimes
  audio policy fails to notify device change to HAL.
  Specific scenario is mentioned below

- If headset is inserted when touch tones are disabled
  and music is in progress, LPA/tunnelled output is updated
  with headset as its current device and also respective
  route call is made on audio HAL. But low latency output
  still has speaker as its current device because it is not
  active. Later, if music is paused and headset is removed,
  setOutputDevice does not make route call on Audio HAL
  when touch tones are played. This is because the current
  device and previous device are same(speaker) for low
  latency output. So Audio HAL tries to play the touch tone
  on headset when headset is not connected.

- Fix is to force route call on HAL after every device
  disconnection irrespective of current and previous device
  being same for the specific output

Change-Id: I80d799718c980d0422d4e5f7015fcf16f001fda9
CRs-Fixed: 627903
audio: Close the file descriptor in error scenarios

 -In the scenario where the USB headset and proxy device
  sample rate dont match, error was returned without
  closing the file descriptor .So, the next time USB
  headset is inserted , the /proc entries are not created
  which results in the USB headset playback not started
  as the capabilities cannot be read.
 - Closing the file descriptor in the error scenario fixes
  the issue.

Change-Id: Ie45327f04cc7fff6dbcbe1268a7f34793e89641b
Merge remote-tracking branch 'cm/cm-11.0' into kk-4.4_stable
audio: Force route on HAL when USB headset is disconnected

- snd device reference count is not decremented when usb
  headset is unplugged, because touch tone is still active
  on usb headset. So when usb is plugged again device
  routing is not triggered as present and prev devices are
  same
- Fix is to force routing audio to speaker as soon as usb
  headset is disconnected
- Added similar check for HDMI device too as it applies
  for HDMI disconnection scenario too

CRs-Fixed: 655403

Change-Id: I3d66654ebc1f324b08104b586f201540f7005dd2
 Audio: Revert hal changes to block pcm_close during SSR

 pcm driver supports pcm_close during SSR, so reverted
 HAL code to block pcm session close during SSR.

 CRs-Fixed: 663477

Change-Id: I752e3f4f55288f91294e090b974ba1367c27122d
Merge remote-tracking branch 'cm/cm-11.0' into kk-4.4
audio_policy: force cancel unexecuted device routing command

-unexecuted device routing command can be handled for a none active
 output and cause wrong audio routing for the other active output
-cancel the pending device routing command if stream is voice call
 and new device is none

Change-Id: Ia5aeb935ccbdcb63fe8b226f911d252f78e2fa9b
CRs-Fixed: 678582
Revert "audio: primary desc check for sonification"

This reverts commit 785b693a0fa89aebbec4137fc9cc52b2b160174f

Change-Id: I70cb4e74eb47b6fd936f9ddd8afb602441a9ad7e
CRs-Fixed: 656945
policy_hal: Set the output devices in ascending order of outputs

 -volume related issues are seen with customer app while setting
  device forcefully
 -Set the output devices in ascending order of outputs to make
  the overridden setForceUse API's code inline with base function.

Change-Id: I375b557de105be295c7bc246fe3f8325f55ce859
alsa_sound: call voice volume api for direct output also

- Voip volume is not applied on direct output and as a result
  volume cannot be adjusted for some voicemail applications
  which opens direct output stream with mode set to IN_CALL.
- Voice volume is applied only for primary output and volume
  command is not sent to HAL for direct output.
- Call voice volume api for direct output as well from policy
  manager.

Change-Id: Iad6dc31ba628408958e4d693b99062f502210a56
CRs-Fixed: 676599
hal: fix mutex unlock issue

If a audio/voice usecase is active, hal should re-try the speaker
calibration.Speaker portection mutex was not being unlocked for this
usecase which causes ANR.Change unlocks the mutex which fixes the issue.

CRs-fixed: 671620
Change-Id: Ic29697e29e96dba784941f4e29664b8c10f51e84
mm-audio: aenc: timestamp fixes

Save timestamp of first ETB as anchor time and use it
as reference in calculating timestamp for all future FBDs

Change-Id: Id937ac169c878fccf7d6f8fa660cb9ec321d4afa
CRs-Fixed: 639731
mm-audio: Remove omx decoder components from mm-audio folder

Remove omx decoder component from hal/mm-audio as
decoder component are used from proprietary/mm-audio folder

Change-Id: Ia9d4842f6939108a652d64912e1dec45a987b1e9