http://blog.csdn.net/wendell_gong/article/details/47950781
The APIs of A2DP sink, AVRCP controller and HFP client are not published in Android L, but the code which implements the profiles is indeed in Android L. You can set the configuration for the car to build the code.
Where is the code?
A2DP sink
/frameworks/base/core/java/android/bluetooth/BluetoothA2dpSink.java
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkService.java
/packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
/packages/apps/Bluetooth/jni/com_android_bluetooth_a2dp_sink.cpp
/hardware/libhardware/include/hardware/bt_av.h
AVRCP controller
/frameworks/base/core/java/android/bluetooth/BluetoothAvrcpController.java
/packages/apps/Bluetooth/src/com/android/bluetooth/avrcp/AvrcpControllerService.java
/packages/apps/Bluetooth/jni/com_android_bluetooth_avrcp_controller.cpp
HFP client
/frameworks/base/core/java/android/bluetooth/BluetoothHeadsetClient.java
/frameworks/base/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
/packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientHalConstants.java
/packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
/packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
/packages/apps/Bluetooth/jni/com_android_bluetooth_hfpclient.cpp
/hardware/libhardware/include/hardware/bt_hf_client.h
I does not list the files in bluedroid. You can find the files which are added or modified for A2DP sink, AVRCP controller and HFP client in the layers of BTIF, BTA and BTE(stack directory). An A2DP decoder locates in /external/bluetooth/bluedroid/embdrv/sbc/decoder/.
How to build the code?
Google develops A2DP sink, AVRCP controller and HFP client for Android Auto. car_hammerhead.mk is added in /device/lge/hammerhead/. You must add the product item 'add_lunch_combo car_hammerhead-userdebug' in /device/lge/hammerhead/vendorsetup.sh. Then run 'lunch', and select 'car_hammerhead-userdebug'. Now you can build the image of car_hammerhead and flash the image to Nexus 5.
You can used hcitool and sdptool to browse all available services on Nexus 5 with car_hammerhead image. You should see A2DP sink, AVRCP controller and HFP client in the list of available services. If you want to hear the sound from the speaker of Nexus 5 with car_hammerhead image, you have to develop the App which uses A2DP sink APIs to trigger the audio routing from from BT stack to speaker. If no App registers a listener to bluedroid, the audio data will be discarded before decoder.
阅读(4007) | 评论(0) | 转发(0) |