Bluetooth losing HF connection to car-kit after 5 seconds

This patch adresses a change in bluetooth which causes a possible
loss of connection within 5 seconds after connecting.  This new
behavior appeared with android 4.2 (4.1.2 worked fine in this regard).

I traced down the disconnects to an BTA_AG_SVC_TOUT_EVT via a timer
that checks if a service connection was made within a few seconds.
Essentially bta_ag_svc_conn_open() was not called on AT+CMER because
android thought the car kit supported 3WAY but the car kit did not
set the 3WAY flag via AT commands and did not send AT+CHLD either.
Android otoh used the flag obtained by SDP and expected 3WAY behavior
and eventually disconnected when AT+CHLD did not arrive.

This may be a bordeline case, because in the Bluetooth Specification
(page 20), assuming service level initialization via SDP is only
mentioned on the HF side while there is no such mention (but could
probably be implied) on page 21 for the AG.

Fact is however, that the use of SDP features value for peer_features
is new since Android 4.2 and breaks existing good behavior on a BMW
2005/E46 car kit (navi professional). This kit never asks for AT+CHLD
and never via AT commands suggests it supports 3WAY (although it seems
to have the flag set via SDP).

Also, having essential behavior (like making the connection or not)
depend on circumstances that may be prone to race conditions, may be
a good reason to not use the SDP flag also (or at least masking out
the 3WAY bit when using it).

(An alternative approach could be to hook into bta_ag_timer_cback() and
when the timer exipres, but when also AT+CMER has been seen meanwhile,
to continue and assume a service level connection without 3WAY,
i.e. clearing the 3-way flags but calling bta_ag_svc_conn_open() anyway.)

Change-Id: I95dcdc5f46e7af723a655afd3d707764603c96c3
Signed-off-by: Markus Schmidt <shimodax@gmail.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
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

Conflicts:
	audio_a2dp_hw/audio_a2dp_hw.c

Change-Id: I506081e906a7539aff27895368b30171bea871c3
bluedroid: Kill A2DP logspam

Change-Id: Ie90cd884249e9f14a04f77f184606613ee53d049
Revert "A2DP HAL: Update maximum Audio buffer size"

This reverts commit 3e21c4790507adbbb29be817750cca4348264629.

Revert "Raise the transmission priority for a2dp media channel to high"

This reverts commit a50d8674fb5de4d56f0a53085703fe18877f1ada.

Change-Id: I4b2a641db5689907510ab1d00bec576ae6c44830
bluedroid: Add wiimote pairing support

Change-Id: Ie1e9fa445cc1967679f3d74277df4c594fca5330
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
Revert "bluetooth: Do not sleep when you have already overslept your tick"

 * Obsolete, and is causing more harm than good. Reverting this patch
   solves the sporadic AD2P timer jank.

This reverts commit a73420d385097af6212f94da2d7020811a8bb580.

Change-Id: I4800e975a2183e8202c002e06facf3b2133158ea
Merge remote-tracking branch 'github/cm-11.0' into HEAD