เลเยอร์การจัดการฮาร์ดแวร์โดยตรง (HAL) คือเลเยอร์การแยกแยะประเภทที่มีอินเทอร์เฟซมาตรฐานสำหรับผู้ให้บริการฮาร์ดแวร์ HAL ช่วยให้ผู้ให้บริการฮาร์ดแวร์สามารถใช้ฟีเจอร์ระดับล่างที่เจาะจงอุปกรณ์ได้โดยไม่ส่งผลต่อหรือแก้ไขโค้ดในเลเยอร์ระดับสูง
ภาษาที่คล้ายกับ Java ซึ่งใช้เพื่อกําหนดอินเทอร์เฟซในลักษณะที่ไม่ขึ้นอยู่กับภาษาโปรแกรมที่ใช้ AIDL ช่วยให้การสื่อสารระหว่างไคลเอ็นต์ HAL กับบริการ HAL เป็นไปได้
HAL แบบ Binder
HAL ที่สื่อสารกับโปรเซสอื่นๆ ใช้การเรียกการสื่อสารระหว่างโปรเซส (IPC) ของ Binder HAL แบบ Binderized จะทํางานในกระบวนการแยกต่างหากจากไคลเอ็นต์ที่ใช้
HAL แบบ Binderized จะลงทะเบียนกับเครื่องมือจัดการบริการเพื่อให้ไคลเอ็นต์เข้าถึงความสามารถของ HAL ได้ HAL ที่เขียนขึ้นสำหรับ Android 8 ขึ้นไปจะอยู่ในรูป Binder
ไคลเอ็นต์ HAL
กระบวนการที่เข้าถึงบริการ HAL
อินเทอร์เฟซ HAL
อินเทอร์เฟซทั่วไปที่ทั้งไคลเอ็นต์และบริการ HAL ใช้เพื่อสื่อสาร
บริการ HAL
รหัสเฉพาะฮาร์ดแวร์ เช่น รหัสที่สื่อสารกับกล้องของอุปกรณ์ คุณต้องติดตั้งใช้งาน HAL ที่จำเป็นทั้งหมดที่แสดงในตารางความเข้ากันได้สำหรับรุ่นที่คุณกำหนดเป้าหมายในพาร์ติชันผู้ให้บริการ
ดูข้อมูลเพิ่มเติมเกี่ยวกับตารางความเข้ากันได้ได้ที่ตารางความเข้ากันได้
คุณยังสร้างอินเทอร์เฟซ HAL ใหม่หรือขยายอินเทอร์เฟซของ HAL เพื่อรองรับความสามารถเฉพาะของฮาร์ดแวร์ได้ด้วย
[[["เข้าใจง่าย","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,["# Hardware abstraction layer (HAL) overview\n\nA *hardware abstraction layer (HAL)* is type of abstraction layer with a\nstandard interface for hardware vendors to implement. A HAL allows hardware\nvendors to implement lower-level, device-specific features without affecting or\nmodifying code in higher-level layers.\n| **Note:** HALs existed before Android 8. However, Android 8 ensured each HAL had a standard interface. For an explanation of HAL architecture before Android 8, refer to [Legacy HALs](/docs/core/architecture/hal/archive).\n\nRequired terms\n--------------\n\nFollowing is a list of definitions for terms used in this section of\ndocumentation:\n\n*Android Interface Definition Language (AIDL)*\n: A Java-like language used to define interfaces in a way that is independent of\n the programming language being used. AIDL allows communication between\n HAL clients and HAL services.\n\n*Binderized HAL*\n: A HAL that communicates with other processes\n using\n [binder inter-process communication (IPC)](/docs/core/architecture/hidl/binder-ipc)\n calls. Binderized HALs run in a separate process from the client that uses them.\n Binderized HALs are registered with a service manager so that clients can\n access their capabilities. HALs written for Android 8 and higher are\n binderized.\n\n*HAL client*\n: The process that accesses the HAL service.\n\n*HAL interface*\n: The common interface used by both the HAL client and service to communicate.\n\n*HAL service*\n\n: The hardware-specific code, such as the code that talks to your specific\n device's camera. You must implement all required HALs listed in the\n compatibility matrix for the release you target in your vendor partition.\n For further information on compatibility matrixes, see\n [Compatibility matrixes](/docs/core/architecture/vintf/comp-matrices).\n\n You can also create a new HAL interface, or extend the interface of a HAL, to\n support your hardware's unique capabilities.\n\n*Hardware Interface Definition Language (HIDL)*\n\n: A language used to define interfaces in a way that is independent of the\n programming language being used. HIDL enables communication between\n HAL clients and HAL services.\n\n | **Note:** As of Android 13, HIDL has been deprecated. Instead of HIDL, you should use Android Interface Definition Language (AIDL) for HALs. HALs previously written using [HIDL](/docs/core/architecture/hidl) are supported.\n\n*Same Process (SP) HAL*\n\n: A restricted set of wrapped HALs. Membership in the set is controlled by\n Google. SP HALs include:\n\n - Stable C mapper 5 HAL\n - OpenGL\n - Vulkan\n - android.hidl.memory@1.0 (provided by the Android system, always wrapped)\n - android.hardware.renderscript@1.0\n\n | **Note:** Some HAL implementations wrap legacy interfaces, such as those in `libhardware`, in an AIDL or HIDL wrapper.\n\n*Wrapped HAL*\n\n: A HAL service that was created before Android 8, but has been wrapped in an\n AIDL or HIDL wrapper to work with Android 8 and higher.\n\nWhat's next?\n------------\n\n- To learn how to implement a HAL service, refer to [AIDL for HALs](/docs/core/architecture/aidl/aidl-hals).\n- To learn how to create or extend an existing HAL, refer to [Attached extended interfaces](/docs/core/architecture/aidl/aidl-hals#attached-extensions)."]]