Android's audio Hardware Abstraction Layer (HAL) connects the higher-level,
audio-specific framework APIs in
to the underlying audio drivers and hardware. The Audio HAL defines the standard
interface that audio services call into. It must be implemented for the audio
hardware to function correctly.
This page gives an overview of the audio HAL and provides details of its API and implementation requirements.
Audio HAL interface
Figure 1: Audio HAL interface
Audio policy and audio effects XML configuration files are considered to be part of the Audio HAL interface. These files must conform to their schemas, and the conformance is verified by VTS tests.
As part of implementing the audio HAL, you must create an audio policy configuration file
that describes the audio topology. Audio HAL capabilities must be declared in
audio_policy_configuration.xml file for the framework to use them.
Audio HAL API
The audio HAL contains the following APIs:
- Core HAL
- Effects HAL
- Common HAL
Each of these APIs is described in the following sections.
The Core HAL is the main API used by AudioFlinger to play audio and control the audio routing. Some of the key interfaces are as follows:
IDeviceFactory.halis the entry point into the API.
IPrimaryDevice.halcontain methods such as
- Streams are unidirectional and are used by AudioFlinger to send or receive
audio to and from the HAL through
The following table lists the location of useful Core HAL components:
|Core HAL component||Location|
|Latest version of API||
|Types specific to the latest Core HAL API||
|Audio policy configuration file XSD schema||
The default implementation of the Core HAL API (
is a wrapper around pre-Treble HAL implementation using
legacy shared libraries.
The default implementation can also be considered as a reference when
implementing new versions of audio HALs that interact with kernel drivers
The Effects HAL API is used by the effects framework to control audio effects. You can also configure pre-processing effects such as automatic gain control and noise suppression through the Effects HAL API.
The following table lists the location of useful Effects HAL components:
|Effects HAL component||Location|
|Latest version of API||
|Effect configuration file XSD schema||
For more information, see a sample implementation of the
Effects API (
/hardware/interfaces/audio/effect/all-versions/default/) and the
The Common HAL is a library of common data types used by the Core and Effects HAL APIs. It has no interfaces and contains the following:
- Definitions (
/hardware/interfaces/audio/common/6.0/types.hal) shared by the Core and Effect APIs.
- Utilities (
/hardware/interfaces/audio/common/all-versions) used to help coding against HIDL APIs for implementations, clients and tests.
In addition to implementing the audio HAL and creating the audio policy configuration file, the following HAL requirements must be adhered to:
- If capture for Sound Trigger (capture from hotword DSP buffer) is supported by one input profile, the implementation must support the number of active streams on this profile corresponding to the number of concurrent sessions supported by Sound Trigger HAL.
- Concurrency of voice call TX and capture from the application processor as detailed on the Concurrent Capture page.
The following table lists the HAL version number for each Android release.
|Android version||HAL version|