bluez/android
Szymon Janc 4250d2bf13 android/bluetooth: Fix not marking device as bonded
Any permanently stored key is indication of device being bonded.
2015-02-27 09:49:18 +01:00
..
audio_utils android: Add resampler support 2014-05-13 14:17:18 +03:00
client android/client: Fix Send Pass Through command 2015-02-19 11:48:32 +01:00
compat android: Rename compat_includes to compat 2015-02-15 15:41:02 +01:00
cutils android/hal: Add helper for quering config from Android properties 2014-09-22 16:31:09 +02:00
hardware android: Update Android system headers to 5.0 API 2014-11-07 12:51:27 +01:00
system android: List all enum values in switch 2014-12-08 14:00:29 +01:00
a2dp-sink.c android/a2dp-sink: Fix including wrong log header 2014-12-10 13:18:43 +01:00
a2dp-sink.h android/a2dp-sink: Add skeleton for a2dp sink daemon 2014-11-25 20:57:07 +01:00
a2dp.c android/avdtp: Refactor local SEP list handling 2015-02-22 21:26:25 +01:00
a2dp.h android: Pass mode parameter to registered services 2014-03-04 10:18:27 +01:00
Android.mk android/avdtp: Refactor local SEP list handling 2015-02-22 21:26:25 +01:00
audio-ipc-api.txt android: Update Audio IPC documentation 2014-01-24 22:59:45 +01:00
audio-msg.h android/hal-audio: Allow to autoselect endpoint in open_stream IPC 2014-06-01 10:17:16 +03:00
avctp.c android/avctp: Add define for AV/C data MTU and offset 2014-06-06 11:17:07 +03:00
avctp.h android/avctp: Add define for AV/C data MTU and offset 2014-06-06 11:17:07 +03:00
avdtp.c android/avdtp: Remove extra check 2015-02-22 21:26:25 +01:00
avdtp.h android/avdtp: Refactor local SEP list handling 2015-02-22 21:26:25 +01:00
avdtptest.c android/avdtp: Refactor local SEP list handling 2015-02-22 21:26:25 +01:00
avrcp-lib.c android/avrcp-lib: Use proper type for accessing rsp 2015-01-02 20:46:26 +01:00
avrcp-lib.h unit/test-avrcp: Add /TP/MCN/NP/BV-07-C test 2014-10-16 15:38:43 +02:00
avrcp.c android/avrcp-lib: Rework callback return 2014-10-16 15:38:43 +02:00
avrcp.h android: Pass mode parameter to registered services 2014-03-04 10:18:27 +01:00
bas.c android/bas: Read battery level characteristic 2015-02-26 11:27:40 +01:00
bas.h android: Add initial implementation of Battery Service client 2014-06-29 14:52:36 +02:00
bluetooth.c android/bluetooth: Fix not marking device as bonded 2015-02-27 09:49:18 +01:00
bluetooth.h android/bluetooth: Add API to check if device is bonding 2014-12-19 09:44:48 -02:00
bluetoothd_snoop.te android: Provide SELinux policy files 2014-12-24 11:01:53 +01:00
bluetoothd-snoop.c shared: Move mainloop implementation from monitor to shared 2015-02-12 12:32:07 +02:00
bluetoothd-wrapper.c android/bluetoothd-wrapper: Fix indentation 2014-09-22 16:31:09 +02:00
bluetoothd.te android: Provide SELinux policy files 2014-12-24 11:01:53 +01:00
cts.txt android/doc: Update cts results for Android 5 2014-12-01 14:11:15 +01:00
dis.c android: Add explicit include for lib/bluetooth.h 2015-02-18 06:23:04 +01:00
dis.h android/dis: Add bt_dis_set_notification 2014-06-29 14:52:36 +02:00
gatt.c android/gatt: Fix Find By Type request 2015-02-22 20:56:07 +01:00
gatt.h android/gatt: Add API to remove autoconnect GATT based device 2014-09-05 11:07:48 +02:00
hal-a2dp-sink.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-a2dp.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-audio-aptx.c android: Replace new0 with malloc call 2014-09-25 15:05:59 +02:00
hal-audio-sbc.c android/hal-audio: Fix compilation errors with musl 2014-09-24 21:31:13 +03:00
hal-audio.c android: Remove temporary BLUEZ_EXTENSION flag 2014-11-07 12:51:27 +01:00
hal-audio.h android/hal-audio-aptx: Add initial support for aptX codec 2014-06-06 11:27:45 +03:00
hal-avrcp-ctrl.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-avrcp.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-bluetooth.c android/socket: Add support for dynamic MAP record 2014-12-10 14:31:55 +01:00
hal-gatt.c android/hal-gatt: Fix missing IPC handlers on KitKat 2014-12-15 11:49:48 +01:00
hal-handsfree-client.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-handsfree.c android/handsfree: Add initial support for configure WBS commmand 2014-12-19 14:26:47 +01:00
hal-health.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-hidhost.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-ipc-api.txt android/handsfree-client: Fix connection state defines 2015-02-09 13:30:56 +01:00
hal-ipc.c android/ipc: Remove unneeded check 2014-08-01 13:30:34 +03:00
hal-ipc.h android/hal-ipc: Pass FD to notification handlers 2014-06-12 13:04:31 +02:00
hal-log.h android/tester: Make HAL logging wrapper print to stderr instead of stdout 2013-12-11 13:10:07 +02:00
hal-map-client.c android/map-client: Don't check if interface is ready on init 2014-12-18 18:17:11 +01:00
hal-msg.h android/handsfree-client: Fix connection state defines 2015-02-09 13:30:56 +01:00
hal-pan.c android: Fix crash on android-tester 2014-12-03 13:59:13 +02:00
hal-sco.c android: Remove temporary BLUEZ_EXTENSION flag 2014-11-07 12:51:27 +01:00
hal-socket.c android: Update socket service id name to match service name 2014-02-24 13:45:09 +01:00
hal-utils.c android/hal-utils: Refactor btproperty2str 2014-12-15 12:34:53 +01:00
hal-utils.h android: Remove temporary BLUEZ_EXTENSION flag 2014-11-07 12:51:27 +01:00
hal.h android/hal: Add HAL for A2DP Sink role 2014-11-25 20:56:56 +01:00
handsfree-client.c android/handsfree-client: Fix missing connected state notification 2015-02-09 13:30:56 +01:00
handsfree-client.h android/handsfree-client: Add handsfree-client daemon skeleton 2014-09-18 16:36:04 +02:00
handsfree.c android/handsfree: Fix SCO disconnection while dialing 2015-02-20 16:25:10 +01:00
handsfree.h android/handsfree: Add support for new API for handsfree init 2014-11-06 12:08:06 +01:00
health.c android/health: improve search efficiency 2014-12-16 10:54:32 -02:00
health.h android/health: Add health.c|h file with basic calls 2014-03-14 13:34:16 +01:00
hidhost.c android/hidhost: Fix logical vs bitwise operation 2014-11-24 14:42:40 +01:00
hidhost.h android: Pass mode parameter to registered services 2014-03-04 10:18:27 +01:00
hog.c android/hog: Fix find included battery services 2015-02-26 11:28:28 +01:00
hog.h android/hog: Add bt_hog_send_report 2014-07-02 11:09:27 +03:00
init.bluetooth.rc android: Run services without logwrapper 2014-12-15 17:03:22 +01:00
ipc-common.h android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
ipc-tester.c android/handsfree: Add initial support for configure WBS commmand 2014-12-19 14:26:47 +01:00
ipc.c android/ipc: Add support for sending FD in notifications 2014-06-12 13:04:31 +02:00
ipc.h android/ipc: Add support for sending FD in notifications 2014-06-12 13:04:31 +02:00
log.c android/log: Add missing libc includes 2015-02-03 10:39:18 +01:00
main.c android: Make shutdown timeout shorter 2015-01-13 14:46:53 +01:00
Makefile.am android/build: Fix missing backslash in EXTRA_DIST 2015-02-24 21:55:22 +01:00
map-client.c android/map-client: Add support for get remote MAS instances 2014-10-20 14:40:39 +02:00
map-client.h android/map-client: Add initial files 2014-10-20 14:40:39 +02:00
pan.c android/pan: Return correct error value 2015-02-26 09:35:27 +01:00
pan.h android: Pass mode parameter to registered services 2014-03-04 10:18:27 +01:00
pics-a2dp.txt android/pts: Update PTS files for A2DP 2015-01-19 20:59:08 +01:00
pics-avctp.txt android/pts: Update AVCTP pixits, pics and test results for PTS 6.0 2015-02-11 15:44:12 +01:00
pics-avdtp.txt android/pts: Update AVDTP pics, pixits for PTS 6.0 2015-01-19 20:57:40 +01:00
pics-avrcp.txt android/pts: Update AVRCP pics, pixits for PTS 6.0 2015-01-22 13:08:23 +01:00
pics-did.txt android/pts: Update DID PTS 6.0 pixits, pics, results for android 5.0 2015-01-22 13:08:23 +01:00
pics-dis.txt android/pts: Update DIS PIXIT, PICS and results for PTS 6.0 2015-01-29 16:45:11 +01:00
pics-gap.txt android/pts: Update GAP tests results with PTS 6.0 2015-01-19 19:11:24 +01:00
pics-gatt.txt android/pts: Update GATT PIXIT, PICS for PTS 6.0 2015-02-11 15:07:00 +01:00
pics-gavdp.txt android/pts: Add GAVDP PICS, PIXIT and test results with PTS 6.0 2015-02-20 21:50:52 +01:00
pics-hdp.txt android/pts: Update HDP pixits, pics and test results for PTS 6.0 2015-02-19 10:44:33 +01:00
pics-hfp.txt android/pts: Update HFP PIXIT, PICS for PTS 6.0 2015-02-20 16:33:38 +01:00
pics-hid.txt android/PTS: Update HID tests results for PTS 6.0 2015-02-02 21:40:14 +01:00
pics-hogp.txt android/pts: Update HOGP PIXIT, PICS for PTS 6.0 2015-02-16 14:58:30 +01:00
pics-hsp.txt android/pts: Update HSP pixits, pics and test results for PTS 6.0 2015-02-13 11:50:42 +01:00
pics-iopt.txt android/pts: Fix PTS version for IOPT PICS 2015-02-20 15:54:47 +01:00
pics-l2cap.txt android/pts: L2CAP test results update 2014-12-24 11:51:17 +01:00
pics-map.txt android/pts: MAP testing against PTS 6.0 2014-12-18 09:46:54 +01:00
pics-mcap.txt android/pts: Update MCAP test pics, pixits for PTS 6.0 2015-02-11 11:33:33 +01:00
pics-mps.txt android/pts: Re-test of MPS on PTS 6.0 2014-12-18 09:46:54 +01:00
pics-opp.txt android/pts: PTS tests for OPP on Android 5 and PTS 6.0 2015-02-02 21:29:01 +01:00
pics-pan.txt android/pts: Update PAN pics, pixits for PTS 6.0 2015-02-19 10:34:52 +01:00
pics-pbap.txt android/pts: Updated PBAP PICS and PIXITs for PTS 6.0 2015-02-03 12:37:26 +01:00
pics-rfcomm.txt android/PTS: Update RFCOMM tests results for PTS 6.0 2015-02-02 21:42:09 +01:00
pics-scpp.txt android/PTS: Update ScPP tests results for PTS 6.0 2015-02-02 21:42:19 +01:00
pics-sdp.txt android/pts: Add PICS, PIXIT and initial SDP PTS tests results 2015-02-24 17:32:33 +01:00
pics-sm.txt android/pts: Update SM pixits, pics and test results for PTS 6.0 2015-02-11 14:05:16 +01:00
pics-spp.txt android/pts: Update SPP PTS 6.0 results for android 5.0 2015-01-29 16:48:46 +01:00
pixit-a2dp.txt android/pts: Update PTS files for A2DP 2015-01-19 20:59:08 +01:00
pixit-avctp.txt android/pts: Update AVCTP pixits, pics and test results for PTS 6.0 2015-02-11 15:44:12 +01:00
pixit-avdtp.txt android/pts: Update AVDTP pics, pixits for PTS 6.0 2015-01-19 20:57:40 +01:00
pixit-avrcp.txt android/pts: Update AVRCP pics, pixits for PTS 6.0 2015-01-22 13:08:23 +01:00
pixit-did.txt android/pts: Update DID PTS 6.0 pixits, pics, results for android 5.0 2015-01-22 13:08:23 +01:00
pixit-dis.txt android/pts: Update DIS PIXIT, PICS and results for PTS 6.0 2015-01-29 16:45:11 +01:00
pixit-gap.txt android/pts: Update PIXIT for GAP 2015-02-26 12:30:08 +01:00
pixit-gatt.txt android/pts: Update GATT PIXIT, PICS for PTS 6.0 2015-02-11 15:07:00 +01:00
pixit-gavdp.txt android/pts: Add GAVDP PICS, PIXIT and test results with PTS 6.0 2015-02-20 21:50:52 +01:00
pixit-hdp.txt android/pts: Update HDP pixits, pics and test results for PTS 6.0 2015-02-19 10:44:33 +01:00
pixit-hfp.txt android/pts: Update HFP PIXIT, PICS for PTS 6.0 2015-02-20 16:33:38 +01:00
pixit-hid.txt android/PTS: Update HID tests results for PTS 6.0 2015-02-02 21:40:14 +01:00
pixit-hogp.txt android/pts: Update HOGP PIXIT, PICS for PTS 6.0 2015-02-16 14:58:30 +01:00
pixit-hsp.txt android/pts: Update HSP pixits, pics and test results for PTS 6.0 2015-02-13 11:50:42 +01:00
pixit-iopt.txt android/pts: Update IOPT test results for PTS 6.0 2015-02-05 16:09:06 +01:00
pixit-l2cap.txt android/pts: L2CAP test results update 2014-12-24 11:51:17 +01:00
pixit-map.txt android/pts: MAP testing against PTS 6.0 2014-12-18 09:46:54 +01:00
pixit-mcap.txt android/pts: Update MCAP test pics, pixits for PTS 6.0 2015-02-11 11:33:33 +01:00
pixit-mps.txt android/pts: Re-test of MPS on PTS 6.0 2014-12-18 09:46:54 +01:00
pixit-opp.txt android/pts: PTS tests for OPP on Android 5 and PTS 6.0 2015-02-02 21:29:01 +01:00
pixit-pan.txt android/pts: Update PAN pics, pixits for PTS 6.0 2015-02-19 10:34:52 +01:00
pixit-pbap.txt android/pts: Updated PBAP PICS and PIXITs for PTS 6.0 2015-02-03 12:37:26 +01:00
pixit-rfcomm.txt android/PTS: Update RFCOMM tests results for PTS 6.0 2015-02-02 21:42:09 +01:00
pixit-scpp.txt android/PTS: Update ScPP tests results for PTS 6.0 2015-02-02 21:42:19 +01:00
pixit-sdp.txt android/pts: Update SDP PTS tests results 2015-02-24 17:32:33 +01:00
pixit-sm.txt android/pts: Update SM pixits, pics and test results for PTS 6.0 2015-02-11 14:05:16 +01:00
pixit-spp.txt android/pts: Update SPP PTS 6.0 results for android 5.0 2015-01-29 16:48:46 +01:00
pts-a2dp.txt android/pts: Update PTS files for A2DP 2015-01-19 20:59:08 +01:00
pts-avctp.txt android/pts: Update AVCTP pixits, pics and test results for PTS 6.0 2015-02-11 15:44:12 +01:00
pts-avdtp.txt android/pts: Update AVDTP PTS 6.0 results for android 5.0 2015-01-19 20:57:48 +01:00
pts-avrcp.txt android/pts: Update AVRCP PTS 6.0 results for android 5.0 2015-01-22 13:08:23 +01:00
pts-did.txt android/pts: Update DID PTS 6.0 pixits, pics, results for android 5.0 2015-01-22 13:08:23 +01:00
pts-dis.txt android/pts: Update DIS PIXIT, PICS and results for PTS 6.0 2015-01-29 16:45:11 +01:00
pts-gap.txt android/pts: Update GAP PTS tests results 2015-02-25 22:17:29 +01:00
pts-gatt.txt android/pts: Minor style fix in GATT PTS results 2015-02-11 21:12:58 +01:00
pts-gavdp.txt android/pts: Add GAVDP PICS, PIXIT and test results with PTS 6.0 2015-02-20 21:50:52 +01:00
pts-hdp.txt android/pts: Update HDP pixits, pics and test results for PTS 6.0 2015-02-19 10:44:33 +01:00
pts-hfp.txt android/pts: Update HFP test results for PTS 6.0 2015-02-20 16:58:01 +01:00
pts-hid.txt android/PTS: Update HID tests results for PTS 6.0 2015-02-02 21:40:14 +01:00
pts-hogp.txt android/pts: Update test results for HOGP 2015-02-26 11:29:20 +01:00
pts-hsp.txt android/pts: Update HSP pixits, pics and test results for PTS 6.0 2015-02-13 11:50:42 +01:00
pts-iopt.txt android/pts: Update IOPT test results for PTS 6.0 2015-02-05 16:09:06 +01:00
pts-l2cap.txt android/pts: Update test notes for L2CAP 2015-02-13 11:50:42 +01:00
pts-map.txt android/pts: MAP testing against PTS 6.0 2014-12-18 09:46:54 +01:00
pts-mcap.txt android/pts: Update MCAP test results for PTS 6.0 2015-02-11 11:33:34 +01:00
pts-mps.txt android/pts: Update MPS tests results 2015-02-25 19:48:38 +01:00
pts-opp.txt android/pts: PTS tests for OPP on Android 5 and PTS 6.0 2015-02-02 21:29:01 +01:00
pts-pan.txt android/pts: Update PAN PTS 6.0 results for android 5.0 2015-02-19 10:34:52 +01:00
pts-pbap.txt android/pts: Updated PBAP PICS and PIXITs for PTS 6.0 2015-02-03 12:37:26 +01:00
pts-rfcomm.txt android/pts: Update of RFCOMM test results 2015-02-25 11:33:40 +01:00
pts-scpp.txt android/PTS: Update ScPP tests results for PTS 6.0 2015-02-02 21:42:19 +01:00
pts-sdp.txt android/pts: Update SDP PTS tests results 2015-02-24 17:32:33 +01:00
pts-sm.txt android/pts: Update SM pixits, pics and test results for PTS 6.0 2015-02-11 14:05:16 +01:00
pts-spp.txt android/pts: Update SPP TC_DevA_APP_BV_01_C instruction 2015-02-02 21:42:30 +01:00
README android/README: Update known Android issues section 2015-02-17 16:31:33 +01:00
sco-ipc-api.txt android/hal-sco: Add remote address parameter in Get SCO fd command 2014-11-05 12:25:11 +01:00
sco-msg.h android/hal-sco: Add remote address parameter in Get SCO fd command 2014-11-05 12:25:11 +01:00
sco.c android/sco: Fix for disconnect SCO 2014-12-03 14:23:34 +01:00
sco.h android/sco: Add SCO helper library 2014-11-24 12:33:42 +01:00
scpp.c android: Add explicit include for lib/bluetooth.h 2015-02-18 06:23:04 +01:00
scpp.h android/scpp: Add bt_scpp_set_interval and bt_scpp_set_window 2014-06-27 18:09:44 +02:00
socket-api.txt android/doc: Add socket-api.txt document 2013-12-08 17:32:05 +02:00
socket.c android/socket: Add fake service for SDP testing 2015-02-24 17:32:33 +01:00
socket.h android: Pass mode parameter to registered services 2014-03-04 10:18:27 +01:00
system-emulator.c shared: Move mainloop implementation from monitor to shared 2015-02-12 12:32:07 +02:00
test-ipc.c android: Create comon header for IPC 2014-02-28 15:22:45 +01:00
tester-a2dp.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-avrcp.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-bluetooth.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-gatt.c android/tester-gatt: Add Find By Type test 2015-02-24 17:40:21 +01:00
tester-hdp.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-hidhost.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-main.c android/tester: Add test for GATT server app indication confirmation 2015-02-19 11:02:15 +01:00
tester-main.h android/tester: Add test for GATT server app indication confirmation 2015-02-19 11:02:15 +01:00
tester-map-client.c android/tester: add initial support for map-client tester 2014-12-18 18:37:17 +01:00
tester-pan.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
tester-socket.c android/tester: Add verification for test case list creators 2014-12-18 18:37:17 +01:00
utils.h android: Add support for FW and HW revision config options 2014-10-02 15:48:52 +02:00

BlueZ for Android
*****************

Since Android 4.2 there exists a well standardized HAL interface that the
Bluetooth stack is expected to provide and which enables the easy replacement
of the stack of choice on Android. Android BlueZ is intended as a drop-in
replacement to Android provided Bluetooth stack.

More details about BlueZ for Android architecture and components can be found
in android/hal-ipc-api.txt file.

Supported Android version: 4.4 KitKat and 5.0 Lollipop


Building and running on Android
===============================

Steps needed to build and run Android Open Source Project with integrated BlueZ.


Build requirements
------------------

- GLib - Android 4.2 or later don't provide GLib and one must provide it in
'external/bluetooth/glib' folder of Android tree. Sample Android GLib port
is available at https://code.google.com/p/aosp-bluez.glib/

- SBC - A2DP code requires SBC library (version 1.2 or higher) present in
'external/bluetooth/sbc' directory. Library is build from Android.mk provided
by BlueZ. SBC code is available at git://git.kernel.org/pub/scm/bluetooth/sbc

- Bionic support - Android 5.0 provides all required functionality. Running
BlueZ on Android 4.4 requires backporting missing features (epoll_create1 and
ppoll calls). Sample Bionic for Android 4.4 with all required features
backported is available at
https://code.google.com/p/aosp-bluez.platform-bionic/

Runtime requirements
--------------------

BlueZ HAL library requires 'bluetoothd' and 'bluetoothd-snoop' services to be
available on Android system. Some permissions settings are also required.

This can be done by importing init.bluetooth.rc file in init.rc file of targeted
board:
import init.bluetooth.rc

For convenience examples are provided at:
https://code.google.com/p/aosp-bluez.device-lge-mako/    (Nexus 4)
https://code.google.com/p/aosp-bluez.device-lge-ham/     (Nexus 5)
https://code.google.com/p/aosp-bluez.device-asus-flo/    (Nexus 7 2013)

Security-Enhanced Linux in Android
----------------------------------

Since 5.0 release Android moved to full enforcement of SELinux. This requires
proper policy to be provided for all BlueZ for Android services (and services
interacting with BlueZ). Policies should be placed in external/selinux/ path.

Required policy files are provided at:
bluetoothd.te
bluetoothd_snoop.te

For convenience sepolicy.git with all required policies is available at:
https://code.google.com/p/aosp-bluez.external-sepolicy/

Downloading and building
------------------------

Building for Android requires full Android AOSP source tree. Sample Android tree
with all required components present is available at
http://code.google.com/p/aosp-bluez/

This tree provides support for Nexus4 (mako), Nexus 5 (hammerhead) and
Nexus 7 2013 (flo, deb). Tree does not provide binary blobs needed to run
Android on supported devices. Those can be obtained from
https://developers.google.com/android/nexus/drivers. Binary blobs needs to be
unpacked (EULA acceptance required) into 'vendor' directory of Android tree.

