After creating an audio policy configuration, you must package the HAL implementation into a shared library and copy it to the appropriate location:
- Create a
device/<company>/<device>/audiodirectory to contain your library's source files. - Create an
Android.mkfile to build the shared library. Ensure the Makefile contains the following line:
LOCAL_MODULE := audio.primary.<device>
Your library must be named
audio.primary.<device>.soso Android can correctly load the library. Theprimaryportion of this filename indicates that this shared library is for the primary audio hardware located on the device. The module namesaudio.a2dp.<device>andaudio.usb.<device>are also available for Bluetooth and USB audio interfaces. Here is an example of anAndroid.mkfrom the Galaxy Nexus audio hardware:LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := audio.primary.tuna LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := audio_hw.c ril_interface.c LOCAL_C_INCLUDES += \ external/tinyalsa/include \ $(call include-path-for, audio-utils) \ $(call include-path-for, audio-effects) LOCAL_SHARED_LIBRARIES := liblog libcutils libtinyalsa libaudioutils libdl LOCAL_MODULE_TAGS := optional include $(BUILD_SHARED_LIBRARY) - If your product supports low latency audio as specified by the Android CDD,
copy the corresponding XML feature file into your product. For example, in your
product's
device/<company>/<device>/device.mkMakefile:PRODUCT_COPY_FILES := ... PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \
- Copy the audio policy configuration file you created earlier to the
system/etc/directory in your product'sdevice/<company>/<device>/device.mkMakefile. For example:PRODUCT_COPY_FILES += \ device/samsung/tuna/audio/audio_policy.conf:system/etc/audio_policy.conf - Declare the shared modules of your audio HAL that are required by your
product in the product's
device/<company>/<device>/device.mkMakefile. For example, the Galaxy Nexus requires the primary and Bluetooth audio HAL modules:PRODUCT_PACKAGES += \ audio.primary.tuna \ audio.a2dp.default