Do not abort bonding if link disconnects during SDP after Auth cmplt

If ACL link gets dropped during service search after bonding,
re-attempt service search instead of setting bond state to BOND_NONE
Bug 8611134

Change-Id: I77672d9f4feab634b3795a41e0d4e58903b5d275
merge in jb-mr2-zeroday-release history after reset to jb-mr2-dev
LE: Release transmit buffer credits

When an ACL link goes down, some controllers do not send a "number of
completed packets" update for the last ACL packets sent from the host to
the controller. This could result in incorrect L2CAP transmit window
calculations and no transmit credit to be available to send data to the
controller.
This patch restores transmit buffer creedits regardless of the
controller behaviour.
bug 9474159

Change-Id: I2540131034271a0269fa50698f370bceb7747e2d
merge in jb-mr2-zeroday-release history after reset to jb-mr2-dev
Bluedroid: Add support to send h/w error event

Bluedroid stack needs to be reset whenever H/w chip restarts
like Subsytem restart.

CRs-fixed: 514760
Change-Id: I5888f0c7a29eb540b77c789774d672180f330168
Merge commit 'android-4.3_r2.1' into merge_branch

* commit 'android-4.3_r2.1':
  LE: Release transmit buffer credits
  Do not abort bonding if link disconnects during SDP after Auth cmplt
Bluetooth: HCI: sends link policy commands while Authentication

Observed audio loss in A2DP playback, if we are not sending
HCI link policy commands during ACL connection procedure.
This is a revert of CR fix 500631.As we observed some audio loss  issues in some
Headsets like Jabra,we have made this revert.

CRs-Fixed: 516579

Change-Id: Idcb2830082a45b0a2fe562d1fcbce3afd3675714
Bluetooth: Reset Disconnect Reason on Connection Establishment

This patch resets the disconnect reason to successful on HID Interrupt
channel establishment. Without this change, wrong reason is propogated
to BTA layer on disconnection initiated either from DUT or Remote end.

Change-Id: I42641b511e44a761574faf8eafb7b0826e24aeb3
CRs-Fixed: 516328
Bluetooth: Auto connect is serialized with stack Init.

Some times Auto connect is getting triggered before stack
Initialization.

Added the connect request to the connect queue and triggering
connect queue to excecute after the Initialization

Change-Id: I4236a0b37d7a9cbfff4c058b589ce201d539c5a2
CRs-fixed: 495376
Bluetooth: Modify bdt tool to execute testcases from commandline

Modify the bdt tool so that it can be executed by sending the
command line arguments for the automation tests

Change-Id: I1c5de59c0b102862bbb9a7cc0b85653e4974ce31
Merge "Bluetooth: HCI: sends link policy commands while Authentication"
Merge "Bluedroid: Add support to send h/w error event"
Merge "Bluetooth: Modify bdt tool to execute testcases from commandline"
Merge "Merge commit 'android-4.3_r2.1' into merge_branch"
Bluetooth: Send Error for Invalid AT Command.

Some Headsets send HFP 1.6 cmds even when it is not
supported by DUT.Send error response in those cases.

CRs-fixed: 500854

Change-Id: If7745959c00fd49bd737b41a49adba9e726aa5c7
Bluetooth: Null check added before accessing the service record

Null check is being added before accesing the device record's
p_cur_service variables.

Change-Id: Iafeae9bbb7361586992435ca7142d0211e892d29
Bluetooth: L2CAP: Send HCI connect with all packet types supported

HCI create connect function is now supporting only single slot packet
during HCI connection initiation. Added support for all basic rate
packet types.

CRs-Fixed: 500631

Change-Id: Ieeb892ea43dc9bb801a8f97a644a0f8c06b8184a
Merge "Bluetooth: L2CAP: Send HCI connect with all packet types supported"
Bluetooth: Security: Handle security error codes during authentication

Handle error codes in authentication complete event with failures
like reject pairing , unspecified error.

Change-Id: I392b7531a8625efbf91bf80f7f617a6954229892
CRs-Fixed: 516087
Bluetooth: Getbuf returning invalid buffer pointer

Getbuff is checking for the pool which can accommodate
requested size, but it changing the pool with a restricted
check and not checking for the free memory size in that pool.

Added a check to avoid returng the wrong pool free buf pointer.

Change-Id: Id66d460c5a40d8c3208438d7cfaf729e9b355184
CRs-fixed: 513060