Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
AIDL Audio HAL
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Kể từ Android 14, giao diện Audio HAL được xác định bằng AIDL ổn định. Các đối tác và nhà cung cấp SoC nên triển khai lại Audio HAL để cung cấp giao diện AIDL.
Việc mở rộng thư viện libaudiohal
sẽ thêm tính năng hỗ trợ khung cho AIDL HAL.
Với việc triển khai AIDL, thông số kỹ thuật cấu hình chính sách âm thanh sẽ được chuyển sang AIDL HAL. Với thay đổi này, Trình quản lý chính sách âm thanh (APM) sẽ lấy cấu hình từ HAL thay vì lấy cấu hình từ tệp XML do nhà cung cấp cung cấp.
API HAL AIDL âm thanh
Phần này mô tả các API Core, Effects và HAL phổ biến cho AIDL.
Sử dụng phương thức triển khai mặc định của API AIDL tại /hardware/interfaces/audio/aidl/default/
làm tài liệu tham khảo khi triển khai các phiên bản mới của Audio HAL tương tác với trình điều khiển hạt nhân.
Hãy xem tệp README về Audio HAL để biết cấu trúc thư mục Audio HAL cho AIDL.
Core HAL
Sau đây là một số giao diện chính của Core HAL, sử dụng AIDL:
HAL hiệu ứng
Sau đây là một số giao diện chính của Effects HAL, sử dụng AIDL:
Hãy xem phần Hiệu ứng âm thanh để biết thêm thông tin.
HAL chung
Các cấu trúc dữ liệu và giao diện được chia sẻ giữa nhiều HAL như BT HAL, cốt lõi và hiệu ứng HAL âm thanh nằm trong HAL chung.
Các loại dữ liệu ổn định phổ biến
Các định nghĩa cấu trúc dữ liệu ổn định được cả HAL và khung sử dụng.
Kiểm thử API HAL AIDL âm thanh
Các chương trình kiểm thử VTS mới được cung cấp cho giao diện AIDL.
Không có thay đổi nào trong phiên bản HAL mới có thể ảnh hưởng đến tính bảo mật.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# AIDL Audio HAL\n\nStarting with Android 14, the Audio HAL interface is\ndefined using [Stable AIDL](/docs/core/architecture/aidl/stable-aidl). Partners\nand SoC vendors are encouraged to reimplement their Audio HAL to provide an\nAIDL interface.\n\nExtending the `libaudiohal` library adds framework support for AIDL HAL.\nWith the AIDL implementation, the audio policy configuration specification is\nmoved to AIDL HAL. With this change, the Audio Policy Manager (APM) gets the\nconfiguration from the HAL instead of consuming it from the vendor-provided XML\nfile.\n\nAudio AIDL HAL API\n------------------\n\nThis section describes the Core, Effects, and Common HAL APIs for AIDL.\n\nUse default implementation of the AIDL API at\n[`/hardware/interfaces/audio/aidl/default/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/default/)\nas a reference when implementing new versions of Audio HALs that\ninteract with kernel drivers.\n\nSee the\n[Audio HAL README file](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/README.md)\nfor the Audio HAL directory structure for AIDL.\n\n### Core HAL\n\nSome of the [key interfaces of Core HAL](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/),\nusing AIDL, are as follows:\n\n- [`IModule.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/IModule.aidl) is the entry point into the API.\n- Streams are unidirectional and are used by AudioFlinger to send or receive audio to and from the HAL through [`IStreamOut.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/IStreamOut.aidl) and [`IStreamIn.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/IStreamIn.aidl).\n- [`ITelephony.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/ITelephony.aidl) provides controls specific to telephony functions.\n- [`IBluetooth.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/IBluetooth.aidl) provides BT SCO and HFP controls that were on `IPrimaryModule` in the HIDL API.\n- [`IConfig.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/IConfig.aidl) provides system-wide configuration parameters.\n- [`ISoundDose.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl) provides sound dose support. See [Sound dose](/docs/core/audio/sound-dose) for more information.\n- The latest version of the Core HAL API *in development* is in [`/hardware/interfaces/audio/aidl/android/hardware/audio/core/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/core/).\n- The latest *released* version of the Core HAL API is in [`/hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.core/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.core/).\n\n### Effects HAL\n\nSome of the key interfaces of Effects HAL, using AIDL, are as follows:\n\n- [`IFactory.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/IFactory.aidl) is the entry point into the API.\n- [`Descriptor.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/Descriptor.aidl) contains all information such as capabilities and attributes for an effect implementation.\n- [`Capability.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/Capability.aidl) defines effect capabilities that don't change at runtime.\n- [`Parameter.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/Parameter.aidl) defines all parameters supported by the effect instance.\n- [`IEffect.aidl`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/IEffect.aidl) is used to configure and control particular effect instances.\n- Effect-specific parcelables named after the effect.\n\n- The latest version of the Effects HAL API *in development* is in [`/hardware/interfaces/audio/aidl/android/hardware/audio/effect/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/effect/).\n\n- The latest *released* version of the Effects HAL API is in\n [`/hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.effect`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.effect/).\n\nSee the [Audio Effects](/docs/core/audio/audio-effects) for more\ninformation.\n\n### Common HAL\n\nData structures and interfaces shared between various HALs such as BT HAL, core\nand effects Audio HALs are in the Common HAL.\n\n- The latest version of the Common AIDL HAL *in development* is in\n [`/hardware/interfaces/audio/aidl/android/hardware/audio/common/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/android/hardware/audio/common/).\n\n- The latest *released* version of the Common HAL API is in\n [`/hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:hardware/interfaces/audio/aidl/aidl_api/android.hardware.audio.common/).\n\n#### Common stable data types\n\nStable data structure definitions are used both by HALs and the framework.\n\n- The latest version of the stable data types *in development* is in\n [`/system/hardware/interfaces/media/aidl/android/media/audio/common/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/hardware/interfaces/media/aidl/android/media/audio/common/).\n\n- The latest *released* version of the stable data types is in\n [`/system/hardware/interfaces/media/aidl_api/android.media.audio.common.types/`](https://cs.android.com/android/platform/superproject/+/android-latest-release:system/hardware/interfaces/media/aidl_api/android.media.audio.common.types/).\n\nTesting the Audio AIDL HAL API\n------------------------------\n\nNew [VTS](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/audio/aidl/vts/)\ntests are provided for the AIDL interface.\n\nThere are no changes in the new HAL version that can affect security."]]