QMAA: Add support for HAL module disable

- Disable audio HAL modules compilation
  based on QMAA flag

Change-Id: I3ec8c82bfcf699a3bbf5e7133480a4bda1240a5a
diff --git a/Android.mk b/Android.mk
index 13c5b4a..060bee6 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,4 @@
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 ifneq ($(filter mpq8092 msm8960 msm8226 msm8x26 msm8610 msm8974 msm8x74 apq8084 msm8916 msm8994 msm8992 msm8909 msm8996 msm8952 msm8937 thorium msm8953 msmgold msm8998 sdm660 sdm845 sdm710 apq8098_latv qcs605 msmnile $(MSMSTEPPE),$(TARGET_BOARD_PLATFORM)),)
 
 MY_LOCAL_PATH := $(call my-dir)
@@ -23,3 +24,4 @@
 endif
 
 endif
+endif
diff --git a/configs/msmnile/msmnile.mk b/configs/msmnile/msmnile.mk
index 66fa211..1a0ab62 100644
--- a/configs/msmnile/msmnile.mk
+++ b/configs/msmnile/msmnile.mk
@@ -1,6 +1,13 @@
 #BOARD_USES_GENERIC_AUDIO := true
 #
 #AUDIO_FEATURE_FLAGS
+ifeq ($(TARGET_USES_QMAA_OVERRIDE_AUDIO), false)
+ifeq ($(TARGET_USES_QMAA),true)
+AUDIO_USE_STUB_HAL := true
+endif
+endif
+
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 BOARD_USES_ALSA_AUDIO := true
 TARGET_USES_AOSP_FOR_AUDIO := false
 
@@ -241,6 +248,7 @@
 #enable AAC frame ctl for A2DP sinks
 PRODUCT_PROPERTY_OVERRIDES += \
 persist.vendor.bt.aac_frm_ctl.enabled=true
+endif
 
 # for HIDL related packages
 PRODUCT_PACKAGES += \
diff --git a/hal/Android.mk b/hal/Android.mk
index 783c6aa..1ba715b 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -1,3 +1,4 @@
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 ifeq ($(strip $(BOARD_USES_ALSA_AUDIO)),true)
 
 LOCAL_PATH := $(call my-dir)
@@ -471,3 +472,4 @@
 LOCAL_CFLAGS += -Wno-unused-local-typedef
 
 endif
+endif
diff --git a/mm-audio/Android.mk b/mm-audio/Android.mk
index 5e46fc1..b02ea48 100644
--- a/mm-audio/Android.mk
+++ b/mm-audio/Android.mk
@@ -1,3 +1,4 @@
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 LOCAL_CFLAGS += -Wno-unused-variable
 LOCAL_CFLAGS += -Wno-sign-compare
 LOCAL_CFLAGS += -Wno-unused-parameter
@@ -12,3 +13,4 @@
 ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
 include $(call all-subdir-makefiles)
 endif
+endif
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 43132eb..1d0c0ea 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -1,4 +1,4 @@
-
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
@@ -203,3 +203,4 @@
 include $(BUILD_SHARED_LIBRARY)
 
 endif
+endif
diff --git a/qahw/Android.mk b/qahw/Android.mk
index 0b782f0..a64b913 100644
--- a/qahw/Android.mk
+++ b/qahw/Android.mk
@@ -1,3 +1,4 @@
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 ifeq ($(strip $(BOARD_SUPPORTS_QAHW)),true)
 
 LOCAL_PATH := $(call my-dir)
@@ -37,3 +38,4 @@
 
 include $(BUILD_COPY_HEADERS)
 endif
+endif
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index 4a53c51..5c663bd 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
@@ -61,3 +62,4 @@
 LOCAL_CFLAGS += -Wno-unused-local-typedef
 
 include $(BUILD_SHARED_LIBRARY)
+endif
diff --git a/voice_processing/Android.mk b/voice_processing/Android.mk
index 5b865b7..820684a 100644
--- a/voice_processing/Android.mk
+++ b/voice_processing/Android.mk
@@ -1,3 +1,4 @@
+ifneq ($(AUDIO_USE_STUB_HAL), true)
 LOCAL_PATH:= $(call my-dir)
 
 # audio preprocessing wrapper
@@ -43,3 +44,4 @@
 LOCAL_CFLAGS += -Wno-unused-local-typedef
 
 include $(BUILD_SHARED_LIBRARY)
+endif