Raise the transmission priority for a2dp media channel to high

Raise the transmission priority for a2dp media channel to high
so that when a2dp streaming runs simultaneously with some other
b/w consuming operation such that file transfer over BT, a2dp
media link is given more priority over other channels so that
host does not delay sending the media packets.

CRs-Fixed: 628669
Change-Id: Iea9d7008cfe83978c6e1bbb0b99b7423ba9cd083
Bluetooth: Avoid premption while modifying gki timer queue

Addition/Removal of timer nodes to the timer_queue happening
without protection,
When both Addition/removal happens concurrently there could
be a chance that remove timer might have deleted the node
and the same might be getting accessed in add timer while
adding the timer node to the list, this could lead exception.

Added changes to synchronize both addition and removal
of timer nodes from timer queue, so that addition/removal
happens sequentially.

CRs-fixed: 647281
Change-Id: I24f6476e026b071145019164a6f122b5ab70cb51
A2DP HAL: Update maximum Audio buffer size

Due to Audio buffer equal to socket buffer size observed A2dp
Chopiness randomly because of socket write blocking for long
time. Update maximum Audio buffer size to 3072 bytes.

CRs-Fixed: 648712
Change-Id: Idcb77a6153d4c790dba652277063bebf7e9c7c3e
A2DP HAL: Delay open_output_stream

Delay adev_open_output_stream to ensure that the Headset is
in proper state when START is initiated from DUT immediately
after the connection due to ongoing music playback.

Change-Id: I79a895a85ac7d37208192acf9064fd5c979dd28b
CRs-Fixed: 647163
A2dp: Reduce out buffer size to accomodate 8 PCM frames

Reduce a2dp audio HAL out buffer size to 8*512 bytes to allow
audio to write lesser amount of data to A2dp HAL.

CRs-Fixed: 649937

Change-Id: I3e762bf8d269eb47a85bb4bc727f0365e8a48844
Fix "Bluetooth: Handle sub system restart gracefully"

 * Do this only for Qualcomm hardware.

This reverts commit 7062c3daf85b6b8224c3b065905c93e88c690316.

Change-Id: Idbe1cd8a57c31e6388f0fd1794c86de6564886c3
TARGET_SIMULATOR is long dead.

Change-Id: I6ba4a55c865370f12ae30f445661b54bbc714f8a
Fix bug in PAN code where no new PAN connections can be made.

If you call PAN_connect() followed quickly by PAN_disconnect(),
you won't be able to establish any additional PANU connections.
This happens because the connection never has a chance to make
it into PAN_STATE_CONNECTED and num_conns only gets decremented
if you disconnect in the connected state. As a result, subsequent
calls to connect will fail because the stack still believes there
to be an existing connection.

Change-Id: Id24873828ca4f517496cb19a44993d0e8e837a1e
Fix uipc.c to never pass -1 to FD_ISSET.

The behavior of FD_ISSET when passed -1 is undefined.

I checked all calls of FD_SET and FD_CLR in this file, and they all
seem to be correctly guarded. None of the FD_ISSET calls were, so I
added a SAFE_FD_ISSET macro to return false when passed -1, which is
presumably what the callers intended.

This allows Bluetooth to be enabled on a device where the C library
aborts if passed any out of range fd.

Bug: 11047121
Change-Id: I261404a5a80884d5e9edab8beb3c93969113dc76
Use 0000 as pin key for PORCHE_PAIRING_CONFLICT issue

For PORCHE_PAIRING_CONFLICT issue when there are no other paired devices
available in bluetooth list pairing always fails (as per implementation
in bluedroid stack).
In this case when pin key request is received use 0000 as the pin key
so that pairing is successful.

Bug 67614

Change-Id: I67b2e689cfcc52c93fdda62dd742812698baa0e6
Don't leak process-private data on Change Local Name command.

The Change Local Name command to the controller doesn't zero out
the contents of the command buffer before setting the contents. As
a result, the controller sees both the new device name and then
random data left over on the heap from previous operations. This
random data may contain sensitive information. Although the device
name is null-terminated, a controller may inadvertently leak the
additional information over the network.

This change fixes the behaviour by zeroing out the entire command
buffer before copying the device name into it. If the device name
doesn't occupy the entire buffer, the rest of it will be zero.

http://b/12949068

Change-Id: I4dd6ce6dd6709589fcd1e23f974db820820bc8e1
Merge branch 'cm-11.0' of https://github.com/CyanogenMod/android_external_bluetooth_bluedroid into kitkat

Conflicts:
	audio_a2dp_hw/audio_a2dp_hw.c

Change-Id: Iaec38e19b1eb88c2bdbc2ae6b24dae7fabfc2656