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
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: 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
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."
Check if BLE is enabled before using it

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