Android’s audio Hardware Abstraction Layer (HAL)

Android’s audio Hardware Abstraction Layer (HAL)connects the higher-level, audio-specific framework APIs in android.media to the underlying audio driver and hardware. This section includes implementation instructions and tips for improving performance.

Audio Architecture

Figure 1. Android audio architecture

Application framework The application framework includes the app code, which uses the android.media APIs to interact with audio hardware. Internally, this code calls corresponding JNI glue classes to access the native code that interacts with audio hardware. JNI The JNI code associated with android.media calls lower level native code to access audio hardware. JNI is located in frameworks/base/core/jni/ and frameworks/base/media/jni. Native framework The native framework provides a native equivalent to the android.media package, calling Binder IPC proxies to access the audio-specific services of the media server. Native framework code is located in frameworks/av/media/libmedia. Binder IPC Binder IPC proxies facilitate communication over process boundaries. Proxies are located in frameworks/av/media/libmedia and begin with the letter "I". Media server The media server contains audio services, which are the actual code that interacts with your HAL implementations. The media server is located in frameworks/av/services/audioflinger. HAL The HAL defines the standard interface that audio services call into and that you must implement for your audio hardware to function correctly. The audio HAL interfaces are located in hardware/libhardware/include/hardware. For details, see audio.h. Kernel driver The audio driver interacts with your hardware and HAL implementation. You can use Advanced Linux Sound Architecture (ALSA), Open Sound System (OSS), or a custom driver (HAL is driver-agnostic).

Note: If you use ALSA, we recommend external/tinyalsa for the user portion of the driver because of its compatible licensing (the standard user-mode library is GPL-licensed).

Android native audio based on Open SL ES (not shown) This API is exposed as part of Android NDK and is at the same architecture level as android.media.

Reference:- AOSP

)

Pragati Singh ⭐️⭐️⭐️⭐️⭐️

Written by

Android Developer Advocate & Architect ✔Technology Leader ✔Life Coach #techentrepreneur #polyglot programer #BuildBetterApp

mobidroid

mobidroid

Technology leader for android

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade