Bluetooth-Wipower: Opcode changes for wipower in host.

Modify host SW code to reflect WiPower VSC OpCode field OCF for
Rome 3.2 based on FW changes, i.e. OCF for wipower is been changed
from 0x0C to 0X1F.

Change-Id: If2833ee0435ed660fba9a11b9cc9973865b7bb79
CRs-fixed: 749096
Bluetooth: Handle concurrent pairing req from same device properly

- Respond with negative pin reply, if pin request comes with high
  security with pairing procedure initiated from DUT for the same
  device DUT is already in pairing state.

- This case comes, when low security profile connection, high
  security profile connections are initiated back to back from
  the same remote device.

CRs-Fixed: 750386
Change-Id: I4988c224d35353d5e1742baa45eae89cf0596823
Bluetooth: modify logic to set Dual mode device for central and LEP

This removes check for simultaneous BR/EDR and LE link support to same
device flags supported in peripheral and also removes DMT supported flags
in advertisements.

CRs-Fixed: 750023
Change-Id: I2b389bf7d65e18cf90e0fc4a68058892146a4d0d
Bluetooth: Prevent unpair due to security request

This patch prevents device removal in case where an encryption
initiated on master due to security request fails due to any
reason other than Pin or Key missing

CRs-Fixed: 750130
Change-Id: Ie07b0d727c6a6af79e3468d18590a598c2290c1d
Bluetooth: Enable IRK feature if any devices are in IRK list

This change enables the IRK feature while a direct or WL
create connection is created when the devices are already
added to the IRK list.

CRs-Fixed: 750758
Change-Id: I0a504e75744d548626a8cf0c4663c69e8052f4cc
Bluetooth: Fix Klocwork issues for BLE

This code change solve the klocwork issues for
BLE code base.

Change-Id: Iaa30612b76c4dc8ceaf2aaa34c6cf852dc3d11ae
Bluetooth: Disconnect of HOGP device takes approx 20 seconds.

Stop the timer iff service discovery is completed, Fix provided as a
part of Disconnection of HOGP device for the first time which takes
approximately 20 seconds to disconnect.

Change-Id: I095e956b3002368896b541daa682611bca33102b
CRs-fixed: 644412
HID: Fix corner case state machine handling for HID Host

This patch fixes the following issues for HID Host state machine handling
  - Retry timer was never stopped in stack in case l2cap channel was refused
    by remote device, and l2cap connection was made before timer could expire.
    This was leading to some variable corruption in collision cases.
  - UHID driver is also closed in case open failed to fix some corner case
    issues of uhid driver not closed in some cases.
  - Handling of virtual cable unplug in waiting for connection state. Without
    this some IOT issues were seen with some hid mouse which used to send
    VC unplug while connection setup was still ongoing for hid host because of
    SDP.
  - Some extra debug logs are added in code flow.

Change-Id: I851b73068a801f637eac94533a60150946d257f6
CRs-Fixed: 750415
Bluetooth: GAP: Disallow roleswitch for blacklisted devices

Set link policy to disallow role switch for blacklisted devices
as some devices not starting encryption after role switch
and a2dp connection getting delayed for some devices due to role switch

Change-Id: I07737f9ce72d68e24e4d8c460557c1ee2e8a64da
CRs-fixed: 733035
Bluetooth: Fix to resolve KlocWork issues in Bluedroid

When Klocwork is run in Bluedroid, NULL pointer
dereferences and Array Index Out Of Bounds Exceptions
were seen. This fix avoids some of these issues.

CRs-Fixed: 748758
Change-Id: I2557f7d207852bfeb8b51b164d06bdf3b3005214
Bluetooth: Remove correct feature mask if TG disabled

 - remove corect feature mask if TG is disabled

CRs-Fixed: 749575
Change-Id: I6f3ffdc214b7a493acd74b67df86fbd34c9f59f8
Bluetooth : GAP :Set the DUT default desire role as slave

Without this fix incoming A2dp connection fails from IOT
devices as DUT accepts connection with default Master role
and remote devices wont accept connection with DUT in
master role

Change-Id: I458a02fa93e03bd12bd5995ae67dd6f88bb0fea1
CRs-fixed: 751003
Bluetooth: Support to send HCI raw command to stack.

Provide an interface in stack to send
HCI raw commands to stack.

Change-Id: Id70d419c19a2b983450ebc113b8d0cca2b36ecf9
CRs-fixed: 751111
Bluetooth: Add Secure connection Only mode and Level 4 support

- Add Secure connection Only mode and Level 4 support.

- By default SC only mode is disabled. It can be enabled by
  setting the property "bluetooth.sec_conn_only_mode" to
  "true".
  - setprop bluetooth.sec_conn_only_mode true

- If the SC only mode enabled,the device allows connections
  only when the remote devcie also supports Secure connection.

- Services can make use of Level 4 support by setting the
  security required flag to BTM_SEC_SECURE_CONN.

Change-Id: I4c9508bb51793cc126029d884b37c8c3c1710d03
CRs-Fixed: 748267
Bluetooth: Unpair LE device in case of Pin missing

This change forces the host to remove the LE keys in case
the remote responds to encryption with Pin or key missing.

CRs-Fixed: 751286
Change-Id: I2ef35fab7dc028ad29aaf6eeba1235478becb749
Bluetooth: Increase limit of L2CAP links

Maximum number of connectable devices was being limited to 7 due
to defined limit of L2CAP links. The limit is now increased to be
same as maximum number of L2CAP channels, which is currently
defined as 16.

CRs-fixed: 751436

Change-Id: I4dcf9263682c02e2f0a81ce9227bde1021104885
Bluetooth: Disable SCMST feature for A2DP Sink

 - for A2DP Sink, we should not send SCMST enabled
   in GetCapabilities.

Change-Id: I7a0238d2325a96a80084a45b11fa13f4595c21bc
CRs-Fixed: 681707
Bluetooth: Update Service Availability.

 - service availability is updated on CIND response
   during SLC set-up.
 - update current service availability on +CIEV response from
   remote device.

Change-Id: Ifae3e761866815ea1c935282dd995ead00e6ce1d
Limit number of sbc frames to fit into single MTU

Calculate number of sbc frames to fit into single MTU
for EDR capable remote. This makes sure the maximum
utilization of available bandwidth keeping the bitrate
as high quality one.

CRs-Fixed: 751838
Change-Id: Ibe917a303284f3eba9f845309083cd08b78680d0
Bluetooth: Update RFCOMM test application

Register for timer and alarm call callback function and add
option in tool to send rfcomm data.

CRs-Fixed: 751644

Change-Id: I4f753217efab9e7ec0acdd513f43d6d52f7a77de