Bluedroid: Fix HCI buffer size issue

The maximum HCI frame coming from the kernel is
the maximum ACL HCI data packet (1024) + ACL HCI
header (4) + H4 header (1) = 1029.
Previous maximum read value was 1016 which is
incorrect and leads to data sync problem for
frames > 1016.

Change-Id: I37f74ad4c612d802e6758b3fe0eb156bcf265b4f
Signed-off-by: Loic Poulain <loic.poulain@intel.com>
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: I42e996824d786a3ef8ff928a2c7cd31552cb8834
Fix calls to pthread_setschedparam.

When the scheduling priority is set to SCHED_NORMAL, you may not
specify a non-zero priority. The current implementation does
exactly that resulting in the call failing and returning EINVAL.
This change ensures that a priority of 0 is set when the desired
scheduler policy is set to SCHED_NORMAL.

http://b/12304174

Change-Id: I945cae175b7bdd29dd8fc130ff6396b88ec33fcb
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