alsa_sound: Fix for no audio when switching between BT headsets

- mExtOutStream is not initialized in openExtOutput() but set to
  NULL in closeExtOutput() while disconnecting BT device.
- Initialize mExtOutStream in openExtOutput()

Change-Id: I3ae5f20f0cce0b8a10878a574561ac32aa3e898b
CRs-Fixed: 446922
alsa_sound: Add Adaptive ANC devices

Add support for AANC devices in Audio HAL.
When AANC is needed, the HAL will select the AANC device
in UCM.

Change-Id: Ia92080664d0ac66467888e1f19e0d717579b76fd
alsa-sound: Use errno to check for error code of ioctl()

- ioctl() calls by definition must return -1 on failure with
  the error type set in errno.
- Therefore, the return value must not be used
  to check the error type for a failed drain ioctl().
- Use errno instead.

Change-Id: I4d6814bd0da678feaeef17bae83008d4c7376233
alsa_sound: Set tunnel/lpa bit for playback over usb headset

-The tunnel/lpa bit was not being set in all scenarios when
 playback happens over usb headset.
-This resulte in no audio when trying to play the next tunnel
 mode clip.
-Fix by setting the lpa/tunnel bit if the device is usb and
 playback session is tunnel or lpa.

Change-Id: I6721a508e034c836a4aae5cc98cebb6236ee14d0
CRs-Fixed: 447677
Merge "alsa_sound: Add Adaptive ANC devices"
alsa_sound: Fix for Audio routing to HDMI when BT connected

Currently when BT is connected Audio routes to HDMI when
HDMI is plugged in and expected behaviour is audio should
route to BT only as BT has higher priority than HDMI.This is
because route function is being called with HDMI device in
openOutputStream. Removing the route call will fix the issue.

Change-Id: I76933b7f19498023ad2739e6b0305d36a2c77bb6
CRs-Fixed: 451268
alsa_sound: Fix usb headset record noise

-Issue: recording with USB headset has noise
-Fix: Increase the period size to 2048 so that
 number of times that the poll event executed is
 reduced which inturn matches proxy writes to DSP
 in real time

Change-Id: I5a566ce413f0c5c10cf30817b7b4095a2f45c6fa
CRs-Fixed: 426421
Merge "alsa_sound: Fix for no audio when switching between BT headsets"
alsa-sound: AudioSessionOut optimization

- Skip memset(0) for tunnel mode playback in write()
- For LPA playback, call memset(0) only for partial buffers

Change-Id: Ia3cec99afa3bd9750298ebbe7aa6c5fc2ebed927
CRs-Fixed: 444041
Merge "alsa_sound: Set tunnel/lpa bit for playback over usb headset"
Merge "alsa_sound: Fix for Audio routing to HDMI when BT connected"
Merge "alsa-sound: AudioSessionOut optimization"
Merge "alsa_sound: Fix usb headset record noise"
Merge "alsa-sound: Use errno to check for error code of ioctl()"
Merge tag 'A8064AAAAANLYA161023' into HEAD

"A8064AAAAANLYA161023"