自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
蓝牙
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
从 Android 13 开始,Bluetooth 是可选的 Mainline 模块。Bluetooth Mainline 模块旨在为所有 Android 用户提供一致、优质的蓝牙体验。
设计初衷
Bluetooth 模块旨在为合作伙伴、用户和应用开发者提供优质体验。我们将通过以下几种关键方式实现这一目标:
- 更快、更频繁地发布更新,并推出新功能、修复 bug,以及提供互操作性修复及安全修复。
- 减少合作伙伴的重复性工作
- 每年减少对代码库进行衍合的开销。
- 减少将 OTA 发布到旧设备的开销。
- 减少碎片化,并为应用开发者和用户打造一致体验
- 提高 Android 生态系统中的全球安全性。有很多 Android 安全漏洞都涉及到蓝牙。
该软件包是一个 APEX,包含 Bluetooth APK(目前在 packages/modules/Bluetooth/android/app
中定义)、我们的原生库(libbluetooth.so
和 libbluetooth_jni.so
)、API(在 packages/modules/Bluetooth/framework/java/android/bluetooth
下)以及 HIDL 接口。
模块边界
图 1. Bluetooth 模块边界
我们正在将所有现有代码库迁移到 system/bt
下的单个代码库中。
图 1 表示将构成我们的模块的当前目录。
依赖项
Bluetooth 模块拥有以下各项的依赖项:
- 将清理的传入和传出
@hide
API 使用情况
- Bluetooth APK、
libbluetooth.so
和 libbluetooth_jni.so
所需的库
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-10。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-10。"],[],[],null,["# Bluetooth\n\nThe Bluetooth module is an optional Mainline module introduced in Android 13.\nIn Android 16 and higher, the module is updatable and contains a fully\ncertified dual-mode Bluetooth host stack, enabling Android devices to support\nboth classic Bluetooth and Bluetooth Low Energy (BLE) functionalities.\n\nThe primary motivation for the Bluetooth module is to provide a higher-quality\nBluetooth experience to device manufacturers, users, and app developers by:\n\n- **Delivering faster updates** with new features, bug fixes, interoperability\n enhancements, and security patches quickly and regularly, independently of\n the Android OS release cycle.\n\n- **Reducing fragmentation** and creating a consistent experience for the\n entire Android ecosystem.\n\n- **Streamlining partner development** by delivering Android-validated\n Bluetooth Mainline modules and avoiding frequent rebasing, thus reducing\n development and testing overhead.\n\nPackage format\n--------------\n\nThe Bluetooth module uses the [APEX](/docs/core/ota/apex) format. The `com.google.android.bt`\npackage contains the Bluetooth APK defined in\n`packages/modules/Bluetooth/android/app`, the built-in library\n`libbluetooth_jni.so`, the APIs under\n`packages/modules/Bluetooth/framework/java/android/bluetooth`, and the HIDL\ninterfaces.\n\nModule boundary\n---------------\n\nThe following diagram shows the Bluetooth module boundary:\n\n**Figure 1**. Bluetooth module boundary.\n\nDependencies\n------------\n\nThe Bluetooth module has dependencies on the following:\n\n- Incoming and outgoing `@hide` API usages\n- Library required for the Bluetooth APK (`libbluetooth.so`).\n- HAL implementation from the Bluetooth chipset provider\n- Android Audio Framework for audio streaming\n- Android telephony for phone calls\n- Android tethering for Bluetooth Personal Area Network (PAN)"]]