Merge tag 'LA.UM.9.1.r1-14200-SMxxx0.QSSI14.0' into staging/lineage-20.0_merge-LA.UM.9.1.r1-14200-SMxxx0.QSSI14.0
"LA.UM.9.1.r1-14200-SMxxx0.QSSI14.0"
# By Manish Chaturvedi
# Via Linux Build Service Account (1) and Manish Chaturvedi (1)
* tag 'LA.UM.9.1.r1-14200-SMxxx0.QSSI14.0':
audio-hal: oob read when doing the typecase
Change-Id: Ieecc865509d86a226bb5967465368cf36d441bef
diff --git a/.gitupstream b/.gitupstream
new file mode 100644
index 0000000..fa89aba
--- /dev/null
+++ b/.gitupstream
@@ -0,0 +1 @@
+https://git.codelinaro.org/clo/la/platform/hardware/qcom/audio
diff --git a/Android.mk b/Android.mk
index 0bf32b7..ae4a5e1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,3 +1,5 @@
+ifeq ($(call my-dir),$(call project-path-for,qcom-audio))
+
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 sdmshrike msmnile kona lahaina holi $(MSMSTEPPE) $(TRINKET) atoll lito bengal,$(TARGET_BOARD_PLATFORM)),)
@@ -26,3 +28,5 @@
endif
endif
+
+endif
diff --git a/adsprpcd/Android.bp b/adsprpcd/Android.bp
index 7e6a8e7..f91ad2f 100644
--- a/adsprpcd/Android.bp
+++ b/adsprpcd/Android.bp
@@ -3,8 +3,6 @@
srcs: ["adsprpcd.c"],
- header_libs: ["libfastrpcshippable_headers"],
-
shared_libs: [
"liblog",
"libdl",
diff --git a/adsprpcd/adsprpcd.c b/adsprpcd/adsprpcd.c
index a44c013..89004e7 100644
--- a/adsprpcd/adsprpcd.c
+++ b/adsprpcd/adsprpcd.c
@@ -31,17 +31,21 @@
#define VERIFY_PRINT_ERROR
#endif
+#define VERIFY_EPRINTF ALOGE
+#define VERIFY_IPRINTF ALOGI
+
#include <stdio.h>
#include <dlfcn.h>
#include <unistd.h>
-#include "verify.h"
-#include "AEEStdErr.h"
+#include <log/log.h>
#ifndef ADSP_DEFAULT_LISTENER_NAME
#define ADSP_DEFAULT_LISTENER_NAME "libadsp_default_listener.so"
#endif
+#define AEE_ECONNREFUSED 0x72
+
typedef int (*adsp_default_listener_start_t)(int argc, char *argv[]);
int main(int argc, char *argv[]) {
@@ -71,6 +75,5 @@
usleep(25000);
}
VERIFY_EPRINTF("audio adsp daemon exiting %x", nErr);
-bail:
return nErr;
}
diff --git a/configs/atoll/audio_policy_configuration.xml b/configs/atoll/audio_policy_configuration.xml
index 3d48b56..db2388c 100755
--- a/configs/atoll/audio_policy_configuration.xml
+++ b/configs/atoll/audio_policy_configuration.xml
@@ -167,9 +167,6 @@
<profile name="" format="AUDIO_FORMAT_WMA_PRO"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
- <profile name="" format="AUDIO_FORMAT_VORBIS"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
- channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
diff --git a/configs/msmnile/audio_policy_configuration.xml b/configs/msmnile/audio_policy_configuration.xml
index d44a8ef..fdf0017 100644
--- a/configs/msmnile/audio_policy_configuration.xml
+++ b/configs/msmnile/audio_policy_configuration.xml
@@ -167,9 +167,6 @@
<profile name="" format="AUDIO_FORMAT_WMA_PRO"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
- <profile name="" format="AUDIO_FORMAT_VORBIS"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
- channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
diff --git a/configs/msmsteppe/audio_policy_configuration.xml b/configs/msmsteppe/audio_policy_configuration.xml
index 6667137..1483f99 100644
--- a/configs/msmsteppe/audio_policy_configuration.xml
+++ b/configs/msmsteppe/audio_policy_configuration.xml
@@ -167,9 +167,6 @@
<profile name="" format="AUDIO_FORMAT_WMA_PRO"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
- <profile name="" format="AUDIO_FORMAT_VORBIS"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
- channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
diff --git a/configs/trinket/audio_policy_configuration.xml b/configs/trinket/audio_policy_configuration.xml
index da12f2a..da12e41 100755
--- a/configs/trinket/audio_policy_configuration.xml
+++ b/configs/trinket/audio_policy_configuration.xml
@@ -167,9 +167,6 @@
<profile name="" format="AUDIO_FORMAT_WMA_PRO"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
- <profile name="" format="AUDIO_FORMAT_VORBIS"
- samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
- channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
<profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
diff --git a/hal/Android.mk b/hal/Android.mk
index 1bd1342..d83ed09 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -359,11 +359,16 @@
LOCAL_SHARED_LIBRARIES += vendor.qti.hardware.audiohalext@1.0
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXT_AMPLIFIER)),true)
+ LOCAL_CFLAGS += -DEXT_AMPLIFIER_ENABLED
+ LOCAL_SRC_FILES += audio_extn/audio_amplifier.c
+ LOCAL_SHARED_LIBRARIES += libhardware
+endif
+
LOCAL_CFLAGS += -D_GNU_SOURCE
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio
-LOCAL_COPY_HEADERS := audio_extn/audio_defs.h
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
@@ -372,6 +377,10 @@
endif
LOCAL_SHARED_LIBRARIES += libbase libhidlbase libutils android.hardware.power@1.2 liblog
+
+LOCAL_SHARED_LIBRARIES += android.hardware.power-V1-ndk
+LOCAL_SHARED_LIBRARIES += libbinder_ndk
+
LOCAL_SRC_FILES += audio_perf.cpp
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM_TUNER_EXT)),true)
diff --git a/hal/audio_extn/Android.mk b/hal/audio_extn/Android.mk
index f4afdff..ae0c6ca 100644
--- a/hal/audio_extn/Android.mk
+++ b/hal/audio_extn/Android.mk
@@ -1,3 +1,5 @@
+ifneq ($(strip $(TARGET_PROVIDES_AUDIO_EXTNS)),true)
+
#--------------------------------------------
# Build SND_MONITOR LIB
#--------------------------------------------
@@ -36,7 +38,7 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -98,8 +100,8 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(call project-path-for,qcom-audio)/hal \
+ $(call project-path-for,qcom-audio)/hal/$(AUDIO_PLATFORM) \
$(call include-path-for, audio-effects)
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
@@ -128,6 +130,7 @@
LOCAL_MODULE := libssrec
LOCAL_VENDOR_MODULE := true
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -145,6 +148,10 @@
-Wno-unused-function \
-Wno-unused-variable
+ifeq ($(QCPATH),)
+ LOCAL_CFLAGS += -D_OSS
+endif
+
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
libcutils \
@@ -157,8 +164,8 @@
libprocessgroup
LOCAL_C_INCLUDES := \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
external/tinyalsa/include \
external/tinycompress/include \
external/expat/lib \
@@ -194,7 +201,7 @@
LOCAL_MODULE_OWNER := third_party
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -253,6 +260,7 @@
#--------------------------------------------
include $(CLEAR_VARS)
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM := msm8974
@@ -289,9 +297,9 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/audio_extn \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
vendor/qcom/opensource/audio-kernel/include/uapi/ \
$(call include-path-for, audio-effects)
@@ -312,6 +320,7 @@
include $(CLEAR_VARS)
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
# B-family platform uses msm8974 code base
AUDIO_PLATFORM := msm8974
@@ -348,9 +357,9 @@
system/media/audio_utils/include \
external/expat/lib \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/$(AUDIO_PLATFORM) \
+ $(PRIMARY_HAL_PATH) \
+ $(PRIMARY_HAL_PATH)/audio_extn \
+ $(PRIMARY_HAL_PATH)/$(AUDIO_PLATFORM) \
vendor/qcom/opensource/audio-kernel/include/uapi/ \
$(call include-path-for, audio-effects)
@@ -374,7 +383,7 @@
LOCAL_MODULE := liba2dpoffload
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -439,7 +448,7 @@
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -502,7 +511,7 @@
LOCAL_MODULE := libhfp
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -565,12 +574,14 @@
#-------------------------------------------
# Build HDMI PASSTHROUGH
#-------------------------------------------
+ifneq ($(QCPATH),)
+
include $(CLEAR_VARS)
LOCAL_MODULE := libhdmipassthru
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -634,6 +645,8 @@
endif
include $(BUILD_SHARED_LIBRARY)
+endif
+
#-------------------------------------------
# Build BATTERY_LISTENER
#-------------------------------------------
@@ -642,7 +655,7 @@
LOCAL_MODULE := libbatterylistener
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -715,7 +728,7 @@
LOCAL_MODULE := libhwdepcal
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi lito bengal atoll sdm660 msm8937 msm8953 msm8998 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -778,7 +791,7 @@
LOCAL_MODULE:= libmaxxaudio
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi sdm660 msm8937 msm8953 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -840,7 +853,7 @@
LOCAL_MODULE:= libaudiozoom
LOCAL_VENDOR_MODULE := true
-PRIMARY_HAL_PATH := vendor/qcom/opensource/audio-hal/primary-hal/hal
+PRIMARY_HAL_PATH := $(call project-path-for,qcom-audio)/hal
AUDIO_PLATFORM := $(TARGET_BOARD_PLATFORM)
ifneq ($(filter sdm845 sdm710 sdmshrike msmnile kona lahaina holi sdm660 msm8937 msm8953 $(MSMSTEPPE) $(TRINKET),$(TARGET_BOARD_PLATFORM)),)
@@ -957,3 +970,4 @@
LOCAL_SANITIZE := integer_overflow
endif
include $(BUILD_SHARED_LIBRARY)
+endif
diff --git a/hal/audio_extn/audio_amplifier.c b/hal/audio_extn/audio_amplifier.c
new file mode 100644
index 0000000..043c10f
--- /dev/null
+++ b/hal/audio_extn/audio_amplifier.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "audio_amplifier"
+
+#include <log/log.h>
+#include <dlfcn.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#include "audio_hw.h"
+#include "platform.h"
+
+struct amplifier_data {
+ struct audio_device* adev;
+ amplifier_device_t* hw;
+};
+
+struct amplifier_data amp;
+
+int amplifier_open(void* adev) {
+ int rc;
+ amplifier_module_t* module;
+ amp.adev = (struct audio_device*)adev;
+
+ rc = hw_get_module(AMPLIFIER_HARDWARE_MODULE_ID, (const hw_module_t**)&module);
+ if (rc) {
+ ALOGV("%s: Failed to obtain reference to amplifier module: %s\n", __func__, strerror(-rc));
+ return -ENODEV;
+ }
+
+ rc = amplifier_device_open((const hw_module_t*)module, &.hw);
+ if (rc) {
+ ALOGV("%s: Failed to open amplifier hardware device: %s\n", __func__, strerror(-rc));
+ amp.hw = NULL;
+
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+int amplifier_set_input_devices(uint32_t devices) {
+ if (amp.hw && amp.hw->set_input_devices) return amp.hw->set_input_devices(amp.hw, devices);
+
+ return 0;
+}
+
+int amplifier_set_output_devices(uint32_t devices) {
+ if (amp.hw && amp.hw->set_output_devices) return amp.hw->set_output_devices(amp.hw, devices);
+
+ return 0;
+}
+
+int amplifier_enable_devices(uint32_t devices, bool enable) {
+ bool is_output = devices < SND_DEVICE_OUT_END;
+
+ if (amp.hw && amp.hw->enable_output_devices && is_output)
+ return amp.hw->enable_output_devices(amp.hw, devices, enable);
+
+ if (amp.hw && amp.hw->enable_input_devices && !is_output)
+ return amp.hw->enable_input_devices(amp.hw, devices, enable);
+
+ return 0;
+}
+
+int amplifier_set_mode(audio_mode_t mode) {
+ if (amp.hw && amp.hw->set_mode) return amp.hw->set_mode(amp.hw, mode);
+
+ return 0;
+}
+
+int amplifier_output_stream_start(struct audio_stream_out* stream, bool offload) {
+ if (amp.hw && amp.hw->output_stream_start)
+ return amp.hw->output_stream_start(amp.hw, stream, offload);
+
+ return 0;
+}
+
+int amplifier_input_stream_start(struct audio_stream_in* stream) {
+ if (amp.hw && amp.hw->input_stream_start) return amp.hw->input_stream_start(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_output_stream_standby(struct audio_stream_out* stream) {
+ if (amp.hw && amp.hw->output_stream_standby)
+ return amp.hw->output_stream_standby(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_input_stream_standby(struct audio_stream_in* stream) {
+ if (amp.hw && amp.hw->input_stream_standby) return amp.hw->input_stream_standby(amp.hw, stream);
+
+ return 0;
+}
+
+int amplifier_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->set_parameters) return amp.hw->set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_out_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->out_set_parameters) return amp.hw->out_set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_in_set_parameters(struct str_parms* parms) {
+ if (amp.hw && amp.hw->in_set_parameters) return amp.hw->in_set_parameters(amp.hw, parms);
+
+ return 0;
+}
+
+int amplifier_set_feedback(void* adev, uint32_t devices, bool enable) {
+ amp.adev = (struct audio_device*)adev;
+ if (amp.hw && amp.hw->set_feedback)
+ return amp.hw->set_feedback(amp.hw, amp.adev, devices, enable);
+ return 0;
+}
+
+int amplifier_close(void) {
+ if (amp.hw) amplifier_device_close(amp.hw);
+
+ amp.hw = NULL;
+
+ return 0;
+}
diff --git a/hal/audio_extn/audio_amplifier.h b/hal/audio_extn/audio_amplifier.h
new file mode 100644
index 0000000..7607392
--- /dev/null
+++ b/hal/audio_extn/audio_amplifier.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016 The CyanogenMod Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EXTN_AMPLIFIER_H
+#define EXTN_AMPLIFIER_H
+
+#ifndef EXT_AMPLIFIER_ENABLED
+#define amplifier_open(adev) (0)
+#define amplifier_set_input_devices(devices) (0)
+#define amplifier_set_output_devices(devices) (0)
+#define amplifier_enable_devices(devices, enable) (0)
+#define amplifier_set_mode(mode) (0)
+#define amplifier_output_stream_start(stream, offload) (0)
+#define amplifier_input_stream_start(stream) (0)
+#define amplifier_output_stream_standby(stream) (0)
+#define amplifier_input_stream_standby(stream) (0)
+#define amplifier_set_parameters(parms) (0)
+#define amplifier_out_set_parameters(parms) (0)
+#define amplifier_in_set_parameters(parms) (0)
+#define amplifier_set_feedback(adev, devices, enable) (0)
+#define amplifier_close() (0)
+#else
+
+int amplifier_open(void* adev);
+int amplifier_set_input_devices(uint32_t devices);
+int amplifier_set_output_devices(uint32_t devices);
+int amplifier_enable_devices(uint32_t devices, bool enable);
+int amplifier_set_mode(audio_mode_t mode);
+int amplifier_output_stream_start(struct audio_stream_out* stream, bool offload);
+int amplifier_input_stream_start(struct audio_stream_in* stream);
+int amplifier_output_stream_standby(struct audio_stream_out* stream);
+int amplifier_input_stream_standby(struct audio_stream_in* stream);
+int amplifier_set_parameters(struct str_parms* parms);
+int amplifier_out_set_parameters(struct str_parms* parms);
+int amplifier_in_set_parameters(struct str_parms* parms);
+int amplifier_set_feedback(void* adev, uint32_t devices, bool enable);
+int amplifier_close(void);
+#endif
+
+#endif
diff --git a/hal/audio_extn/gef.c b/hal/audio_extn/gef.c
index 69b1e41..dc70717 100644
--- a/hal/audio_extn/gef.c
+++ b/hal/audio_extn/gef.c
@@ -39,6 +39,7 @@
#include "audio_hw.h"
#include "platform.h"
#include "platform_api.h"
+#include <pthread.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <dlfcn.h>
diff --git a/hal/audio_extn/ssr.c b/hal/audio_extn/ssr.c
index 8cb7b4e..b6cadcc 100644
--- a/hal/audio_extn/ssr.c
+++ b/hal/audio_extn/ssr.c
@@ -36,7 +36,19 @@
#include "audio_extn.h"
#include "platform.h"
#include "platform_api.h"
+#ifndef _OSS
#include "surround_rec_interface.h"
+#else
+typedef struct {
+ const char *name;
+ char *(*get_param_fn)(void *h);
+} get_param_data_t;
+
+typedef struct {
+ const char *name;
+ void (*set_param_fn)(void *h, const char *val);
+} set_param_data_t;
+#endif
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 334d469..f3a5c1c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -85,6 +85,8 @@
#include "sound/asound.h"
+#include "audio_amplifier.h"
+
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
#define LOG_MASK HAL_MOD_FILE_AUDIO_HW
@@ -1385,6 +1387,7 @@
goto err;
}
audio_extn_dev_arbi_acquire(snd_device);
+ amplifier_enable_devices(snd_device, true);
if (audio_extn_spkr_prot_start_processing(snd_device)) {
ALOGE("%s: spkr_start_processing failed", __func__);
audio_extn_dev_arbi_release(snd_device);
@@ -1464,6 +1467,7 @@
}
audio_extn_dev_arbi_acquire(snd_device);
audio_route_apply_and_update_path(adev->audio_route, device_name);
+ amplifier_set_feedback(adev, snd_device, true);
if (SND_DEVICE_OUT_HEADPHONES == snd_device &&
!adev->native_playback_enabled &&
@@ -1535,6 +1539,7 @@
platform_set_speaker_gain_in_combo(adev, snd_device, false);
} else {
audio_route_reset_and_update_path(adev->audio_route, device_name);
+ amplifier_enable_devices(snd_device, false);
}
if (snd_device == SND_DEVICE_OUT_BT_A2DP) {
@@ -1565,6 +1570,7 @@
}
audio_extn_utils_release_snd_device(snd_device);
+ amplifier_set_feedback(adev, snd_device, false);
} else {
if (platform_split_snd_device(adev->platform,
snd_device,
@@ -2938,6 +2944,10 @@
disable_snd_device(adev, usecase->in_snd_device);
}
+ /* Rely on amplifier_set_devices to distinguish between in/out devices */
+ amplifier_set_input_devices(in_snd_device);
+ amplifier_set_output_devices(out_snd_device);
+
/* Applicable only on the targets that has external modem.
* New device information should be sent to modem before enabling
* the devices to reduce in-call device switch time.
@@ -4552,6 +4562,9 @@
}
pthread_mutex_lock(&adev->lock);
+
+ amplifier_output_stream_standby((struct audio_stream_out *) stream);
+
out->standby = true;
if (out->usecase == USECASE_COMPRESS_VOIP_CALL) {
voice_extn_compress_voip_close_output_stream(stream);
@@ -5052,6 +5065,8 @@
if (!parms)
goto error;
+ amplifier_out_set_parameters(parms);
+
err = platform_get_controller_stream_from_params(parms, &ext_controller,
&ext_stream);
if (err == 0) {
@@ -5905,6 +5920,11 @@
ret = voice_extn_compress_voip_start_output_stream(out);
else
ret = start_output_stream(out);
+
+ if (ret == 0)
+ amplifier_output_stream_start(stream,
+ is_offload_usecase(out->usecase));
+
/* ToDo: If use case is compress offload should return 0 */
if (ret != 0) {
out->standby = true;
@@ -6806,6 +6826,8 @@
adev->adm_deregister_stream(adev->adm_data, in->capture_handle);
pthread_mutex_lock(&adev->lock);
+ amplifier_input_stream_standby((struct audio_stream_in *) stream);
+
in->standby = true;
if (in->usecase == USECASE_COMPRESS_VOIP_CALL) {
do_stop = false;
@@ -6990,6 +7012,9 @@
if (!parms)
goto error;
+
+ amplifier_in_set_parameters(parms);
+
lock_input_stream(in);
pthread_mutex_lock(&adev->lock);
@@ -7138,6 +7163,10 @@
if (adev->num_va_sessions < UINT_MAX)
adev->num_va_sessions++;
}
+
+ if (ret == 0)
+ amplifier_input_stream_start(stream);
+
pthread_mutex_unlock(&adev->lock);
if (ret != 0) {
goto exit;
@@ -9002,6 +9031,7 @@
}
}
+ amplifier_set_parameters(parms);
audio_extn_set_parameters(adev, parms);
done:
str_parms_destroy(parms);
@@ -9130,6 +9160,8 @@
if (adev->mode != mode) {
ALOGD("%s: mode %d , prev_mode %d \n", __func__, mode , adev->mode);
adev->prev_mode = adev->mode; /* prev_mode is kept to handle voip concurrency*/
+ if (amplifier_set_mode(mode) != 0)
+ ALOGE("Failed setting amplifier mode");
adev->mode = mode;
if (mode == AUDIO_MODE_CALL_SCREEN) {
adev->current_call_output = adev->primary_output;
@@ -10288,6 +10320,8 @@
if ((--audio_device_ref_count) == 0) {
if (audio_extn_spkr_prot_is_enabled())
audio_extn_spkr_prot_deinit();
+ if (amplifier_close() != 0)
+ ALOGE("Amplifier close failed");
audio_extn_battery_properties_listener_deinit();
audio_extn_snd_mon_unregister_listener(adev);
audio_extn_sound_trigger_deinit(adev);
@@ -10719,6 +10753,10 @@
adev->vr_audio_mode_enabled = false;
audio_extn_ds2_enable(adev);
+
+ if (amplifier_open(adev) != 0)
+ ALOGE("Amplifier initialization failed");
+
*device = &adev->device.common;
if (k_enable_extended_precision)
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 32271bb..ff1f293 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -42,6 +42,7 @@
#include <cutils/str_parms.h>
#include <cutils/list.h>
#include <cutils/hashmap.h>
+#include <hardware/audio_amplifier.h>
#include <hardware/audio.h>
#include <tinyalsa/asoundlib.h>
#include <tinycompress/tinycompress.h>
@@ -746,6 +747,8 @@
Hashmap *io_streams_map;
bool a2dp_started;
bool ha_proxy_enable;
+
+ amplifier_device_t *amp;
};
struct audio_patch_record {
diff --git a/hal/audio_hw_extn_api.c b/hal/audio_hw_extn_api.c
index 4fece7e..6d8901d 100644
--- a/hal/audio_hw_extn_api.c
+++ b/hal/audio_hw_extn_api.c
@@ -42,6 +42,8 @@
#include "audio_extn.h"
#include "audio_hw_extn_api.h"
+#include <pthread.h>
+
#ifdef DYNAMIC_LOG_ENABLED
#include <log_xml_parser.h>
#define LOG_MASK HAL_MOD_FILE_AUDIO_HW_EXTN_API
diff --git a/hal/audio_perf.cpp b/hal/audio_perf.cpp
index 671a324..d127009 100644
--- a/hal/audio_perf.cpp
+++ b/hal/audio_perf.cpp
@@ -22,95 +22,216 @@
#include <utils/Mutex.h>
#include <android/hardware/power/1.2/IPower.h>
+#include <aidl/android/hardware/power/Boost.h>
+#include <aidl/android/hardware/power/IPower.h>
+#include <aidl/android/hardware/power/Mode.h>
+#include <android/binder_manager.h>
#include "audio_perf.h"
-using android::hardware::power::V1_2::IPower;
-using android::hardware::power::V1_2::PowerHint;
-using android::hardware::power::V1_2::toString;
-using android::hardware::Return;
-using android::hardware::Void;
-using android::hardware::hidl_death_recipient;
-using android::hidl::base::V1_0::IBase;
-
-// Do not use gPowerHAL, use getPowerHal to retrieve a copy instead
-static android::sp<IPower> gPowerHal_ = nullptr;
-// Protect gPowerHal_
+// Protect gPowerHal_1_2_ and gPowerHal_Aidl_
+static android::sp<android::hardware::power::V1_2::IPower> gPowerHal_1_2_;
+static std::shared_ptr<aidl::android::hardware::power::IPower> gPowerHal_Aidl_;
static std::mutex gPowerHalMutex;
+static constexpr int kDefaultBoostDurationMs = 2000;
+static constexpr int kBoostOff = -1;
-// PowerHalDeathRecipient to invalid the client when service dies
-struct PowerHalDeathRecipient : virtual public hidl_death_recipient {
- // hidl_death_recipient interface
- virtual void serviceDied(uint64_t, const android::wp<IBase>&) override {
- std::lock_guard<std::mutex> lock(gPowerHalMutex);
- ALOGE("PowerHAL just died");
- gPowerHal_ = nullptr;
- }
+static const std::string kInstance =
+ std::string(aidl::android::hardware::power::IPower::descriptor) + "/default";
+
+enum hal_version {
+ NONE,
+ HIDL_1_2,
+ AIDL,
};
-// Retrieve a copy of client
-static android::sp<IPower> getPowerHal() {
- std::lock_guard<std::mutex> lock(gPowerHalMutex);
- static android::sp<PowerHalDeathRecipient> gPowerHalDeathRecipient = nullptr;
- static bool gPowerHalExists = true;
+// Connnect PowerHAL
+static hal_version connectPowerHalLocked() {
+ static bool gPowerHalHidlExists = true;
+ static bool gPowerHalAidlExists = true;
- if (gPowerHalExists && gPowerHal_ == nullptr) {
- gPowerHal_ = IPower::getService();
+ if (!gPowerHalHidlExists && !gPowerHalAidlExists) {
+ return NONE;
+ }
- if (gPowerHal_ == nullptr) {
- ALOGE("Unable to get Power service");
- gPowerHalExists = false;
+ if (gPowerHalHidlExists) {
+ // (re)connect if handle is null
+ if (!gPowerHal_1_2_) {
+ gPowerHal_1_2_ =
+ android::hardware::power::V1_2::IPower::getService();
+ }
+ if (gPowerHal_1_2_) {
+ ALOGV("Successfully connected to Power Hal Hidl service.");
+ return HIDL_1_2;
} else {
- if (gPowerHalDeathRecipient == nullptr) {
- gPowerHalDeathRecipient = new PowerHalDeathRecipient();
- }
- Return<bool> linked = gPowerHal_->linkToDeath(
- gPowerHalDeathRecipient, 0 /* cookie */);
- if (!linked.isOk()) {
- ALOGE("Transaction error in linking to PowerHAL death: %s",
- linked.description().c_str());
- gPowerHal_ = nullptr;
- } else if (!linked) {
- ALOGW("Unable to link to PowerHal death notifications");
- gPowerHal_ = nullptr;
- } else {
- ALOGD("Connect to PowerHAL and link to death "
- "notification successfully");
- }
+ // no more try on this handle
+ gPowerHalHidlExists = false;
}
}
- return gPowerHal_;
-}
-static bool powerHint(PowerHint hint, int32_t data) {
- android::sp<IPower> powerHal = getPowerHal();
- if (powerHal == nullptr) {
- return false;
+ if (gPowerHalAidlExists) {
+ // (re)connect if handle is null
+ if (!gPowerHal_Aidl_) {
+ ndk::SpAIBinder pwBinder = ndk::SpAIBinder(
+ AServiceManager_getService(kInstance.c_str()));
+ gPowerHal_Aidl_ = aidl::android::hardware::power::IPower::fromBinder(pwBinder);
+ }
+ if (gPowerHal_Aidl_) {
+ ALOGV("Successfully connected to Power Hal Aidl service.");
+ return AIDL;
+ } else {
+ // no more try on this handle
+ gPowerHalAidlExists = false;
+ }
}
- auto ret = powerHal->powerHintAsync_1_2(hint, data);
+ return NONE;
+}
- if (!ret.isOk()) {
- ALOGE("powerHint failed, hint: %s, data: %" PRId32 ", error: %s",
- toString(hint).c_str(),
- data,
- ret.description().c_str());
+bool audio_streaming_hint_start() {
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
+ switch(connectPowerHalLocked()) {
+ case NONE:
+ return false;
+ case HIDL_1_2:
+ {
+ auto ret = gPowerHal_1_2_->powerHintAsync_1_2(
+ android::hardware::power::V1_2::PowerHint::AUDIO_STREAMING,
+ 1);
+ if (!ret.isOk()) {
+ ALOGE("powerHint failed, error: %s",
+ ret.description().c_str());
+ gPowerHal_1_2_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ case AIDL:
+ {
+ auto ret = gPowerHal_Aidl_->setBoost(
+ aidl::android::hardware::power::Boost::AUDIO_LAUNCH,
+ kDefaultBoostDurationMs);
+ if (!ret.isOk()) {
+ std::string err = ret.getDescription();
+ ALOGE("Failed to set power hint. Error: %s", err.c_str());
+ gPowerHal_Aidl_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ default:
+ ALOGE("Unknown HAL state");
+ return false;
}
- return ret.isOk();
}
-int audio_streaming_hint_start() {
- return powerHint(PowerHint::AUDIO_STREAMING, 1);
+bool audio_streaming_hint_end() {
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
+ switch(connectPowerHalLocked()) {
+ case NONE:
+ return false;
+ case HIDL_1_2:
+ {
+ auto ret = gPowerHal_1_2_->powerHintAsync_1_2(
+ android::hardware::power::V1_2::PowerHint::AUDIO_STREAMING,
+ 0);
+ if (!ret.isOk()) {
+ ALOGE("powerHint failed, error: %s",
+ ret.description().c_str());
+ gPowerHal_1_2_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ case AIDL:
+ {
+ auto ret = gPowerHal_Aidl_->setBoost(
+ aidl::android::hardware::power::Boost::AUDIO_LAUNCH,
+ kBoostOff);
+ if (!ret.isOk()) {
+ std::string err = ret.getDescription();
+ ALOGE("Failed to set power hint. Error: %s", err.c_str());
+ gPowerHal_Aidl_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ default:
+ ALOGE("Unknown HAL state");
+ return false;
+ }
}
-int audio_streaming_hint_end() {
- return powerHint(PowerHint::AUDIO_STREAMING, 0);
+bool audio_low_latency_hint_start() {
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
+ switch(connectPowerHalLocked()) {
+ case NONE:
+ return false;
+ case HIDL_1_2:
+ {
+ auto ret = gPowerHal_1_2_->powerHintAsync_1_2(
+ android::hardware::power::V1_2::PowerHint::AUDIO_LOW_LATENCY,
+ 1);
+ if (!ret.isOk()) {
+ ALOGE("powerHint failed, error: %s",
+ ret.description().c_str());
+ gPowerHal_1_2_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ case AIDL:
+ {
+ auto ret = gPowerHal_Aidl_->setMode(
+ aidl::android::hardware::power::Mode::AUDIO_STREAMING_LOW_LATENCY,
+ true);
+ if (!ret.isOk()) {
+ std::string err = ret.getDescription();
+ ALOGE("Failed to set power hint. Error: %s", err.c_str());
+ gPowerHal_Aidl_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ default:
+ ALOGE("Unknown HAL state");
+ return false;
+ }
}
-int audio_low_latency_hint_start() {
- return powerHint(PowerHint::AUDIO_LOW_LATENCY, 1);
-}
-
-int audio_low_latency_hint_end() {
- return powerHint(PowerHint::AUDIO_LOW_LATENCY, 0);
+bool audio_low_latency_hint_end() {
+ std::lock_guard<std::mutex> lock(gPowerHalMutex);
+ switch(connectPowerHalLocked()) {
+ case NONE:
+ return false;
+ case HIDL_1_2:
+ {
+ auto ret = gPowerHal_1_2_->powerHintAsync_1_2(
+ android::hardware::power::V1_2::PowerHint::AUDIO_LOW_LATENCY,
+ 0);
+ if (!ret.isOk()) {
+ ALOGE("powerHint failed, error: %s",
+ ret.description().c_str());
+ gPowerHal_1_2_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ case AIDL:
+ {
+ auto ret = gPowerHal_Aidl_->setMode(
+ aidl::android::hardware::power::Mode::AUDIO_STREAMING_LOW_LATENCY,
+ false);
+ if (!ret.isOk()) {
+ std::string err = ret.getDescription();
+ ALOGE("Failed to set power hint. Error: %s", err.c_str());
+ gPowerHal_Aidl_ = nullptr;
+ return false;
+ }
+ return true;
+ }
+ default:
+ ALOGE("Unknown HAL state");
+ return false;
+ }
}
diff --git a/hal/audio_perf.h b/hal/audio_perf.h
index b564938..2fa1160 100644
--- a/hal/audio_perf.h
+++ b/hal/audio_perf.h
@@ -17,15 +17,17 @@
#ifndef __QAUDIOPERF_H__
#define __QAUDIOPERF_H__
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
-int audio_streaming_hint_start();
-int audio_streaming_hint_end();
-
-int audio_low_latency_hint_start();
-int audio_low_latency_hint_end();
+// return true on success, false on failure
+bool audio_streaming_hint_start();
+bool audio_streaming_hint_end();
+bool audio_low_latency_hint_start();
+bool audio_low_latency_hint_end();
#ifdef __cplusplus
}
diff --git a/hal/platform_info.c b/hal/platform_info.c
index 4ad5a5c..84f56a1 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -41,6 +41,7 @@
#include "platform_api.h"
#include "audio_extn.h"
#include <platform.h>
+#include <pthread.h>
#include <math.h>
#ifdef DYNAMIC_LOG_ENABLED
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 774198d..862b81b 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -82,12 +82,12 @@
LOCAL_C_INCLUDES := \
external/tinyalsa/include \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include/audio \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include \
$(call include-path-for, audio-effects) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn/
+ $(call project-path-for,qcom-audio)/hal/audio_extn/
ifeq ($(strip $(AUDIO_FEATURE_ENABLED_DLKM)),true)
LOCAL_HEADER_LIBRARIES += audio_kernel_headers
@@ -195,14 +195,14 @@
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_C_INCLUDES := \
- vendor/qcom/opensource/audio-hal/primary-hal/hal \
+ $(call project-path-for,qcom-audio)/hal \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include/audio \
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include \
external/tinyalsa/include \
$(call include-path-for, audio-effects) \
$(call include-path-for, audio-route) \
- vendor/qcom/opensource/audio-hal/primary-hal/hal/audio_extn \
+ $(call project-path-for,qcom-audio)/hal/audio_extn \
external/tinycompress/include \
system/media/audio_utils/include
diff --git a/qahw/Android.mk b/qahw/Android.mk
index decd4c6..7cd908a 100644
--- a/qahw/Android.mk
+++ b/qahw/Android.mk
@@ -5,11 +5,9 @@
include $(CLEAR_VARS)
-libqahw-inc := $(LOCAL_PATH)/inc
-
LOCAL_MODULE := libqahwwrapper
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES := $(libqahw-inc)
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
LOCAL_HEADER_LIBRARIES := libutils_headers \
libsystem_headers \
@@ -27,10 +25,6 @@
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio/qahw/inc
-LOCAL_COPY_HEADERS := inc/qahw.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_api.h
-
LOCAL_PROPRIETARY_MODULE := true
LOCAL_VENDOR_MODULE := true
@@ -39,5 +33,12 @@
endif
include $(BUILD_SHARED_LIBRARY)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libqahw_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_HEADER_LIBRARY)
endif
endif
diff --git a/qahw_api/Android.mk b/qahw_api/Android.mk
index 30c326f..5d1789c 100644
--- a/qahw_api/Android.mk
+++ b/qahw_api/Android.mk
@@ -4,12 +4,9 @@
include $(CLEAR_VARS)
-libqahwapi-inc := $(LOCAL_PATH)/inc
-
LOCAL_MODULE := libqahw
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES := $(libqahwapi-inc)
-LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/qahw/inc
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/inc
LOCAL_SRC_FILES := \
src/qahw_api.cpp
@@ -20,6 +17,9 @@
LOCAL_STATIC_LIBRARIES += libprofile_rt
endif
+LOCAL_HEADER_LIBRARIES := \
+ libqahw_headers
+
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
@@ -30,17 +30,6 @@
LOCAL_CFLAGS += -Wall -Werror
-LOCAL_COPY_HEADERS_TO := mm-audio/qahw_api/inc
-LOCAL_COPY_HEADERS := inc/qahw_defs.h
-LOCAL_COPY_HEADERS += inc/qahw_api.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_audiosphere.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_bassboost.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_environmentalreverb.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_equalizer.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_presetreverb.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_virtualizer.h
-LOCAL_COPY_HEADERS += inc/qahw_effect_visualizer.h
-
LOCAL_VENDOR_MODULE := true
ifneq ($(filter kona lahaina holi,$(TARGET_BOARD_PLATFORM)),)
@@ -48,6 +37,14 @@
endif
include $(BUILD_SHARED_LIBRARY)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libqahwapi_headers
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/inc
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_HEADER_LIBRARY)
+
#test app compilation
include $(LOCAL_PATH)/test/Android.mk
diff --git a/qahw_api/test/Android.mk b/qahw_api/test/Android.mk
index 110a765..bc7690d 100644
--- a/qahw_api/test/Android.mk
+++ b/qahw_api/test/Android.mk
@@ -7,12 +7,14 @@
qahw_effect_test.c
LOCAL_MODULE := hal_play_test
-hal-play-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
-hal-play-inc += $(TARGET_OUT_HEADERS)/mm-audio/qahw/inc
hal-play-inc += external/tinyalsa/include
LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+LOCAL_HEADER_LIBRARIES := \
+ libqahw_headers \
+ libqahwapi_headers
+
LOCAL_SHARED_LIBRARIES := \
libaudioutils\
libqahw \
@@ -42,6 +44,10 @@
LOCAL_SRC_FILES := qahw_multi_record_test.c
LOCAL_MODULE := hal_rec_test
LOCAL_CFLAGS += -Wall -Werror -Wno-sign-compare
+
+LOCAL_HEADER_LIBRARIES := \
+ libqahwapi_headers
+
LOCAL_SHARED_LIBRARIES := \
libaudioutils \
libqahw \
@@ -49,9 +55,6 @@
LOCAL_32_BIT_ONLY := true
-hal-rec-inc = $(TARGET_OUT_HEADERS)/mm-audio/qahw_api/inc
-
-LOCAL_C_INCLUDES += $(hal-rec-inc)
LOCAL_VENDOR_MODULE := true
ifneq ($(filter kona lahaina holi,$(TARGET_BOARD_PLATFORM)),)