LE fixes

- Null pointer exception check added.

An exception occurs at the memcpy in the bta_dm_gatt_disc_result.
User removed the battery on Ble device(Smart Nudge) during bonding
and connection. This exception occurs sometimes.
I used Broadcom LE Explorer to reproduce it.

- Fixed disconnect and encryption behaviour

Disconnect will now disconnect the physical link immediately when no
other application is interested in the device anymore. Also, the
connection to a remote device is now dropped if encryption fails.

- Deep copy buffers when transfering context

Certain BTA server event types require a deep copy of the request
data buffers when transfering context. Shallow copy of the pointers
involved may cause a crash when overlapping read and write requests
are received.

- 2nd encryption has not started

need to send encryption complete callback
when the encryption fail due to link drop without a complete event.
Otherwise BTA layer would not be able to clean up the status,
and no further encryption can be started.

Change-Id: If93e0a188e8779830c8991e4193b96dc95e23e5d
am ca22ac49: LE fixes

* commit 'ca22ac493ab777199084d87b3c7627e7f27555af':
  LE fixes
am 1f9a190b: Merge "Initial version of Stack for AVRCP 1.3" into jb-mr2-dev

* commit '1f9a190b457f6a0e8effd47998014cb724fdb085':
  Initial version of Stack for AVRCP 1.3
am 3aa60544: Parse LMP features to enable LE support

* commit '3aa60544585b5fb0f35c1165539a4a859fc0f25c':
  Parse LMP features to enable LE support
am 081d6e54: need send reject response to unsupported Avrcp 1.3 command

* commit '081d6e548bed5a91c0ba9abda518c06a1b0ba7f5':
  need send reject response to unsupported Avrcp 1.3 command
am 3bfd7b73: need free the buffer to avoid memory leakage when send Avrcp packet

* commit '3bfd7b73886c44505ba56894ee6f3c914eb54409':
  need free the buffer to avoid memory leakage when send Avrcp packet
am 841e5b50: Reject element attribute request if count is 0xff

* commit '841e5b5092bcdbc1acffd6cf7255ec423fe15fdb':
  Reject element attribute request if count is 0xff
am b88fc6cb: Add support for PLAY_POS_CHANGED

* commit 'b88fc6cb5636c4af17077502fe3313ffb32d93ee':
  Add support for PLAY_POS_CHANGED
am 0082e027: Fix LE buffer size for 0 length buffers

* commit '0082e027d5ae3f45a3a613ed720c31e35f61d0eb':
  Fix LE buffer size for 0 length buffers
am 4c433bea: LE: Avoid LE connection to a non-LE device

* commit '4c433beabd1f81b17bb49fb9b57925caef8613a3':
  LE: Avoid LE connection to a non-LE device
am 946c681e: Fix LE background connections not adding device to white-list.

* commit '946c681e59451164b343b7ab9415aa73b0d176bc':
  Fix LE background connections not adding device to white-list.
Save the HID info into storage while adding device

Previously HID device info was not saved immediately to NVRAM, thus
when device was rebooted sometimes the hid information was missing
from NVRAM, thus host does not identify the HID Device
bug 8192743
Change-Id: I7ca8b607399e141fa851242e83c1c6d3854384f8
Merge "Save the HID info into storage while adding device"
am e154aba5: Merge "Fix typo around BLE_INCLUDED inclusion bug 8566685" into jb-mr2-dev

* commit 'e154aba52b54dda214bf31ecc383159faf0a6f3f':
  Fix typo around BLE_INCLUDED inclusion bug 8566685
am 7ffe8967: Proper handling of HCI command status event

* commit '7ffe8967a9774280b88655e28bda2206dc75af34':
  Proper handling of HCI command status event
am 2f338f25: BT: JV rfcomm socket sniff support

* commit '2f338f25530d2aaab7acf45701c271d10b81d96d':
  BT: JV rfcomm socket sniff support
am c2bb2c13: Read the extended feature after ACL channel creation

* commit 'c2bb2c13030b2b48b861eac31f4eb134975fa8c5':
  Read the extended feature after ACL channel creation
am 2c7778fd: Merge "Add liblog" into jb-mr2-dev

* commit '2c7778fd055025367f96dca357dcf46e6fcd46cb':
  Add liblog
am 9d140a9d: Make host side of Read Local/Remote Extended Features more reliable

* commit '9d140a9dc432e457a0437920d5f84c22e3baea0d':
  Make host side of Read Local/Remote Extended Features more reliable
Reconcile with jb-mr2-release - do not merge

Change-Id: Ic568762f0902a0c814109a0f40938606e50f0dfe