merge in klp-release (no-op)
Bluetooth Application Crash while try to pairing with laptop - IKDVXPSE-345

the handleRegistration will never run after we shutdown the handler thread first,
with this change, we can make sure the mObserver will never be null
when call handleRegistration.
bug:11148404

Change-Id: I93b351915b49cf59a7d2026b7d83a68a7e76dd38
Change pairing api/intent permission from PRIVILEGED to ADMIN

The APIs are createBond, setPin, setPairingConfirmation
The intent is ACTION_PAIRING_REQUEST
bug 11101076

Change-Id: I3b065ab0348a964bb557e57527491b2f34e68a81
Merge "Change pairing api/intent permission from PRIVILEGED to ADMIN" into klp-dev
MAP: fix problem with MNS not disconnecting correctly

MNS is needed to disconnect with the MSE but did not.
This patch fixes that by re-adding a disconnect() that was wrongfully removed during review.
Patch set 2:
-----------
 - Split disconnect and shutdown for MNS connection
bug: 11161674
Change-Id: Idd09fc774584dfdb171b0d00be0f7711ae57b853
Import translations. DO NOT MERGE

Change-Id: I75b1aeb7c88fa9a3c678f91a2d88a95fa63f80df
Auto-generated-cl: translation import
NPE in bluetooth MAP cause bluetooth process crash

bug:11448104
Change-Id: I30045162c89e2150a9ef476f33e1b322e7cc9a44
Bluetooth: Added Shared Preferences to restore tethering preference

Added a Shared Preferences to have the tethering preference persist,
The value is stored while changing the tethering preference by user
and tethering preference will be restored based on the value(last
saved tethering preference) while starting the PAN service.

Change-Id: I468564a51ff17dfdf1b95a532fa429477db0da15
CRs-Fixed: 506194, 532893
(cherry picked from commit c2dd23d9a1b277f2995119ea83d16cf46a2028b9)
(cherry picked from commit c74f8fcab58486d11f82b26a14a68fa0c09e8790)
(cherry picked from commit 10a1a41c6cdabc5f69021f907021f9dc1fcc47a3)
Bluetooth: Update SCO disconnect properly.

This change will allow to update the sco
disconnect event to be broadcasted only
after getting the disconnect confirmation
from the stack.

CRs-Fixed: 532865
Change-Id: If0e2b4b3eaa1c0f2441350a1d0181346f358a03a
(cherry picked from commit 2db056fea7e4f463eac201aa28c344de5b1759e9)
(cherry picked from commit 9cc14d35303f1b51762392cd30ee15fc65d91f62)
(cherry picked from commit 160fe919933a605d8fa10914afd122e68d803152)
Bluetooth: Query BluetoothPhoneService at BT ON.

This will allow the application to have
updated values of call states.

CRs-fixed: 506853
Change-Id: I0b1e9cdfd7ecac05062c82aa563849f49a5ae520
(cherry picked from commit 29099eb7c1f203f2537d7b944279feb0bb0f4788)
(cherry picked from commit 15a56682609df4d6e9376d0518e50b3dbd5602d8)
(cherry picked from commit bacc9984bdfe29e8e5b5e0cb94882e1a9032a043)
Bluetooth: Update the roam status.

This change makes sure that roam status
change is updated to headset immediately
instead of updating at network service state
changed.

CRs-Fixed: 503919
Change-Id: Ia5c68e2158241459f48a1718689361ad0cd6fbf8
(cherry picked from commit 4dd47da4fb0240499ee4bc082e6093ad82376d69)
(cherry picked from commit 5c717f7c8321e85204189920701b729437177574)
(cherry picked from commit 8417d5ce6f598d7af50c4d56fa084de6db0544dd)
Bluetooth: Move A2dp State to Disconnected when BT is Turned OFF

Found one timing issue where the A2dp State is Stuck in Connecting
state If User tries to connect to different headset when device is
already connected to headset and does BT ON -> OFF. This change will
allow the state to move properly when BT is turned off if any device
state was connecting previously.

Change-Id: I17bc620551bf735f39327eff59102c14551bcf26
CRs-Fixed: 532903
(cherry picked from commit 0ce6816d43761b838b65adbf1e636630e1047fcf)
(cherry picked from commit 51c4d0f1df682f3874915f99ef49ec5c3d9e74ed)
(cherry picked from commit 6583fca29318b3c8bc0b16d588fc939ffdde6142)
Bluetooth: Send Response OK to CLCC command

Found one IOT issue where OK response is not sent from DUT for CLCC
AT command which causing the delay while playing the voice mail.

