Bluetooth: HID: Add support for Set Idle and Get Idle Commands

This patch provides an interface for application to send Set Idle
and Get Idle commands to remote HID Device. Support for these
two commands was missing from exisitng code, so existing code
design is reused to add support for these two commands.

Change-Id: I548362cc328498920b2dae740f1a76b2cc2d6a67
CRs-Fixed: 522511
(cherry picked from commit e98b0a3118b9c7a72f8e65e7e080259e6f032db8)
(cherry picked from commit 14fd26713fa406174f6d770506708dbbfd8c2a2e)
(cherry picked from commit 3a40bbc088c1c09fba649d40a7670760c17d5a38)
Bluetooth: Add trust device feature.

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

CRs-fixed: 523135

Change-Id: I9bde4d7dfe07d9d63b58a661ed2413f45501bd7b
(cherry picked from commit 7ba8616bb2ba13558cdf0f00d7e1ae5b38a6ba53)
(cherry picked from commit 9bda1cf301ea06b0873d28fe1b0fcadaf2b1fb73)
(cherry picked from commit 50f4f58ae97f433b68e79a14cb662a7db9b410c9)
Bluetooth: Changes to support AVRCP 1.5

Provide support for AVRCP1.5 so that remote controller
is able to browse the list of available media players
on DUT and select the media player from the available
list of players, from remote.

Change-Id: Ia1a340d1efaa16091e684f6ff7c738ce0accaee3
(cherry picked from commit 22af77236fccc546c6bec3956b0027fc1642ba1c)
(cherry picked from commit c9bc05d824197921a44d862026b3bc352d0f6a27)
(cherry picked from commit 3fad1502e08b9ccc7ecfd3f35be4b38190d9aa81)
Bluetooth: Disable bluetooth only if BT Sevice is connected

Bluetooth service is immediately disconnected from the adapter
after SSR OR if any bluetooth services is crashed OR framework
is crashed. As Bluetooth  service is not connected OR Bluetooth
is not enabled, So BT disable should be ignored & bluetooth
persist setting should not be changed.

CRs-Fixed: 499116

Change-Id: I19de939346d014cdf918e11711f2d6066e55d054
(cherry picked from commit 33e441f5528ba3eb828adf2d163913e33b83eb4b)
(cherry picked from commit b4f7772b06701a33274cd3277f7b833fae9b2304)
(cherry picked from commit 09f007227a6bb02a7092ebe726bf7d0ca6015cf6)
Bluetooth: SAP: Add framework changes to support SAP

Bluetooth SIM access server (SAP) profile APIs added to the
framework APIs. As SAP server supports only disconnection
of SAP profile level connection this API is implemeted
along with other APIs.

It registers bluetooth state changed callback with the
adapter service,once there is a change in the bluetooth
state,it will bind/unbind the SAP service which is
implemented in BluetoothExt.APK.

SAP service, and other SAP Application layer is implemented
in BluetoothExt.APK.

Change-Id: I7215f503244c5ee277e83d60d6960f18559acfb9

Conflicts:
	core/java/android/bluetooth/BluetoothDevice.java
(cherry picked from commit 86d14a60283c2315bea8a34f24dd0c22139a136b)
(cherry picked from commit 718d372656fa7a456247c4909baac6e7104049f8)
Bluetooth: Support  HFP Client role on Bluedroid.

Implementation changes to support HFP Client role
on Bluedroid stack

Change-Id: Ie37e95d3b0e3f785af818fb495c835e420792f4d
(cherry picked from commit 072fad9a9a17c2a31660e7ac6cd6eba82d63fe50)
(cherry picked from commit 559508238c2fe1f8f10049549b8a29053399407c)
Bluetooth: Add Get/Set socket option to the Bluetooth Socket

Introduced Get/Set socket option to the Bluetooth Socket.
For these APIs it will directly call the APIs of Adapter
Service.The corresponding APIs have been implemented in
the Adapter service of native Bluetooth APK.

CRs-Fixed: 557180
Change-Id: Ic49b66599fb3c4c500e52295895d708dbc172cc7
(cherry picked from commit 80a5a8d9f465458c5417e532cc98970951f2c675)
(cherry picked from commit 5b4c228467074d2b71e02cd36c220584dba818fe)
Bluetooth: DUN: Add framework changes to support DUN

Bluetooth DUN profile APIs added to the framework APIs.
As DUN server supports only disconnection of DUN profile
level connection this API is implemeted along with other
APIs.

It registers bluetooth state changed callback with the
adapter service,once there is a change in the bluetooth
state,it will bind/unbind the DUN service which is
implemented in BluetoothExt.APK.

DUN service, and other DUN Application layer are mplemented
in BluetoothExt.APK.

CRs-Fixed: 557180
Change-Id: I6ce1204ac6138e28ad7486f2855f0f7444ad3886
(cherry picked from commit 2e60ff9becce9db20d1714786f74cb29b9ad9c74)
(cherry picked from commit ff766d48a4f6eb1b2efeaefa30f8467deefccfa1)
media: Configure audio encode parameters only for valid audio codec.

Added extra check for audio codec in profile
(Cherrypicked from commit eed39d0053dee6649424867418e511b918b3c634)

Change-Id: Ie1ac5252e3d544ce61af2b3ae5080ec9c6966e44
(cherry picked from commit 81dfde16ffb3fc8f6b110a3df2921a3d3361db10)
(cherry picked from commit 8069457a313853247f2017237e29bcf3b3eb2323)
(cherry picked from commit db4bf86a6b50ce84b5a678476ee08c12f0fe272b)
audio: add support for MSM audio formats

- Add support for EVRC, QCELP, and WMA formats
- Add definition for 5.1 channel recording
- Reference change If3676b88fa287b484ef8616c0a6b67177b61a720

