Commit 98c6be0e authored by Eric Laurent's avatar Eric Laurent
Browse files

audio policy: split audio policy library

Split audio policy library into a service part and a policy part.
This will allow OEMs to customize the policy part:
- libaudiopolicyservice for the service.
- libaudiopolicymanager for the policy.

Two build options can be defined in device make file to select
the policy library:
- USE_LEGACY_AUDIO_POLICY = 1: this will use the legacy policy
in hardware/libhardware_legacy implemented by AudioPolicyManagerBase class.
This policy is loaded as a harware module and exposes the audio policy HAL
defined in include/hardware/audio_policy.h and is in a library called
audio_policy.XXX.so (e.g audio_policy.default.so)

The legacy HAL will not be updated with new features.

If USE_LEGACY_AUDIO_POLICY is not defined, the policy is implemented by
a class named AudioPolicyManager exposing an interface defined in
AudioPolicyInterface.h.
The corresponding library is libaudiopolicymanager.so.

New features will be added only to AudioPolicyInterface.h

The default implementation is provided here in file AudioPolicyManager.cpp

OEMs wanting to cutomize the policy can implement the AudioPolicyManager class
and provide the libaudiopolicymanager.so library.
In this case the device make file should define:
- USE_CUSTOM_AUDIO_POLICY = 1

For now, USE_LEGACY_AUDIO_POLICY = 1 is forced in audio policy service make file.
This will be removed when the new audio policy is enabled.

Change-Id: I066799dacc9b182b468a43d48ff7798c9109a414
parent 272b7f26
......@@ -51,6 +51,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libaudioflinge
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libaudioflinger.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libaudiopolicy_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libaudiopolicy.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libaudiopolicy_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libaudiopolicy.so)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
......
......@@ -15,7 +15,7 @@ LOCAL_SRC_FILES:= \
LOCAL_SHARED_LIBRARIES := \
libaudioflinger \
libaudiopolicy \
libaudiopolicyservice \
libcamera_metadata\
libcameraservice \
libmedialogservice \
......
......@@ -5,7 +5,9 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
AudioPolicyService.cpp
# TODO: remove when enabling new audio policy
USE_LEGACY_AUDIO_POLICY = 1
ifeq ($(USE_LEGACY_AUDIO_POLICY), 1)
LOCAL_SRC_FILES += \
AudioPolicyInterfaceImplLegacy.cpp \
......@@ -15,8 +17,7 @@ LOCAL_SRC_FILES += \
else
LOCAL_SRC_FILES += \
AudioPolicyInterfaceImpl.cpp \
AudioPolicyClientImpl.cpp \
AudioPolicyManager.cpp
AudioPolicyClientImpl.cpp
endif
LOCAL_C_INCLUDES := \
......@@ -31,14 +32,42 @@ LOCAL_SHARED_LIBRARIES := \
libbinder \
libmedia \
libhardware \
libhardware_legacy
libhardware_legacy \
ifneq ($(USE_LEGACY_AUDIO_POLICY), 1)
LOCAL_SHARED_LIBRARIES += \
libaudiopolicymanager
endif
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
libserviceutility
LOCAL_MODULE:= libaudiopolicy
LOCAL_MODULE:= libaudiopolicyservice
LOCAL_CFLAGS += -fvisibility=hidden
include $(BUILD_SHARED_LIBRARY)
ifneq ($(USE_LEGACY_AUDIO_POLICY), 1)
ifneq ($(USE_CUSTOM_AUDIO_POLICY), 1)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
AudioPolicyManager.cpp
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
liblog
LOCAL_STATIC_LIBRARIES := \
libmedia_helper
LOCAL_MODULE:= libaudiopolicymanager
include $(BUILD_SHARED_LIBRARY)
endif
endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment