Bluetooth in Android 4.2 and 4.3 (a): overview

Source: Internet
Author: User

starting with Android 4.2, a major change has taken place in the Bluetooth stack: from BlueZ to Bluedroid, which was developed jointly by Google and Broadcom (of course, the core part is Broadcom, Google is mostly doing the parts related to the upper framework). the http://source.android.com/devices/bluetooth.html can be used to understand the architecture of the new Bluetooth stack in general, with few related documents, Read the code for a deeper understanding. compared with BlueZ, Bluedroid has the following advantages:

    • The hierarchy is clearly structured. Each profile is unified on the upper layer to facilitate the addition of new profiles, and the HAL layer is added to facilitate portability.

    • Removed the dbus,framework Java code directly into the Bluedroid native code.

But bluedroid in Android 4.2 is less powerful than BlueZ in Android 4.1, for example, AVRCP 1.3 is not supported; Many bugs, such as some Bluetooth headsets, cannot redial the last call. The most important thing is that the 4.2 bluedroid does not support ble. However, there has been a lot of improvement in the newly released Android 4.3, and AVRCP 1.3 and BLE have been supported.
There are currently some Android 4.1 or 4.2 devices that support BLE, but are all using the vendor own solution, such as Bluetooth stack using BlueZ 5.x, and then provide vendor BLE Android SDK. Now Android 4.3 has been released, from the future trend of development, if someone to learn Bluetooth in Android, it is recommended not to study BlueZ, it is better to turn to bluedroid.
Here is the distribution of Bluetooth-related code in Android 4.2:

Android.bluetooth Frameworks/base/core/java/android/bluetooth Implements public API for the Bluetooth adapter and profiles
Bluetooth system Service Packages/apps/bluetooth/src Implements service and profiles at the Android fraework layer
Bluetooth JNI Packages/apps/bluetooth/jni Defines Bluetooth adapter and profiles service Jni:calls to Hal and receives callback from HAL
Bluetooth HAL hardware/libhardware/include/hardware/bt_*.h files Defines the standard interface, the Android.bluetooth adapter and Profiles APIs
Bluetooth Stack External/bluetooth/bluedroid Implement Bluetooth Stack:core and profiles



In the case of pan profile, we can look at the specific distribution of the code and how the class and file are named:

Android.bluetooth Frameworks public class Bluetoothpan implements Bluetoothprofile
Bluetooth System Service Packages/apps public class Panservice extends ProfileService
Bluetooth JNI Packages/apps Com_android_bluetooth_pan.cpp
Bluetooth HAL Hardware/libhardware Include/hardware/bt_pan.h
Bluetooth Stack External/bluetooth BLUEDROID/BTIF/SRC/BTIF_PAN.C (Implements Bt_pan.h)


Bluedroid/bta/pan (Broadcom BTA)


Bluedroid/stack/pan (Broadcom BTE)



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.