Downloading:
Android 5.0 - 'lollipop' branch
Android 4.4 - 'kitkat' branch

repo init -u https://code.google.com/p/aosp-bluez.platform-manifest -b lollipop
repo sync

Building:
source build/envsetup.sh
lunch aosp_<target>-userdebug
make -j8

Flashing:
adb reboot bootloader
fastboot flashall -w

After full build is done it is possible to rebuild only BlueZ:
'cd external/bluetooth/bluez/android/'
'mm' (or 'mm -B' to force rebuilding of all files)
'adb sync' to update target device.

Downloading and building for Intel devices
------------------------------------------

Sample Android tree with all required components for Intel devices based on
Intel reference image (https://01.org/android-ia) can be reconstructed following
instructions below.

This tree provides support for Dell XPS12, Minnowboard MAX, Intel NUC,
Acer Iconia W700 and other devices mentioned in:
https://01.org/android-ia/guides/devices

Downloading:
repo init -u https://github.com/01org/android-bluez-manifest.git -b android-ia \
	-m topic/bluez
repo sync

Building:
source build/envsetup.sh
lunch haswell_generic-eng
make -j8

Installing:
Live and Install image is $OUT/live.img
Flash live.img to USB flash and boot from it. More instructions here:
https://01.org/android-ia/guides/developers/build-and-install

Linux Kernel requirements
-------------------------

BlueZ for Android uses Linux Bluetooth subsystem and it must be enabled in
kernel. Minimal required version of management interface is 1.3. This
corresponds to Linux 3.9 but latest available version is recommended. Other
requirements include UHID and network bridge support.

Following kernel options should be enabled:
CONFIG_BT
CONFIG_BT_RFCOMM
CONFIG_BT_RFCOMM_TTY
CONFIG_BT_BNEP
CONFIG_BT_BNEP_MC_FILTER
CONFIG_BT_BNEP_PROTO_FILTER
CONFIG_BRIDGE
CONFIG_UHID
CONFIG_CRYPTO_CMAC
CONFIG_CRYPTO_USER_API
CONFIG_CRYPTO_USER_API_HASH
CONFIG_CRYPTO_USER_API_SKCIPHER

Also BT chip driver needs to be enabled e.g:
CONFIG_BT_HCIBTUSB

If it is not possible to use new enough Linux kernel one can use updated
bluetooth subsystem from Backports project. More information about Backports can
be found at https://backports.wiki.kernel.org. Sample kernels using backports
for running BlueZ on Android are available at
https://code.google.com/p/aosp-bluez.


Running with Valgrind
---------------------

BlueZ for Android is preconfigured to be easily run under Valgrind memcheck.
Appropriate configuration and required modules are automatically included when
building either userdebug or eng variant of Android platform.

Valgrind can be enabled in runtime by setting "persist.sys.bluetooth.valgrind"
property to either literal "true" or any numeric value >0. For example:
adb root
adb shell setprop persist.sys.bluetooth.valgrind true

After changing property value Bluetooth need to be restarted to apply changes
(this can be done using UI, just disable and enable it again). Property is
persistent, i.e. there's no need to enable Valgrind again after reboot.

It's recommended to have unstripped libglib.so installed which will enable
complete backtraces in Valgrind output. Otherwise, in many cases backtrace
will break at e.g. g_free() function without prior callers. It's possible to
have proper library installed automatically by appropriate entry in Android.mk,
see https://code.google.com/p/aosp-bluez.glib/ for an example.

When running with valgrind SElinux needs to be set into permissive mode. This
can be done by executing 'setenforce 0' from root shell.


Enabling BlueZ debugs
---------------------

BlueZ debug logs can be enabled in runtime by setting
"persist.sys.bluetooth.debug" property to either literal "true" or any
numeric value >0. For example:
adb root
adb shell setprop persist.sys.bluetooth.debug 1

After changing property value Bluetooth needs to be restarted to apply changes.

There is also a possibility to enable mgmt debug logs which also enables debugs
as above. To enable it proceed in the same way as described above but use
system properties called: persist.sys.bluetooth.mgmtdbg

Note: Debugs are only available on NON USER build variants


Customization
-------------

It is possible to customize BlueZ for Android through Android system properties.
This may include enabling extra profiles or features inside HALs implementation
These properties are read on Bluetooth stack startup only and require stack
restart if changed. All customization properties names start with
"persist.sys.bluetooth." or "ro.bluerooth." followed by specific HAL name e.g.
"persist.sys.bluetooth.handsfree". If both are present "persist.sys.bluetooth."
takes precedence. This allows for read only properties to be set during build
leaving enough flexibility for developing or debugging purposes.
This section list available customization options.

Property	Value		Description
-------------------------------------------
mode		bredr		Enable BlueZ in BR/EDR mode
		le		Enable BlueZ in LE mode
		<none>		Enable BlueZ in default mode - enable BR/EDR/LE
				if available.
handsfree	hfp		Enable Handsfree Profile (HFP) with narrowband
				speech only
		hfp_wbs		Enable Handsfree Profile (HFP) with narrowband
				and wideband speech support
		<none>		Don't enable Handsfree Profile (HFP)
vendor		<any>		Set vendor name in DIS. If not set fallback to
				"ro.product.manufacturer".
model		<any>		Set model name used as default adapter name.
				If not set fallback to "ro.product.model".
name		<any>		Set model number in DIS. If not set fallback to
				"ro.product.name".
serialno	<any>		Set serial number in DIS. If not set fallback to
				"ro.serialno".
systemid	<uint64>	Set system ID in DIS. Hex string encoded uint64.
pnpid		<any>		PnP information used in DIS and DID profiles.
				Required format: "Source:VID:PID:Version".
				Source must be either "bluetooth" or "usb".
				VID, PID and Version are uint16. Version is
				optional.
fwrev		<any>		Firmware revision in DIS. If not set fallback to
				"ro.build.version.release".
hwrew		<any>		Hardware revision in DIS. If not set fallback to
				"ro.board.platform".


Building and running on Linux
-----------------------------

It is possible to build and test BlueZ for Android daemon on Linux (eg. PC).
Simply follow instructions available at README file in BlueZ top directory.
Android daemon binary is located at android/bluetoothd. See next section on
how to test Android daemon on Linux.


Testing tool
------------

BT HAL test tools located in android/haltest is provided for HAL level testing
of both Android daemon and HAL library. Start it with '-n' parameter and type
'bluetooth init' in prompt to initialize HAL library. Running without parameter
will make haltest try to initialize all services after start. On Android
required bluetoothd service will be started automatically. On Linux it is
required to start android/bluetoothd manually before init command timeout or
use provided android/system-emulator, which takes care of launching daemon
automatically on HAL library initialization. To deinitialize HAL library and
stop daemon type 'bluetooth cleanup'. Type 'help' for more information. Tab
completion is also supported.


Implementation status
=====================

Summary of HALs implementation status.

complete    - implementation is feature complete and Android Framework is able
              to use it normally
partial     - implementation is in progress and not all required features are
              present, Android Framework is able to use some of features
initial     - only initial implementations is present, Android Framework is
              able to initialize but most likely not able to use it
not started - no implementation, Android Framework is not able to initialize it

Profile ID        HAL header         4.4 Status    5.0 status
-------------------------------------------------------------
core              bluetooth.h        complete      partial
a2dp              bt_av.h            complete      complete
gatt              bt_gatt.h          complete      partial
                  bt_gatt_client.h   complete      partial
                  bt_gatt_server.h   complete      partial
handsfree         bt_hf.h            complete      complete
hidhost           bt_hh.h            complete      complete
health            bt_hl.h            complete      complete
pan               bt_pan.h           complete      complete
avrcp             bt_rc.h            complete      complete
socket            bt_sock.h          complete      partial
handsfree_client  bt_hf_client.h     N/A           complete
map_client        bt_mce.h           N/A           complete
a2dp_sink         bt_av.h            N/A           partial
avrcp_ctrl        bt_rc.h            N/A           partial


Implementation shortcomings
===========================

It is possible that some of HAL functionality (although being marked as
complete) is missing implementation due to reasons like feature feasibility or
necessity for latest Android Framework. This sections provides list of such
deficiencies. Note that HAL library is always expected to fully implement HAL
API so missing implementation might happen only in daemon.


HAL Bluetooth
-------------

methods:
dut_mode_send                      never called from Android Framework
le_test_mode                       never called from Android Framework

callbacks:
dut_mode_recv_cb                   empty JNI implementation
le_test_mode_cb                    empty JNI implementation

properties:
BT_PROPERTY_SERVICE_RECORD         not supported for adapter, for device this
                                   property is returned as a response to
                                   get_remote_service_record call

BT_PROPERTY_REMOTE_VERSION_INFO    information required by this property (LMP
                                   information) are not accessible from mgmt
                                   interface, also marking this property as
                                   settable is probably a typo in HAL header

HAL Socket
----------

Support only for BTSOCK_RFCOMM socket type.


HAL AVRCP
---------

methods:
list_player_app_attr_rsp           never called from Android Framework
list_player_app_value_rsp          never called from Android Framework
get_player_app_value_rsp           never called from Android Framework
get_player_app_attr_text_rsp       never called from Android Framework
get_player_app_value_text_rsp      never called from Android Framework
set_player_app_value_rsp           never called from Android Framework

callbacks:
list_player_app_attr_cb            NULL JNI implementation
list_player_app_values_cb          NULL JNI implementation
get_player_app_value_cb            NULL JNI implementation
get_player_app_attrs_text_cb       NULL JNI implementation
get_player_app_values_text_cb      NULL JNI implementation
set_player_app_value_cb            NULL JNI implementation


HAL GATT
--------

methods:
client->set_adv_data               missing kernel support for vendor data
client->connect                    is_direct parameter is ignored


Audio SCO HAL
=============

When Bluetooth chip's audio is not wired directly to device audio, Audio SCO
HAL is used to enable SCO support. It needs to be loaded by AudioFlinger
following audio_policy.conf configuration. Example of configuration is shown
below:

...
  sco {
    outputs {
      sco {
        sampling_rates 8000|44100
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_ALL_SCO
      }
    }
    inputs {
      sco {
        sampling_rates 8000|44100
        channel_masks AUDIO_CHANNEL_IN_MONO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET
      }
    }
  }
...

Known Android issues
====================

It is possible that BlueZ is triggering bugs on Android Framework that could
affect qualification or user experience. This section provides list of
recommended Android fixes that are not part of latest AOSP release supported by
BlueZ.

For Android 5.0 Lollipop:
https://android-review.googlesource.com/99761
https://android-review.googlesource.com/100297
https://android-review.googlesource.com/102882
https://android-review.googlesource.com/132733
https://android-review.googlesource.com/132763

For Android 4.4 KitKat:
https://android-review.googlesource.com/82757
https://android-review.googlesource.com/87670
https://android-review.googlesource.com/88384
https://android-review.googlesource.com/99761
https://android-review.googlesource.com/99850
https://android-review.googlesource.com/100297
https://android-review.googlesource.com/102882

Unimplemented Bluetooth features
================================

Some Bluetooth functionality require support from outside of BT stack
eg. telephony stack. This sections describes profiles optional features not
implemented due to lack of support in other Android subsystems or missing API
in respective BT HALs.

Profile		Feature				Comments
--------------------------------------------------------
HFP		Attach a phone number to	AT+BINP=1
		a voice tag
HFP		Enhanced Call Control		AT+CHLD={1x,2x}
HFP		Explicit Call Transfer		AT+CHLD=4
HFP		Response and Hold		AT+BTRH, +BTRH
HFP		In-band Ring Tone		+BSIR
AVRCP		Player Settings			HAL API present but not used
AVRCP		Browsing			No HAL API
GATT		Read multiple characteristics	No HAL API


Reporting Bugs
==============

Bugs should be reported at https://01.org/jira/browse/BA. When reporting
a bug please attach logs from logcat (logcat -v time) and HCI trace. Daemon
debug logs should be enabled. When reporting daemon crash please run it under
valgrind if possible. For details on how to enabled debug logs and valgrind see
"Enabling BlueZ debugs" section.