MAP: Implementation of MAP Client role on Bluedroid.

Implementation changes to support Message Access Profile
client  role on Bluedroid stack.

CRs-fixed: 530274

Change-Id: I209909a2b18e43c7931571526b983453795f6c6b
Bluetooth: Get Scan mode from storage

After BT is turned ON scan mode is get from storage, which have stored
the previous scan mode state.

CRs-Fixed: 519661
Change-Id: Iaa4bafb32381cd146f5dc6343651df61b7bdb301
Bluetooth: OPP : Check for interrupted status before sleep

If the Thread is interrupted before sleeping, interrupt will
be discarded and the main thread waiting on join will block.
Checking the interrupted status before sleeping eliminates
this issue.

Change-Id: Ic11f8d74d27fef2ba078062cf7d67c1d1691e03a
Bluetooth: Truncate received OPP file name instead of rejecting it

Including extn of the file, Linux supports 255 character as a maximum
length of the file name to be created. Hence, Instead of sending
OBEX_HTTP_INTERNAL_ERROR as a response, truncate the length of the
file name and save it. This check majorly helps in the case of vcard,
where Phone book app supports contact name to be saved more than 255
characters, But the server rejects the card just because the length of
vcf file name received exceeds 255 Characters.

Change-Id: Icaceddbfd7b9431712f7b98b601016e753b1569c
Bluetooth: OPP: Update the user confirmation with proper value

User confirmation for the Incoming Files is updated in the Array
from the Database. There are two Database reads, the first read
is used for evaluating the user confirmation and the second read
to update the information in the Local Array. The stored
information in the Array will be used to evaluate a change in
its value in the database. Because of this, if there is a change
in the database from the point of first read to second read, the
value stored in the array would be different than the value
evaluated. In this case the evaluation during next updateShare
call will not see any change in user confirmation value in database
and array and hence will not result in Notifying the ServerSession
which is waiting for user confirmation.

Change-Id: I382f9cccf63a8f53f46bb84639ab1345f784ad43
Bluetooth: Do not terminate session when a Batch contains an empty file

If an empty file is rejected by the remote device, client session is
terminated and remaining files in the batch also marked as failure.
This change continues to send the pending files in the batch even an
empty file is rejected by the remote device. Also it provides appropriate
message to the user.

Change-Id: I0a48e1fb652c51b8e7eb8fa1c9a66efe99acd3d2
Bluetooth: Mark proper file transfer status upon OBEX response timeout

This patch will handle the scenario of obex timeout which occurs due
to cancelling the transfer in between and trying sending again.

Change-Id: I92a269be6cd7e972ddc98b10f036b19e7aebbbe5
Cleanup Opp session during ACL disconnect

Process ACL_DISCONNECT message in OPP module to clean up
the transfer related data as soon as ACL is disconnected.
This removes the delay we observe in displaying File not received
message when Remote device's Battery is abbruptly taken out
or remote disconnects the ACL when authorization request is in
pending state in DUT.

Change-Id: Ie749990987e43a02636c4e573e706f615e58fe7b
Allow an empty file information to be stored in ContentValues

OPP implementation doesn't store an empty file information in
ContentValues though the file has a valid URI info and it is allowed
to transfer an empty file to the remote device. Due to which, in OPP
file transfer history it became an unknown file. The change enables
OPP to update the valid empty file info in ContentValues which can be
processed by a ContentResolver.

Change-Id: I852bf0d51dc00325854ff1e76436cf4f104ac85c
Bluetooth: Close cursor object to fix the leak

This patch will close the cursor after deleting
the file to avoid the leak.

Change-Id: I8982ac25fae7f239cb14b8038ab094ec3fa6a4ee
Bluetooth: OPP: Handle Try Again exception to retry write

When the write to socket is faster than BT maximum throughput
socket buffer gets full and it returns EAGAIN, writing application
has to retry in this case. This return value is thrown as exception
from JNI layer and has to be handled properly to retry the write
operation.

Change-Id: I14db1d85a2e406cf70ae3687db8b727baaba782b
Bluetooth: OPP: null check for optional header length

Adding null check for optional header length in put request
to avoid NUll pointer Exception.

Change-Id: Iac3b96b3803fb0ac83a41e75b7dcc6ce1f7c982f
Bluetooth: OPP: Change for updating BT recipients prompt information

This patch adds changes for getting the updated name of the BT recipient
during OPP in case the device name is getting changed in between the two
consecutive transfers.

Change-Id: I0d2102343638b693fe6e02bf27ac4c603ff86962
Bluetooth: OPP: Add locale support for OPP file transfer progress text

Display string '%' item in format progress text through localized
version of getString() instead of as hardcoded item from code.

Change-Id: I7ee432af21ced052130c90b66457a5476ba7b96e
Bluetooth: OPP: Display proper name while cancelling transfer

Saves names of all the selected files to be transferred even
before starting of client thread so that names remain intact
in the outbound information even when the batch is cancelled
from initiator.

Change-Id: I1763e6fee04dc8bbac943ec1db4d739d46f40939
Bluetooth: OPP: set csv format as acceptable shareinbound types

Adding csv format to acceptable inbound types, to be able to
receive these file formats from remote device.

Change-Id: I4ef8da4672d021412f806276c9bc292db17bf0c5
Bluetooth: OPP: Restart OPP service on ACL disconnect

Whenever OPP service is forcefully stopped, it will get
restarted on reception of ACL disconnected intent from frameworks.

Change-Id: I8b976c44dc5edd62288fd87abd84a1831e820957
Bluetooth: Avoid Broadcasting ACTION_DISCOVERY_STARTED intent again

This change will avoid broadcasting ACTION_DISCOVERY_STARTED intent again
if mDiscovering is set. Otherwise some of the currently discovered devices
are removed from device list.

CRs-Fixed: 523374
Change-Id: I1166f59d48229213c554a53a10aca9078a5aa5cd
Bluetooth: Synchronize Virtual Call,Voice Call and A2dp

Found some IOT Issues were headsets behave abnormally if there is
START or SUSPEND over AVDTP in between call indicators sent for
Voip calls. This change will make sure A2dp is Suspended before
sending call indicators and Starts once the Virtual call is Ended.

Change-Id: Iaef6c08b593581112519e53a5d73086fd1539b99
CRs-fixed: 503739,516722
Merge "Bluetooth: Get Scan mode from storage"