Bluetooth: Disconnect SCO for In-Band Ringtone.

 -Disconnect SCO when remote sends RING indication
  even after disabling in-band ringtone.

Change-Id: I6955de8a7dd192aea492b768dd80343a32ca1cc0
CRs-Fixed: 751075
MAP: PushMessage Email parsing issue

Handle illFormated BMessage email parsing
issue for not rfc822 complaint body format.

Change-Id: I0370d63f0042ce59a947dcc72d19f7c1ec8ea3bb
CRs-fixed: 752501
Bluetooth-OPP: Start Notification when transfer starts

Notification thread will start when there an ongoingtransfer and
terminate when transfer is finished. Otherwise, new thread will be
created at every 1sec.

CRs-Fixed: 745331
Change-Id: I287b1b4e6c92e260cae2a931f2e6d5c0a08823ac
Bluetooth: Validate SCO device.

This change makes sure that active
SCO device is vaidated before using it
to send the volume changed event to stack.
A NPE happened when audio updated the SCO
volume changed event at the time when
SCO was disconnected and the SCO
active device was null.

Change-Id: I56a2b05a832ae01dad9f325baad79fd46640c81c
CRs-Fixed: 752481
Bluetooth-OPP: Monitor display status during transfer

Check the status of the display during ongoing transfer to avoid
creating new update threads for updating the transfer progress if
display is off. Otherwise, power consumption will increase even
though display is off because of starting new thread every one
second.

CRs-Fixed: 745331
Change-Id: I862a163d31cf9a174e907ccb48b92e7cf77b4441
Bluetooth: Allow all pass filter if filter value is empty

This change ensures that the ALL pass filter is created only
if the filter size is 0 or empty and removes incorrect logic
that prevents adding more than 2 filters for batch scan or
regular scan

CRs-Fixed: 752797
Change-Id: I43502267bfc2c303ff0ca60cf9498eae04953ce9
MAP: Fix sent and delivery pendingIntent updatation for pushMsg

Set unique request code for PendingIntent.getBroadcast to get
the updated info of message handle(s) for pushMsg multiple
recipients case.

Change-Id: Ib36384734a0a8d534acab4a052378ffcbb09b4b1
CRs-fixed: 749034
Fix to avoid the invalid state of profiles

Due to STOP_TIMEOUT followed by ANR crash, we need to
kill the process similar to DISABLE_TIMEOUT case.

Change-Id: I89cc46481610457142b479acb68de224b1eecda3
Bluetooth: Cleanup the handler threads properly

Cleanup the handler threads in Advertisementmanager
and ScanManager so that there are no resource leaks

CRs-fixed: 749335

Change-Id: Ia51899f449d57c1ef68a9516b8472d1fd492572b
Bluetooth: NPE and Memory leaks.

Fix NPE and Memory leak identified by
static analysis.

CRs-Fixed: 747566
Change-Id: If73882341f7dfb2aaa2756be6ebbbb96fb779085
Properly handle NowPlayingList Browsing commands

Properly handle NowPlayingList Browsing commands
by ensuring the following:
  - Change data type to store Max value of End index.
  - Change implementation to properly handle request
    for any un-supported attribute.
  - Properly store and use start index offset while
    responding with items in NowPlayingList.

CRs-Fixed: 753306 753307 753310

Change-Id: Iccce0ab0577277ebc5107c4e52ef1013eaeaeab3
Bluetooth-OPP: Remove OBEX session cleanup from OPP Service

OBEX session cleanup should be initiated from corresponding session
instead of OPP Service. Otherwise, during batch transfer if next file
in the batch starts before updating the previous transfer that will
lead to mismatch in status. This will cause UI progress bar stall
and transfer failure.

CRs-Fixed: 756084
Change-Id: Ibfa787396fe5f4f5b678ebcb4bdd36cb6641a161
Bluetooth: Do not accept SCO without any active listener.

 - Some HS re-connect SCO after call disconnect.
   do not accept such incoming connection SCO connection
   requests.
 - Check for valid SCO listener before accepting incoming
   SCO connection requests.

Change-Id: Iab5853382413467dfc7514587f50894fe11c9633
CRs-Fixed: 754738
Bluetooth: Fix Klocwork issues for gatt

Code changes fix the klocwork issue in gatt.

Change-Id: If9e5a1bcddf3aa50220d11a3be6940ae60facdff
Bluetooth-OPP: Use long data type to contain receiving file size

If receiving file size is in GBs int type will not be able to contain
actual size and will lead to failure. So change to long instead of
int.

CRs-Fixed: 756089
Change-Id: Idc069eb59311d4e56013454ae10b0ecd37314ddd
Bluetooth App: Fix to resolve Klocwork issues in Bluetooth App

When Klocwork is run in Bluetooth App code space,we see many
Null pointer exceptions which were resolved by this fix.

CRs-fixed: 760114
Change-Id: I0c12a5ce37243695a839d0f976917da27d7fa989
AVRCP: Properly handle player set attribute response

Properly handle player set attribute response

Change-Id: I5efd1fb05c145ba5201e5e8c090a4e1dc3e993bd
Bluetooth: Dont loose focus for remote suspend only in case of call

- in case of remote suspend being initiated as a result of MO/MT
  call, we should not abandon focus.
- abandon focus in other cases of remote initiated suspend.

CRs-Fixed: 761419

Change-Id: Ic2ffe4f66814188f9a6bc4e1c2fee198347e03b0
Proper retrieval and storing of metadata

Proper retrieval and storing of metadata

Change-Id: I5593f1f6231af012237f0468614110f27c7cdcc2
Bluetooth-OPP: Keep Notification thread running when transfer is via NFC

OPP notification thread should be running when file transfer is
via NFC because NFC module is listening to TRANSFER_PROGRESS intent
from notification. Otherwise, after 20 seconds NFC will turn OFF BT
and cause transfer failure.

CRs-Fixed: 762328
Change-Id: Ibf40439f1c304e878eb90bfa805d6994eb878c83