Bluetooth: Set sniff subrate with optimize latency value on HID link

- If HID is connected & SCO is active, then disabling Sniff subrate
  to fix connection timeout on HID link.

- If HID is connected & SCO is not active. Setting sniff subrate with
  optimize value based on the remote parameter to fix connection
  timeout on HID link to avoid HID IOT issue.

Change-Id: I6d60df88ea33e00b0fb173447351da4874dc97e5
CRs-Fixed: 635632
HID-D: Don't always remove pairing on reception of VC unplug

This patch prevents DUT acting as HID Device from removing bond related
information of remote device, on reception of virtual cable unplug in
cases when some other profiles apart from HID are also connected on same
ACL on which hid profile is connected. Wihtout this patch it was observed
that other profiles were also getting disconnected when DUT started
unpairing process on reception of VC unplug. Now bonding information
would be removed only when HID is the only profile connected on same
ACL when VC unplug is sent/received on HID Device side.

Change-Id: I847192d2eb524e6bda4b48ec71e48248a55ccb6a
CRs-Fixed: 631310
HID: Prevent freeing buffer twice during set report

This patch fixes freeing of buffer twice during set report. Buffer is
already freed by l2cap layer while sending data to hci layer, so
freeing the same buffer using GKI_freebuf was resulting in warning
exception. Now buffer is just assigned to NULL so that it can be reused
again without the need to free again on reception of handshake event
for set report.

Change-Id: Icb81ec6442ba6d57a1461acc8a5fc48b56075668
CRs-Fixed: 637714
Bluetooth: Start preload timer before sending preload request

 - Retry mechanism on preload timeout.
 - Start preload timer just before sending preload request.

CRs-Fixed: 613616
Change-Id: I6906ec25b4756ec0cf66e94e2afd8a712d00be3d
Bluetooth: Set rendering bit in COD for A2DP Sink

 - set rendering bit in case A2DP Sink profile is enabled.

CRs-fixed: 634859

Change-Id: I9bfe17631f11f796ce7512d05970245ca878950a
Bluetooth: Proper AV state movement.

On incoming connection request update
app for connection before checking for
priority of device.

Change-Id: I0d9cb2f297d3286a709ecbbc94cd67ccf7c9e814
CRs-Fixed: 610053
Bluetooth: Handle Open after set_config

 - handle priority check from idle state
 - handle open after set_config
 - changed queue size to 24

Change-Id: I834c4c577f14d7d0e6a00a52aac7fe6bc989a95f
CRs-Fixed: 631557
Bluetooth:CoreStack: DUT Stack Logging

   DUT stack information logging:
   -L2CAP configuration parameter,
   -Device role information
   -L2CAP flow control and congestion information
   -L2CAP State machine and events
   -RFCOMM credits count

Change-Id: I6e74bdb1cda4455c50314f67bbcd19accd3c31e4
CRs-Fixed:602294
Bluetooth: Prevent unpairing if encryption returns conn timeout

This patch prevents the device unpair in case the Encryption command
returns with a status of connection timeout (0x08).

Change-Id: I54fba8cfedd5e8b30e1af928bc232f32dd965545
CRs-Fixed: 631046
Bluetooth : Ignores Included service read response event of HOGP remote

This discards if remote sends response with invalid handle value pairs
for read response for included services read by type request sent by
hogp device

Change-Id: I61bd715118444a117b074111ed9dd6a182920eb8
CRs-Fixed: 616492
(cherry picked from commit 298b830303c6de401df0ada68dedfa95b26344d6)
Bluetooth: Handled delayed info rsp from remote during SDP

DUT initiates connection with out waiting for information response
from remote device during SDP.

Change-Id: Iee0251f8f81923b1291983b66b31c78e14d21af0
CRs-Fixed: 635697
Bluetooh: Fix for BTIF context stuck while updating INQ Responses

Fix for BTIF task getting stuck while updating the inq responses
and not coming back to gki wait, resulting BT becomes unresponsive

Change-Id: Ic752ca3f89165a3d33b0134d251ecceb24f08fb9
CRs-Fixed: 636123
BT:Don't open SCO on state change for multi party call on DUT.

When multi party calls(1 active, 1 held) are ongoing on phone
speaker and any of these call drops, do not open SCO for
other call since user expects call to still remain on phone
speaker.

CRs-Fixed: 645652

Conflicts:

	btif/src/btif_hf.c
	btif/src/btif_multi_hf.c

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