audio: Add flags to makefiles
Enable GCOV if config is set to true. Also
add gcov_flush in source files to get enhanced
code coverage.
Change-Id: I39776cc6d6f16cd23da05b66669eea22fc4cba81
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
diff --git a/hal/Android.mk b/hal/Android.mk
index febba73..f19e9ab 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -436,6 +436,12 @@
LOCAL_SRC_FILES += audio_extn/ext_hw_plugin.c
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+ LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+ LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+ LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
LOCAL_MODULE_RELATIVE_PATH := hw
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 5c7fc9c..acb2b4d 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -448,6 +448,18 @@
static int out_set_mmap_volume(struct audio_stream_out *stream, float left, float right);
static int out_set_voip_volume(struct audio_stream_out *stream, float left, float right);
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
static bool may_use_noirq_mode(struct audio_device *adev, audio_usecase_t uc_id,
int flags __unused)
{
@@ -2437,7 +2449,7 @@
free(uc_info);
adev->active_input = get_next_active_input(adev);
-
+ enable_gcov();
ALOGV("%s: exit: status(%d)", __func__, ret);
return ret;
}
@@ -2610,7 +2622,7 @@
done_open:
audio_extn_perf_lock_release(&adev->perf_lock_handle);
ALOGD("%s: exit", __func__);
-
+ enable_gcov();
return ret;
error_open:
@@ -2624,7 +2636,7 @@
*/
usleep(50000);
ALOGD("%s: exit: status(%d)", __func__, ret);
-
+ enable_gcov();
return ret;
}
@@ -3315,6 +3327,7 @@
platform_set_swap_channels(adev, true);
ATRACE_END();
+ enable_gcov();
return ret;
error_open:
audio_extn_perf_lock_release(&adev->perf_lock_handle);
@@ -3326,6 +3339,7 @@
*/
usleep(50000);
ATRACE_END();
+ enable_gcov();
return ret;
}
@@ -7560,7 +7574,7 @@
adev = NULL;
}
pthread_mutex_unlock(&adev_init_lock);
-
+ enable_gcov();
return 0;
}
diff --git a/hdmi_in_test/Android.mk b/hdmi_in_test/Android.mk
index 0530372..d016cb3 100644
--- a/hdmi_in_test/Android.mk
+++ b/hdmi_in_test/Android.mk
@@ -12,4 +12,10 @@
liblog \
libcutils
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
include $(BUILD_EXECUTABLE)
diff --git a/mm-audio/aenc-aac/qdsp6/Android.mk b/mm-audio/aenc-aac/qdsp6/Android.mk
index bbfcc3c..cbc832d 100644
--- a/mm-audio/aenc-aac/qdsp6/Android.mk
+++ b/mm-audio/aenc-aac/qdsp6/Android.mk
@@ -37,6 +37,12 @@
LOCAL_SRC_FILES := src/aenc_svr.c
LOCAL_SRC_FILES += src/omx_aac_aenc.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/mm-audio/aenc-amrnb/qdsp6/Android.mk b/mm-audio/aenc-amrnb/qdsp6/Android.mk
index 0968530..4a05742 100644
--- a/mm-audio/aenc-amrnb/qdsp6/Android.mk
+++ b/mm-audio/aenc-amrnb/qdsp6/Android.mk
@@ -39,6 +39,12 @@
LOCAL_SRC_FILES := src/aenc_svr.c
LOCAL_SRC_FILES += src/omx_amr_aenc.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/mm-audio/aenc-evrc/qdsp6/Android.mk b/mm-audio/aenc-evrc/qdsp6/Android.mk
index 98b1fe9..76ed6be 100644
--- a/mm-audio/aenc-evrc/qdsp6/Android.mk
+++ b/mm-audio/aenc-evrc/qdsp6/Android.mk
@@ -39,6 +39,12 @@
LOCAL_SRC_FILES := src/aenc_svr.c
LOCAL_SRC_FILES += src/omx_evrc_aenc.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/mm-audio/aenc-g711/qdsp6/Android.mk b/mm-audio/aenc-g711/qdsp6/Android.mk
index 95dd655..d71f121 100644
--- a/mm-audio/aenc-g711/qdsp6/Android.mk
+++ b/mm-audio/aenc-g711/qdsp6/Android.mk
@@ -40,6 +40,12 @@
LOCAL_SRC_FILES += src/omx_g711_aenc.cpp
LOCAL_SRC_FILES += src/omx_log.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/mm-audio/aenc-qcelp13/qdsp6/Android.mk b/mm-audio/aenc-qcelp13/qdsp6/Android.mk
index 52e43bb..1178b2f 100644
--- a/mm-audio/aenc-qcelp13/qdsp6/Android.mk
+++ b/mm-audio/aenc-qcelp13/qdsp6/Android.mk
@@ -39,6 +39,12 @@
LOCAL_SRC_FILES := src/aenc_svr.c
LOCAL_SRC_FILES += src/omx_qcelp13_aenc.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index 9c90f3d..9547985 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -42,6 +42,12 @@
LOCAL_CFLAGS += -DINSTANCE_ID_ENABLED
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+ LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+ LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+ LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_CFLAGS+= -O2 -fvisibility=hidden
ifneq ($(strip $(AUDIO_FEATURE_DISABLED_DTS_EAGLE)),true)
diff --git a/post_proc/asphere.c b/post_proc/asphere.c
index 20ca694..82bb496 100644
--- a/post_proc/asphere.c
+++ b/post_proc/asphere.c
@@ -62,6 +62,18 @@
ASPHERE_ERROR
};
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
struct asphere_module {
bool enabled;
int status;
@@ -157,6 +169,7 @@
static int asphere_init() {
pthread_once(&asphere_once, asphere_init_once);
+ enable_gcov();
return asphere.init_status;
}
diff --git a/post_proc/bass_boost.c b/post_proc/bass_boost.c
index 68cd46f..8e91764 100644
--- a/post_proc/bass_boost.c
+++ b/post_proc/bass_boost.c
@@ -48,6 +48,18 @@
#define LIB_ACDB_LOADER "libacdbloader.so"
#define PBE_CONF_APP_ID 0x00011134
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
enum {
AUDIO_DEVICE_CAL_TYPE = 0,
AUDIO_STREAM_CAL_TYPE,
@@ -221,7 +233,7 @@
bassboost_init((effect_context_t *)&(bass_ctxt->bassboost_ctxt));
pbe_init((effect_context_t *)&(bass_ctxt->pbe_ctxt));
-
+ enable_gcov();
return 0;
}
@@ -396,6 +408,7 @@
bass_ctxt->temp_disabled = false;
memset(&(bass_ctxt->offload_bass), 0, sizeof(struct bass_boost_params));
+ enable_gcov();
return 0;
}
diff --git a/post_proc/equalizer.c b/post_proc/equalizer.c
index c1c1303..eddaca1 100644
--- a/post_proc/equalizer.c
+++ b/post_proc/equalizer.c
@@ -41,6 +41,19 @@
"The Android Open Source Project",
};
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+void enable_gcov()
+{
+}
+#endif
+
+
static const char *equalizer_preset_names[] = {
"Normal",
"Classical",
@@ -489,7 +502,7 @@
eq_ctxt->hw_acc_fd = -1;
memset(&(eq_ctxt->offload_eq), 0, sizeof(struct eq_params));
offload_eq_set_preset(&(eq_ctxt->offload_eq), INVALID_PRESET);
-
+ enable_gcov();
return 0;
}
@@ -510,6 +523,7 @@
OFFLOAD_SEND_EQ_ENABLE_FLAG |
OFFLOAD_SEND_EQ_BANDS_LEVEL);
}
+ enable_gcov();
return 0;
}
@@ -527,6 +541,7 @@
hw_acc_eq_send_params(eq_ctxt->hw_acc_fd, &eq_ctxt->offload_eq,
OFFLOAD_SEND_EQ_ENABLE_FLAG);
}
+ enable_gcov();
return 0;
}
@@ -546,6 +561,7 @@
OFFLOAD_SEND_EQ_ENABLE_FLAG |
OFFLOAD_SEND_EQ_BANDS_LEVEL);
}
+ enable_gcov();
return 0;
}
@@ -561,6 +577,7 @@
offload_eq_send_params(eq_ctxt->ctl, &eq, OFFLOAD_SEND_EQ_ENABLE_FLAG);
}
eq_ctxt->ctl = NULL;
+ enable_gcov();
return 0;
}
diff --git a/post_proc/hw_accelerator.c b/post_proc/hw_accelerator.c
index fd95db0..fae5807 100644
--- a/post_proc/hw_accelerator.c
+++ b/post_proc/hw_accelerator.c
@@ -41,6 +41,17 @@
#include "effect_api.h"
#include "hw_accelerator.h"
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
/* hw_accelerator UUID: 7d1580bd-297f-4683-9239-e475b6d1d69f */
const effect_descriptor_t hw_accelerator_descriptor = {
@@ -163,7 +174,7 @@
hw_acc_ctxt->fd = -1;
memset(&(hw_acc_ctxt->cfg), 0, sizeof(struct msm_hwacc_effects_config));
-
+ enable_gcov();
return 0;
}
@@ -243,6 +254,7 @@
hw_acc_ctxt->fd = -1;
return -EFAULT;
}
+ enable_gcov();
return 0;
}
@@ -255,6 +267,7 @@
if (close(hw_acc_ctxt->fd) < 0)
ALOGE("releasing hardware accelerated effects driver failed");
hw_acc_ctxt->fd = -1;
+ enable_gcov();
return 0;
}
@@ -267,6 +280,7 @@
if (close(hw_acc_ctxt->fd) < 0)
ALOGE("releasing hardware accelerated effects driver failed");
hw_acc_ctxt->fd = -1;
+ enable_gcov();
return 0;
}
diff --git a/post_proc/reverb.c b/post_proc/reverb.c
index e97b651..eafa07e 100644
--- a/post_proc/reverb.c
+++ b/post_proc/reverb.c
@@ -30,6 +30,20 @@
#include "effect_api.h"
#include "reverb.h"
+#define REVERB_MAX_LATENCY 100
+
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
/* Offload auxiliary environmental reverb UUID: 79a18026-18fd-4185-8233-0002a5d5c51b */
const effect_descriptor_t aux_env_reverb_descriptor = {
{ 0xc2e5d5f0, 0x94bd, 0x4763, 0x9cac, { 0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e } },
@@ -718,7 +732,7 @@
if (reverb_ctxt->preset &&
reverb_ctxt->next_preset != reverb_ctxt->cur_preset)
reverb_load_preset(reverb_ctxt);
-
+ enable_gcov();
return 0;
}
@@ -740,6 +754,7 @@
if (!offload_reverb_get_enable_flag(&(reverb_ctxt->offload_reverb)))
offload_reverb_set_enable_flag(&(reverb_ctxt->offload_reverb), true);
+ enable_gcov();
return 0;
}
@@ -760,6 +775,7 @@
&reverb_ctxt->offload_reverb,
OFFLOAD_SEND_REVERB_ENABLE_FLAG);
}
+ enable_gcov();
return 0;
}
@@ -782,7 +798,7 @@
OFFLOAD_SEND_REVERB_PRESET);
}
}
-
+ enable_gcov();
return 0;
}
@@ -799,6 +815,7 @@
OFFLOAD_SEND_REVERB_ENABLE_FLAG);
}
reverb_ctxt->ctl = NULL;
+ enable_gcov();
return 0;
}
diff --git a/post_proc/virtualizer.c b/post_proc/virtualizer.c
index dfa7691..f47630b 100644
--- a/post_proc/virtualizer.c
+++ b/post_proc/virtualizer.c
@@ -29,6 +29,20 @@
#include "effect_api.h"
#include "virtualizer.h"
+#define VIRUALIZER_MAX_LATENCY 30
+
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
/* Offload Virtualizer UUID: 509a4498-561a-4bea-b3b1-0002a5d5c51b */
const effect_descriptor_t virtualizer_descriptor = {
{0x37cc2c00, 0xdddd, 0x11db, 0x8577, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}},
@@ -475,7 +489,7 @@
virt_ctxt->forced_device = AUDIO_DEVICE_NONE;
virt_ctxt->device = AUDIO_DEVICE_NONE;
memset(&(virt_ctxt->offload_virt), 0, sizeof(struct virtualizer_params));
-
+ enable_gcov();
return 0;
}
@@ -500,6 +514,7 @@
OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG |
OFFLOAD_SEND_VIRTUALIZER_STRENGTH);
}
+ enable_gcov();
return 0;
}
@@ -521,6 +536,7 @@
&virt_ctxt->offload_virt,
OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG);
}
+ enable_gcov();
return 0;
}
@@ -541,6 +557,7 @@
OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG |
OFFLOAD_SEND_VIRTUALIZER_STRENGTH);
}
+ enable_gcov();
return 0;
}
@@ -557,6 +574,7 @@
OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG);
}
virt_ctxt->ctl = NULL;
+ enable_gcov();
return 0;
}
diff --git a/post_proc/volume_listener.c b/post_proc/volume_listener.c
index 2305bf7..d4c3753 100644
--- a/post_proc/volume_listener.c
+++ b/post_proc/volume_listener.c
@@ -63,6 +63,18 @@
#define AHAL_GAIN_DEPENDENT_INTERFACE_FUNCTION "audio_hw_send_gain_dep_calibration"
#define AHAL_GAIN_GET_MAPPING_TABLE "audio_hw_get_gain_level_mapping"
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
enum {
VOL_LISTENER_STATE_UNINITIALIZED,
VOL_LISTENER_STATE_INITIALIZED,
@@ -755,6 +767,7 @@
pthread_mutex_unlock(&vol_listner_init_lock);
*p_handle = (effect_handle_t)context;
+ enable_gcov();
return 0;
}
@@ -821,6 +834,7 @@
dump_list_l();
}
pthread_mutex_unlock(&vol_listner_init_lock);
+ enable_gcov();
return status;
}
diff --git a/qahw_api/Android.mk b/qahw_api/Android.mk
index fa4e6cb..1cad75d 100644
--- a/qahw_api/Android.mk
+++ b/qahw_api/Android.mk
@@ -14,6 +14,12 @@
LOCAL_SRC_FILES := \
src/qahw_api.cpp
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_SHARED_LIBRARIES := \
liblog \
libcutils \
diff --git a/qahw_api/test/Android.mk b/qahw_api/test/Android.mk
index 06e8a5a..cca72f8 100644
--- a/qahw_api/test/Android.mk
+++ b/qahw_api/test/Android.mk
@@ -20,6 +20,12 @@
libutils \
libcutils
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_32_BIT_ONLY := true
LOCAL_C_INCLUDES += $(hal-play-inc)
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index de6bc87..1cb3ed8 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -27,6 +27,12 @@
LOCAL_CFLAGS += -DCAPTURE_DEVICE=7
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_HEADER_LIBRARIES := libsystem_headers \
libhardware_headers
LOCAL_SHARED_LIBRARIES := \
diff --git a/visualizer/offload_visualizer.c b/visualizer/offload_visualizer.c
index a9664b6..9ad8fea 100644
--- a/visualizer/offload_visualizer.c
+++ b/visualizer/offload_visualizer.c
@@ -40,6 +40,18 @@
typedef void (*acdb_send_audio_cal_t)(int, int);
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
acdb_send_audio_cal_t acdb_send_audio_cal;
enum {
@@ -223,6 +235,7 @@
int lib_init() {
pthread_once(&once, init_once);
+ enable_gcov();
return init_status;
}
diff --git a/voice_processing/Android.mk b/voice_processing/Android.mk
index a39df33..5b865b7 100644
--- a/voice_processing/Android.mk
+++ b/voice_processing/Android.mk
@@ -20,6 +20,12 @@
liblog \
libcutils
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_GCOV)),true)
+LOCAL_CFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_CPPFLAGS += --coverage -fprofile-arcs -ftest-coverage
+LOCAL_STATIC_LIBRARIES += libprofile_rt
+endif
+
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_HEADER_LIBRARIES := libhardware_headers
diff --git a/voice_processing/voice_processing.c b/voice_processing/voice_processing.c
index caf1cf7..32b76a5 100644
--- a/voice_processing/voice_processing.c
+++ b/voice_processing/voice_processing.c
@@ -43,6 +43,18 @@
NUM_ID
};
+#ifdef AUDIO_FEATURE_ENABLED_GCOV
+extern void __gcov_flush();
+static void enable_gcov()
+{
+ __gcov_flush();
+}
+#else
+static void enable_gcov()
+{
+}
+#endif
+
// Session state
enum session_state {
SESSION_STATE_INIT, // initialized
@@ -711,6 +723,7 @@
list_remove(&session->node);
free(session);
}
+ enable_gcov();
return status;
}
@@ -732,7 +745,7 @@
return 0;
}
}
-
+ enable_gcov();
return -EINVAL;
}