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
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
Merge "audio: Force route call on HAL during device disconnection"
Merge "audio: Close the file descriptor in error scenarios"
audio: Starting proxy thread when there is an active stream

- Proxy thread is started from DoRouting only when previous
  and current devices are external devices. When CS call
  is ended while BT Headset is connected, we get a route
  call to ear piece intermittently and then for BT A2DP to
  resume the music playback. As previous device is not
  external device, Proxy thread is not started automatically
  in this scenario. This is blocking pcm_write call for
  touch tones as ear piece is disabled and data is not
  consumed by proxy device as well

- Fix is to start proxy thread after the route call when
  pcm_write for any stream is in progress

Change-Id: I378419977a2ac5af6cd86aa52bf0cc97a3abcee8
CRs-fixed: 661252
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
Merge "audio: Starting proxy thread when there is an active stream"
Merge "audio: Force route on HAL when USB headset is disconnected"
Audio: fix compilation issues

1. keyCanOpenProxy, PROXY_OPEN_RETRY_COUNT etc.
2. Disable audio policy compilation.

Change-Id: Ie84b9e72982245287b6a8bb1783a5dd6e364f8fc
Audio: Compilation issue fix

Audio hardware interface is modified in AOSP,
updated HAL code accordingly.

Change-Id: I7c05ac5a5780a36b2e8fe98fa7418ce1b0d3f622
hal: make file change to export audio_defs.h

- copy audio_defs.h to out target so that it
  can be included in AOSP code.

Change-Id: I84996dd8821a48a9ec71a1164764bf28b91cd390
hal: add extended audio definitions in hal

- Add audio_defs.h in hal for extended audio
  definitions.

Change-Id: I7d574a222d405d8c62d8b833d9ef413708f19639
Merge "hal: make file change to export audio_defs.h"
Merge "hal: add extended audio definitions in hal"
audio: Provided default implementation for openOutputStreamWithFlags

- a new pure virtual function is added in AudioHardwareInterface
  recently
- Provided default implementation in AudioHardwareALSA to avoid
  build issues

Change-Id: I47e7e1b9d0a0d94ef31afc8bc70d4c119cb183f7
Merge "audio: Provided default implementation for openOutputStreamWithFlags"
audio:Initial commit for LPA/Tunnel

 Changes to enable LPA/TUNNEL .
 Changes to support AAC sub formats

Change-Id: I256e7ed5000f9be3ff5bc95db585d2aad8c6793c
audio: Changes to enable Proxy thread

 Enabled opening of proxy device to support playback over
 BT A2DP

Change-Id: Ib2bbec789c41e0505fd1d9a488ac15b4a1b502e7
audio: Set in-call recording use case based on input source

- UPLINK,DOWNLINK channel masks are not set by audio policy
  which is resulting in failure of voice call recording
- Instead of channel mask, audio policy is setting input
  source
- Fix is to enable voice call recording use case based on
  input source.

CRs-fixed: 732350

Change-Id: I8cb584c1754a8fbf8cb95ef2dc512487209a1c2f
audio: Use constants internal to HAL

- Use parameter constants internal to HAL for Proxy,
  FM, A2DP to avoid dependency with framework

Change-Id: I38d7747de5a47639e6aef988e118ac94734d5dc0