Change-Id: I992d8e36ca888e6f1e3df0241361e7720630391f
CRs-Fixed: 528898
(cherry picked from commit 9a491ace8f205a37fdabcc08778832525730cec9)
(cherry picked from commit 4ffd1d7e68626dc6347ac7828c33f5b750775fac)
(cherry picked from commit b63972dcfbfdeff70baefd71ade256f34dc98727)
Bluetooth: Add trust device feature.

Add set trust feature where the remote device is marked
as a trusted device for subsequent connection.

Change-Id: Iee491db2e5b6090761a4f42467ac36ed53923fc4
CRs-fixed: 523135
(cherry picked from commit 3bb1c5cc7d0ec6c0d922b52eb96c22c80810ece2)
(cherry picked from commit f6e80df6e7f75195d8f877d21cdb9cff218724b8)
(cherry picked from commit 4039700a879872138257ca841a577840fa02e498)
Bluetooth: Clening up BT service in error cases.

If the statemachine didnt get response from stack in
8secs for any reason during BT off time, state machine
restores the BT state to on, which is wrong.
Restoring the BT state by restarting the service.

CRs-fixed: 528656
Change-Id: Iac6b1b4ba8ea0b5bd34bae5d672450e4a93fe658
(cherry picked from commit e6dc9d4bc326c01cc2edacc3150811430633946c)
(cherry picked from commit 7917ad6ed8a3919d110907401fff0f7a4bf6df7b)
(cherry picked from commit f2920dfe189e469061c8941379388905556fda76)
Bluetooth: Update the Bluetooth state in STOP_TIMEOUT case

Bluetooth adapter state is getting updated with turn off
but the same intent is not getting broad casted to the
application, so it hanged in turning off state.

Broadcasting the TRUN_OFF intent in STOP_TIMEOUT case.

CRs-fixed: 534372
Change-Id: I4f05a946e56a87ff62c6e505b6bfbfbfe7c8c951
(cherry picked from commit da24eec61839f23bae7d4dff53053fbf4888189c)
(cherry picked from commit 98eee37d49c214397c2e54e275d83f7feb0abc56)
(cherry picked from commit 1f139390de9d1db63040a21161e76af668cd81d2)
Bluetooth: Allow the HFP app to set features.

This chnage gives the flexibility to the HFP
APP to update the features supported, rather
than using the hardcoded bitmask in BT stack.

CRs-Fixed: 482189
Change-Id: I2eda57795782fbc765c5dafdbc1a68fb2b5543d9
(cherry picked from commit 3905d5b81ed5cefac47dc6b49cdf9cb529a20f55)
(cherry picked from commit dd05fb9127be0f26a0219d3e40f4c1021ef0264d)
(cherry picked from commit 962941e1ceed7f035fe13fcdccc42ad9d1e31d1d)
Bluetooth: Enabling WBS feature in BT app.

Bluetooth HFP statemachine will enable
WBS support based on reading system property.
This will enable Codec negotiation bit mask in
BRSF AT response to claim support of WBS and
codec negotiation.

Change-Id: If2c1bef8b87ce493715518206a4b30a028255dbc
(cherry picked from commit 4a9204ebaf9ac8a49ec53d93df6b3106ac7b51dd)
(cherry picked from commit f57cd1d1e0cad9bf749b1f2d5383c45f850e5b27)
(cherry picked from commit d95bed21572c63aa2aad4a523eab1685b2d980bc)
Bluetooth: HID : Add support for Set Idle and Get Idle commands

This patch adds support for Get Idle and Set Idle command handling
in jni and HidService which will be used to provide interface for
sending thse commands to HID Remote device.

Change-Id: I066d47c022905a39c11d365a9d26d128f94fe2f6
CRs-Fixed: 522511
(cherry picked from commit 186289606b666b894161e749abdc359d2bca2948)
(cherry picked from commit d1d84a3eeac8a7e0fc33f09c3259acf9efcceaa1)
(cherry picked from commit be4c95c535356905e7ff58d612fa1274d81e1960)
Bluetooth: Add support for sending priority to btif layer

This patch adds support for sending remote device priority to HID btif
layer. Now with every change in remote input device priority btif layer
would be informed.

Change-Id: I08935a9d733ccab29173ba41ddab795eccad3f7f
CRs-Fixed: 532234
(cherry picked from commit f470c4da7c22a89b234382e197eef52897ae5154)
(cherry picked from commit e43b8a111d9372ae24279254d6565107bc534b60)
(cherry picked from commit 88a6d3c327aeab2c6094536a63d3ce1249ba5b6b)