Google is committed to advancing racial equity for Black communities. See how.

Audio Implementation

This section explains how to implement the audio Hardware Abstraction Layer (HAL), provides details about configuring an audio policy (file formats, code organization, pre-processing effects), and describes how to configure the shared library (creating the file).

Audio HAL capabilities

The Android 10 release includes the following new capabilities for audio HAL:

  • AudioSource
  • AudioFormat
    • AAC_LATM (LC, HE V1, and V2)
    • CELT
    • LHDC
    • LHDC_LL
  • AudioChannelMask

Those HAL capabilities should be declared in the device audio_policy_configuration.xml for the framework to use them.

Audio HAL and subsystem requirements

The Android 10 release includes the following requirements for audio HAL and subsystem implementation:

  • If separate input stream profiles are declared in audio_policy_configuration.xml , it must be possible to activate them all simultaneously for any device selection.
  • If capture for sound trigger (capture from hotword DSP buffer) is supported by one input profile, the implementation must support a number of active streams on this profile corresponding to the number of concurrent sessions supported by sound trigger HAL.
  • Concurrency of DSP hotword detection and capture from the AP.
  • Concurrency of voice call TX and capture from the AP.

Implementing audio HAL

The audio HAL is composed of the following interfaces:

  • hardware/libhardware/include/hardware/audio.h. Represents the main functions of an audio device.
  • hardware/libhardware/include/hardware/audio_effect.h. Represents effects that can be applied to audio such as downmixing, echo, or noise suppression.

You must implement all interfaces.

Audio header files

For a reference of the properties you can define, refer to the audio header files:

  • In Android 6.0 and higher, see system/media/audio/include/system/audio.h.
  • In Android 5.1 and lower, see system/core/include/system/audio.h.

For an example, refer to the implementation for the Galaxy Nexus at device/samsung/tuna/audio.

Next steps

In addition to implementing the audio HAL, you must also create an audio policy configuration file that describes your audio topology and package the HAL implementation into a shared library. You can also configure pre-processing effects such as automatic gain control and noise suppression.