hal: Add support for audio power policy handling

* Add PowerPolicyClient class to receive policy change notifications

* Add PowerPolicyClient launcher to join ABinder threadpool

* Add functionality to launch powerpolicy extn in a new thread

Change-Id: Ic9349ca7c94fe481b2d7a74536f97e32a7b0fe8e
Signed-off-by: Tahir Dawson <dawson@codeaurora.org>
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index aba6592..db80656 100755
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -1139,3 +1139,41 @@
 endif
 include $(BUILD_SHARED_LIBRARY)
 endif
+#-------------------------------------------
+
+#            Build Power_Policy_Client LIB
+#-------------------------------------------
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_POWER_POLICY)),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libaudiopowerpolicy
+
+LOCAL_VENDOR_MODULE := true
+
+LOCAL_SRC_FILES:= \
+        PowerPolicyClient.cpp \
+        power_policy_launcher.cpp
+
+LOCAL_C_INCLUDES:= \
+        vendor/qcom/opensource/audio-hal/primary-hal/hal \
+        system/media/audio/include
+
+LOCAL_SHARED_LIBRARIES:= \
+        android.frameworks.automotive.powerpolicy-ndk_platform \
+        libbase \
+        libbinder_ndk \
+        libcutils \
+        liblog \
+        libpowerpolicyclient
+
+ifneq ($(filter kona lahaina holi,$(TARGET_BOARD_PLATFORM)),)
+LOCAL_SANITIZE := integer_overflow
+endif
+
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DAEMON_SUPPORT)),true)
+  LOCAL_CFLAGS += -DDAEMON_SUPPORT_AUTO
+endif
+
+include $(BUILD_SHARED_LIBRARY)
+endif