Change-Id: I6b6e5ca98921adeadd2a3d76580fe85fb28eeaf0
(cherry picked from commit 10c4f204bb5ac78b9cf3854b536663ccd3d50333)
(cherry picked from commit 3f99cc5f134b0f00a52218ae1c0273cc11ae7702)
(cherry picked from commit 1d35b52c7c9cf1cfd3a3de372391a7a57f593af9)

Conflicts:
	media/java/android/media/MediaFile.java
audio: audio enhancements for playback and recording.

- Add playback and record support for EVRC, QCELP,
  WMA, AMRWBPLUS, WAV, ACE, and EC3.
- Add support for 5.1 channel recording.
- Add support for in call music.
- Add constants for call_state and vsid.
- Add definition for FM and proxy audio devices.
- Remove unnecessary format checks in frameworks.

Change-Id: If3676b88fa287b484ef8616c0a6b67177b61a720
(cherry picked from commit 6ca6cc15af88992ea485a458e67a8546b156672e)
(cherry picked from commit f65028d1752969bf43c853c1bb12ecd12055d5e8)
(cherry picked from commit b1952442db41188b74f331bd2397a579424821ab)
audio: aapt Support for mxmf file playback

mxmf files couldn't be played.
Added .mxmf file ext to kNoCompressExt array
CRs-Fixed: 465437

Change-Id: I4473380c0aa13f7c18b59aa48f07a87f7849a74c
(cherry picked from commit 42e898c4533e1c9adb37b45c1052414db0eba255)
(cherry picked from commit 40fedd02af600d221488f035abf8fe9d6a8ca215)
(cherry picked from commit 8a98792909ec37bf080a337e941b74c003a01c41)
  audio: Support for MSM audio formats

  -Add audio format support for Voip.

Change-Id: Ie045ba926b3e1266afd3fb6fba09af3a55daaeef
(cherry picked from commit d1810964ecd2d50064a1fed51049ddc354b9a788)
(cherry picked from commit cd9c6dc56bedcabca77c2a01c6fb15f4d2e8edd5)
(cherry picked from commit 01c09aeae38716860ef1a806985cc946dca93f60)
audio: libaudioeffect_jni GREF leak fix

- Excessive JNI global reference in AudioEffects.
- Global references created during native setup
  are not deleted.
- Global references are deleted in setup failure
  and during native release.

Change-Id: I3c90f3a00b2552b4b783375928afc94a7e441449
CRs-fixed: 413633
(cherry picked from commit f60e70097b84c4ef26eeb31024d52e5b1fc8aa64)
(cherry picked from commit 9c9279277ad10582ff3dcf5cad576d2d7f036569)
audio: Fix to enable USB volume during music playback

- The USB device had been added to the mFixedVolumeDevices
  because of which volume change was disabled for music
  stream
- Fixed by removing the USB device from the
  mFixedVolumeDevices.

Change-Id: I82b1876d152030ddcfe9ffc31924b6abe4b2509a
CRs-fixed: 439858
(cherry picked from commit b7ed482f7654d5657fb7497a95cc007229478886)
(cherry picked from commit ae67047a3f95ddde2565a76c44254ad714d3109d)
audio: Fix to remove exception in tonegenerator

- Framework reboot happens, if tonegenerator fails to create
  a track in audioflinger.
- The cause for framework reboot is, an exception thrown by
  tonegenerator if fails to init.
- Fix is to remove the exception and delete the tonegenerator
  instance.
CRs-fixed:466491

Change-Id: Ie7b87f787d8a885cc70be9af4ba9d04ecd691cc2
(cherry picked from commit 1cf494eddfef8f6c0c68dc28cd27203980d1767b)
(cherry picked from commit adf8475157fd8cba9ef527702f7b34f6335554eb)
MAP: Support MAP Server role on Bluedroid with javax.OBEX lib.

Handle No END OF BODY for MAP 1.0 Server Get request. Only the
last packet need send the 0x49(End of Body). For intermediate
packets, we need to send 0x48 (Body).

Move definitions for MAP or FTP Service Specific UUID and
Request type for CONNECTION_ACCESS_REQUEST intent to
BluetoothExt APK.

Change-Id: I04cfeb8d53b8f8c19160a2de1eb448a7ec1f2c41
CRs-fixed: 504042

Conflicts:

	obex/javax/obex/ClientOperation.java
	obex/javax/obex/ServerOperation.java
(cherry picked from commit 375d8f5e964263eadeeadd312384c1f8ebf9ff21)
(cherry picked from commit 7788ff7b9ff1ff5adbd38d9b7d8584d6a127dad6)
(cherry picked from commit 717672648b06678e3d1f10aa1f5c8791b4add846)
OBEX: Implementation of MAP and PBAP client role on Bluedroid.

Implementation changes to support MAP client and PBAP client
role on Bluedroid stack.

Change-Id: Ic75e0bea10b8420aef928d868cc25acd769d5620
CRs-fixed: 530274
(cherry picked from commit 8a9036e632092e7311e5009cb96a016b52bbacca)
(cherry picked from commit 1e4719192c82f89d0b2dba67ec99c72c77060f9a)
(cherry picked from commit abb73fd0ef2dd64c44944cff99dc81c1fd368d36)
audio: Define Proxy device

- Added Proxy device changes

Change-Id: I47921d696171de40bcfc30ebf99d4cafa0d4d4a3
(cherry picked from commit a8b7ed78ec088bc6924854661bacde51d7194ab3)
(cherry picked from commit cff61cfd964a1150919d9bfa7ec0ebfe35d5f247)
(cherry picked from commit bf8f7a2a574cb2e6aafae3efa6e4ee163ef65cf7)

Conflicts:
	media/java/android/media/AudioSystem.java