ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
AIDL Audio HAL
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ตั้งแต่ Android 14 เป็นต้นไป อินเทอร์เฟซ HAL ของเสียงจะกำหนดโดยใช้ AIDL ที่เสถียร เราขอแนะนำให้พาร์ทเนอร์และผู้ให้บริการ SoC ใช้ Audio HAL อีกครั้งเพื่อให้อินเทอร์เฟซ AIDL
การขยายไลบรารี libaudiohal
จะเพิ่มการรองรับเฟรมเวิร์กสำหรับ AIDL HAL
เมื่อใช้ AIDL ระบบจะย้ายข้อกำหนดการกำหนดค่านโยบายเสียงไปยัง AIDL HAL การเปลี่ยนแปลงนี้ทำให้เครื่องมือจัดการนโยบายเสียง (APM) ได้รับการกำหนดค่าจาก HAL แทนที่จะใช้การกำหนดค่าจากไฟล์ XML ที่ได้จากผู้ให้บริการ
Audio AIDL HAL API
ส่วนนี้จะอธิบาย API หลัก เอฟเฟกต์ และ HAL ทั่วไปสำหรับ AIDL
ใช้การใช้งานเริ่มต้นของ AIDL API ที่ /hardware/interfaces/audio/aidl/default/
เป็นข้อมูลอ้างอิงเมื่อติดตั้งใช้งาน Audio HAL เวอร์ชันใหม่ที่โต้ตอบกับไดรเวอร์เคอร์เนล
ดูโครงสร้างไดเรกทอรี Audio HAL สำหรับ AIDL ได้ที่ไฟล์ README ของ Audio HAL
Core HAL
อินเทอร์เฟซหลักของ Core HAL ที่ใช้ AIDL มีดังนี้
HAL ของเอฟเฟกต์
อินเทอร์เฟซหลักบางส่วนของ Effects HAL ที่ใช้ AIDL มีดังนี้
ดูข้อมูลเพิ่มเติมได้ที่เอฟเฟกต์เสียง
HAL ทั่วไป
โครงสร้างข้อมูลและอินเทอร์เฟซที่แชร์ระหว่าง HAL ต่างๆ เช่น BT HAL, HAL หลัก และ HAL เสียงสำหรับเอฟเฟกต์จะอยู่ใน HAL ทั่วไป
ประเภทข้อมูลที่เสถียรที่พบบ่อย
ทั้ง HAL และเฟรมเวิร์กจะใช้คําจํากัดความโครงสร้างข้อมูลที่เสถียร
การทดสอบ Audio AIDL HAL API
มีชุดทดสอบ VTS ใหม่สําหรับอินเทอร์เฟซ AIDL
HAL เวอร์ชันใหม่ไม่มีการเปลี่ยนแปลงที่อาจส่งผลต่อความปลอดภัย
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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"]],["อัปเดตล่าสุด 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."]]