audio: fix output flag test in open_output_stream

If flag AUDIO_OUTPUT_FLAG_DIRECT is set, we should only
try to open a multi channel HDMI PCM output if flag
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD is not set.

Bug: 8174410.
Change-Id: I63fe6cabca590e70c077dea13c86c6948700e606
merge in klp-release (no-op)
hal: Fix for Audio Route issue when sound path changes

- if you make an outgoing call as mp3 playback is runnign with headset,
  Right side of headset is not functional when keep changing sound path
  from headset to speaker
- Fix the issue by separating loop related of disable/enable_snd_device

Bug: 11232052
Change-Id: Id02a6d7221c77cf4003d97749d75a062d8575d02
Merge "audio: fix output flag test in open_output_stream" into klp-dev
alsa_sound: Fix for unhandled NULL pointer

-Passing NULL pointer to pcm_read()/pcm_write()/
 pcm_prepare() would crash, since it doesnt perform
 a NULL check before using the pointer, resulting
 in random crash
-Fix is to check whether handle is NULL or not.

Change-Id: I7061d40bddcaaae2145f5fc0a0229abeebead878
CRs-fixed: 549257
audio: fix for unhandled NULL pointer in HAL

- Check if handle is NULL before calling pcm_close
- Check if usecase is NULL before string comparison
  operations
- Disable unnecessary debug logs in HAL

Change-Id: I569cbf510c820e1a155abf3efb4bbb525e68aafb
hal: Fix voice calls starting on speaker unintendedly

If setParameters(vsid, callstate) call is processed before
setparameter(routing), voice calls will be started on speaker.
Fix by not starting voice calls by checking if the primary output
device is speaker.

Change-Id: If3ecb83bbcb02d5da40d66340276263413adabc9
hal: Fix the audio loss issue on codec back end

- Start music playback, plug in and plug out headset and press
  'Next' button in the Music app immediately. Repeating these steps
  result complete loss of audio on HW codec.
- When headset is pluged out and Next is pressed immediately, the
  audio HAL triggers audio routing change from Headset to Speaker,
  and closure of compress playback driver. The later is not lock
  protected which result un protected access of back end information
  in the ALSA framework. This leads to incorrect routing and hence
  loss of audio. It is also observed that sometimes it could lead
  to crash in kernel and phone reboots.
- Fix by ensuring that the kernel driver close is also lock protected
  along with other routing events.

Bug: 11088400
Change-Id: I785effb09e5cef7ba20ee43e0ef91dc296d4e58a
alsa_sound: Fix a memory leak

A pointer variable was not being freed up which is
causing memory leak.
This change is to fix the same.

Change-Id: I12728a4a75fb303d34d10657fe9cbc1b55c1687e
CRs-Fixed: 523572
hal: Add the correct pcm device for compress capture.

The dai-link id is 20 for compress capture on 8x26. Add the correct id
for 8x26.

Change-Id: Ie41b2c039816a6014ac32af4f191c2e3aaad37a1
Merge "audio: fix for unhandled NULL pointer in HAL"
Merge "alsa_sound: Fix for unhandled NULL pointer"
hal: In-call recording and In-call music support on APQ targets

-In-call recording feature support is added in APQ.
-In-call music delivery support is added in APQ.

Change-Id: Id473eac87da33f1f566b6910ec1feadcd3f08317
Update copyright to The Linux Foundation

Change-Id: Ibaced495ccbe2ef8b53e7d5101dfe59855b5476b
hal: update devices for APQ8084 cdp and liquid

APQ8084 CDP and Liquid might use a different set of devices
compared to MTP device for the same use case. Update device
list to use the right set of mixer controls for use cases
for APQ8084 CDP and Liquid

Change-Id: Ia40c31bc6cd94155d2b6dcc966bf4524906ea687
hal: Added support for HFP

 - Added setparameter to be set from hfp app to enable
   and disable hfp session.
 - Implemeted start and stop hfp session which takes
   care of switching device and setting the session

Change-Id: Ie8697328ccbfee09d0d162f6fad01ddb552e4f83
audio: Choose Speaker instead of USB Headset on force use

- getNewDevice() is selecting USB Dock Headset when user
  forces it to be speaker during VOIP/VOICE call
- Fix is to return speaker as output device in this case
CRs-Fixed: 571801

Change-Id: I81cbcef17ac6d07ac0a174e4ab35c8f5c6426257
hal: fix channel mask for m-ch offload playback

- Update channel mask with compress parameters for
  compress offload playback on HDMI device

Change-Id: I89263f56923588fcb906facfd4ae9ebf95203743
Merge "hal: Add the correct pcm device for compress capture."
Merge "hal: In-call recording and In-call music support on APQ targets"