Bluetooth: Handle Connection request in Opening state.

Add support to handle Connection request in opening state.
This happens in race condition when we try to connect to HS from UI
and simultaneously there is connection request from remote HS.

Change-Id: I9518a1857bf188da8851b4c6927929dce7ee4c8b
CRs-Fixed: 531637
Bluetooth: Adding support for 5th PANU connection

DUT(NAP role) can be connected up to maximum 4 remote devices
(PANU role) as per the current implementation. Adding support
for 5th PANU connection, So DUT(NAP role) can be connected up
to maximum 5 Remote devices(PANU role).

Change-Id: Ic687c56bded40e5e79099ef3c31d40e10b8531c8
CRs-Fixed: 463828
Bluetooth: Codec negotiation should be proper.

This change will make sure that stack initiates
codec negotiation process  only for those remote
device which support it.

Change-Id: I225bc9992865d86613d872bcbd378f397935ffad
CRs-Fixed: 535934
Bluetooth: Delay setting connectable mode.

This patch delays setting of Connectable mode until data profile
are registered.

Change-Id: Ifd43034ebe167aa308449cb6817801f18a1540cb
CRs-Fixed: 538672
Bluetooth: Fix for SetEncryption race condition

The setencryption called in a case where there is already
a pending call to SetEncryption causes the devices to be removed
The fix ignores the callback to the second call.

Change-Id: Iccf16ca6a1c785f4e22f966c26247cd5ef6649c8
CRs-Fixed: 535369
Bluetooth: Avoid to send sco disconnect when power mode is processing

When power mode command is processing on the ACL where SCO link is active.
while processing power mode command on particular ACL. if DUT send sco
disconnect, then remote device may be gone into bad state. So DUT should
send sco disconnect, once mode change is completed to avoid this issue.

Change-Id: I3b3d2ccc3dcbcfd592b0d7d06ffb6aea876b5487
CRs-Fixed: 538020
Bluetooth: Support  HFP Client role on Bluedroid.

Implementation changes in BTA and BTIF layer to support
HFP Client role on Bluedroid stack.

Change-Id: Ia1af01c19326cac326da9b4eb1f845f0d82b3c0c
Bluetooth: Handle closing of UHID Poll thread from btif context

This patch handles closing of uhid driver from btif context instead of
bta context. since now uhid close would be handled in btif context, bta
thread would be unblocked for handling avdtp media packets.
Wihtout this change bta thread was getting blocked upto
max 500 ms when HID is disconnected, which caused delay in sending
of AVDTP Media packets during A2DP and HID concurrent test cases resulting
in audio break on BT headset dueing HID disconnection.

Change-Id: I4bc5bbcc07416752cdea08e896c86ec3457088f4
CRs-Fixed: 543015
Merge "Bluetooth: Codec negotiation should be proper."
Merge "Bluetooth: Avoid to send sco disconnect when power mode is processing"
Merge "Bluetooth: Fix for SetEncryption race condition"
Bluetooth: fix sniff issue with multiple rfcomm connection in same ACL.

When there are multiple rfcomm connection with same appid and peer bd
address, we were clearing jv pm control block in addition to closing
connection to service with registered app id. Since appid is common
across all the client and server app registed to jv. we were clearing
entire connection to service for this appid and peer bdadres which was
corrupting sniff logic, when another rfcomm connection exists with same
peer bdaddress. So avoiding closing of connection to the service when
multiple rfcomm connection exists in same ACL.

CRs-fixed: 543234

Change-Id: Id71ef5f7f0e00f1bda3b70a4826c31bef46caafc
Bluetooth: Handling mulitple SetEncryption commands

The fix includes bypassing the check for encryption already
in progress (in general) and specifically testing if encryption
 is ongoing for a particular bdaddr.

Change-Id: I95a5f6d673f1eb81f489a72bc3ad5eca240f29fb
CRs-Fixed: 548782
Bluetooth:DUT to initiate Sniff after A2DP Pause.

Host does not initiate Sniff after A2DP pause.
Change is done in HF Power Manager table such
that Sniff timer starts once HF is in idle and
A2DP is paused.

Change-Id: I25608db3e2b8cfe8f44b10894d5d3a7388b54ed5
CRs-Fixed: 545681
Bluetooth: Update key map table with Fast Forward .

Changes done to handle Fast Forward command from
remote headset.

Change-Id: I03847779a9c583f70fc462f04058385dfbdbc8cb
CRs-Fixed: 546347
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: 537479
Change-Id: I24f6476e026b071145019164a6f122b5ab70cb51
Bluetooth: Add SIBS Macro to enable or disable based on a target

Based on a target, the bluetooth chipset can suppourt software
Inband sleep or not. So, SIBS feature should be controllable
to enable or disable base on a target.

Change-Id: Ib8c20017f2ddcd22005d361e3b2ad1045e386b4d
CRs-fixed: 549989
Merge "Bluetooth: Handle closing of UHID Poll thread from btif context"
Merge "Bluetooth: fix sniff issue with multiple rfcomm connection in same ACL."
Merge "Bluetooth: Handle Connection request in Opening state."