Fixes random host disconnection after establishing connection

Host starts encryption twice when the remote device is
already paired. The host sends disconnect when the
second encryption attempt returns failure. This fix
avoids duplicate encryption attempt.

Change-Id: I8ec5c4a953180ec17585aece757810421bc44aae
Fixes pairing and unpairing issues with BLE devices

After BT off/on, already paired BLE device is showing
up as unpaired. Already unpaired BLE device is
shown as paired after BT off/on. This change fixes this
issue.

Change-Id: I2b1d8c3cbb8c69350d9853195eec9c9ceee702fd
Bluetooth: Do not go for inquiry in BONDING State

This patch fix a special case where DUT is paired & connected
with only one device, which has capbility to intiate paring as
soon as DUT unpair same remote device. As DUT is paired with
only one device, In this case Once DUT unpair remote device. DUT
goes for inquiry & at same time remote device initiates pairing
if Bludroid stack recieve pairing request before the inquiry
start then DUT should not go for inquiry, As DUT is already in
BONDING state.

CRs-Fixed: 481263

Change-Id: I0e1ec0fdb963921629e5c52f495ae2013e679a03
Bluetooth: Add trust Device feature in bluedroid

Add set trust feature where the remote device is marked
as a trusted device. We store the trusted property of
remote device in NVRAM and use it for subsequent connection.

Change-Id: I78228f4c47b52e111a2b4d1d4bfa794b1999707e
CRs-fixed: 523135
Merge "Fixes random host disconnection after establishing connection"
Merge "Fixes pairing and unpairing issues with BLE devices"
Bluetooth: HID: Add support for Set Idle and Get Idle commands

This patch adds support for sending set idle and get idle commands to
remote HID device, on receiving the function call from upper layers.
Also on reception of get idle time from remote device, upper layers
are infrmed using registered callback.

Change-Id: I14bc2dc349354fd87ef8aba25357514398532e87
CRs-Fixed: 522511
Fixes BLE HCI commands concurrency issue

Removes HCI LE Read Remote features command call
to prevent the concurrency between this command and
HCI LE start encryption command.

CRs-fixed: 517330

Change-Id: I6445ab8095a4261c2a3f84acea1c546e6924f50d
Merge "Bluetooth: HID: Add support for Set Idle and Get Idle commands"
Bluetooth: Bug Fix for Cancel Inquiry

During the interleave scan, the cancel discovery called at
the time of second LE scan was not cancelling the LE scan.

Change-Id: Ife1f939da7a1baf0dec2279ae810081793d47f7a

CRs-Fixed: 533041
Merge "Bluetooth: Add trust Device feature in bluedroid"
HID: Initiate SDP if remote HID device is not in List

This patch tries to initiate sdp to devices which try to iniitate
pairing and then immidiately afterwards sends HID Control L2CAP channel
establishment request. Since device was not added in HID Database, control
channel request was rejected, resulting in disconnection from remote hid
device. Now we try to initiate SDP after sending L2CAP conection pending,
so that if successful device record is updated and then we accept L2cAP
channel by sending connection successful.

Change-Id: I7c3907a38e819bbc83e5b03c52560d8da7cf8073
CRs-Fixed: 502447
Bluetooth: Initiate RNR for HID Pointing Devices if no name.

This patch initiates Remote Name Request for HID Pointing devices in case
name is not known before initiating HID L2CAP Connection. Once remote name
is retrieved, name is stored in NVRAM and upper layers is informed
of name of remote device.

Change-Id: I6ecf07c222f804dcfcedd84fc1ff26ffe5bcbdc8
CRs-Fixed: 519771
Merge "Fixes BLE HCI commands concurrency issue"
Merge "HID: Initiate SDP if remote HID device is not in List"
Merge "Bluetooth: Initiate RNR for HID Pointing Devices if no name."
Bluetooth: Send Interrupt req only when control is configured

This patch sends HID Interrupt Channel connect request to remote device
only when HID control channel has been fully configured, i.e. both sides
have sent and received configuration request/response for Control channel.
Without this patch it was seen that DUT was initiating Interrupt channel
request as soon as config request was received from remote side and before
sending config request to remote side.

Change-Id: I408f3a6f315c9a308717a138755e4d43a50a4b7a
CRs-Fixed: 532763
Bluetooth: Inform Power Manager about HID Host Connection.

This patch informs Power Manager about HID host connection complete
status which in-turn starts the inactivity timer of 30 seconds for
sending the sniff command on timeout if the ACL mode is still active
on timeout. Without this patch, if remote device is not initiating
sniff on HID ACL, host was also not initiating sniff, resulting in
unnecessary power consumption on ideal HID Link.

Change-Id: Icbe34e855112800b07f98f40dd7c6ae5e91c4cf6
CRs-Fixed: 531573
Bluetooth: Check for codec status before start stream.

On Enabling SCMS_T feature by enabling BTA_AV_CO_CP_SCMST_T,
Crash is seen as Codec setup fails and still DUT sends
AV_STREAM command, media task access pointers which are still NULL
due to failed codec negotiation resulting in Crash.
Fix involves check if codec setup fails AV is disconnected.

Change-Id: Ia6ee25a2c6b696e7ab930d81c0a89a182065032c
CRs-Fixed: 493784
Merge "Bluetooth: Do not go for inquiry in BONDING State"