hal: fix failure in running VtsHalAudioV2_0Target module
VtsHalAudioV2_0Target fails to execute completely and results in
failure of target boot up after VTS execution as system server waits
indefinitely for audioserver to come up. This is due to fd leaks while
running the test cases in the module.
Disable dolby flag on all relevant targets and close open fds in
deinit of sound monitor to resolve fd leaks. This ensures successful
execution of VTS and proper target reboot after execution of VTS.
CRs-Fixed: 2067095
Change-Id: Id4c9b680017f591dec8df385280888cc893dca8a
diff --git a/configs/apq8098_latv/apq8098_latv.mk b/configs/apq8098_latv/apq8098_latv.mk
index a5b374f..a41f381 100644
--- a/configs/apq8098_latv/apq8098_latv.mk
+++ b/configs/apq8098_latv/apq8098_latv.mk
@@ -48,7 +48,7 @@
AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_HFP := true
AUDIO_FEATURE_ENABLED_INCALL_MUSIC := false
AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
@@ -178,8 +178,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-audio.dolby.ds2.enabled=true\
-audio.dolby.ds2.hardbypass=true
+audio.dolby.ds2.enabled=false\
+audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/configs/msm8909/msm8909.mk b/configs/msm8909/msm8909.mk
index ac75304..acb80a6 100755
--- a/configs/msm8909/msm8909.mk
+++ b/configs/msm8909/msm8909.mk
@@ -19,7 +19,7 @@
AUDIO_FEATURE_ENABLED_RECORD_PLAY_CONCURRENCY := true
#TODO Enable PM
#AUDIO_FEATURE_ENABLED_PM_SUPPORT := true
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
MM_AUDIO_ENABLED_SAFX := true
DOLBY_ENABLE := false
diff --git a/configs/msm8937/msm8937.mk b/configs/msm8937/msm8937.mk
index 5220969..a5ca362 100644
--- a/configs/msm8937/msm8937.mk
+++ b/configs/msm8937/msm8937.mk
@@ -28,7 +28,7 @@
DTS_CODEC_M_ := true
MM_AUDIO_ENABLED_SAFX := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
DOLBY_ENABLE := false
endif
@@ -163,8 +163,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.dolby.ds2.enabled=true\
-vendor.audio.dolby.ds2.hardbypass=true
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/configs/msm8953/msm8953.mk b/configs/msm8953/msm8953.mk
index d8f0d89..bb3e487 100644
--- a/configs/msm8953/msm8953.mk
+++ b/configs/msm8953/msm8953.mk
@@ -27,7 +27,7 @@
#AUDIO_FEATURE_ENABLED_MULTIPLE_TUNNEL := true
MM_AUDIO_ENABLED_SAFX := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
DOLBY_ENABLE := false
endif
@@ -162,8 +162,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.dolby.ds2.enabled=true\
-vendor.audio.dolby.ds2.hardbypass=true
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/configs/msm8996/msm8996.mk b/configs/msm8996/msm8996.mk
index 7e1e437..aca0a80 100644
--- a/configs/msm8996/msm8996.mk
+++ b/configs/msm8996/msm8996.mk
@@ -27,7 +27,7 @@
DTS_CODEC_M_ := true
MM_AUDIO_ENABLED_SAFX := true
AUDIO_FEATURE_ENABLED_HW_ACCELERATED_EFFECTS := false
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_AUDIOSPHERE := true
DOLBY_ENABLE := false
endif
@@ -150,8 +150,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.dolby.ds2.enabled=true\
-vendor.audio.dolby.ds2.hardbypass=true
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/configs/msm8998/msm8998.mk b/configs/msm8998/msm8998.mk
index 8b968e1..5dde69d 100644
--- a/configs/msm8998/msm8998.mk
+++ b/configs/msm8998/msm8998.mk
@@ -48,7 +48,7 @@
AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_HFP := true
AUDIO_FEATURE_ENABLED_INCALL_MUSIC := false
AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
@@ -168,8 +168,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.dolby.ds2.enabled=true\
-vendor.audio.dolby.ds2.hardbypass=true
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/configs/sdm660/sdm660.mk b/configs/sdm660/sdm660.mk
index c6daaed..c632d05 100644
--- a/configs/sdm660/sdm660.mk
+++ b/configs/sdm660/sdm660.mk
@@ -49,7 +49,7 @@
AUDIO_FEATURE_ENABLED_HDMI_PASSTHROUGH := true
#AUDIO_FEATURE_ENABLED_KEEP_ALIVE := true
AUDIO_FEATURE_ENABLED_DISPLAY_PORT := true
-AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
+AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := false
AUDIO_FEATURE_ENABLED_HFP := true
AUDIO_FEATURE_ENABLED_INCALL_MUSIC := false
AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS := true
@@ -175,8 +175,8 @@
#Enable DS2, Hardbypass feature for Dolby
PRODUCT_PROPERTY_OVERRIDES += \
-vendor.audio.dolby.ds2.enabled=true\
-vendor.audio.dolby.ds2.hardbypass=true
+vendor.audio.dolby.ds2.enabled=false\
+vendor.audio.dolby.ds2.hardbypass=false
#Disable Multiple offload sesison
PRODUCT_PROPERTY_OVERRIDES += \
diff --git a/hal/audio_extn/sndmonitor.c b/hal/audio_extn/sndmonitor.c
index b560c9d..dd7f92f 100644
--- a/hal/audio_extn/sndmonitor.c
+++ b/hal/audio_extn/sndmonitor.c
@@ -227,8 +227,10 @@
}
ret = add_new_sndcard(atoi(ptr), fd);
- if (ret != 0)
+ if (ret != 0) {
+ close(fd);
continue;
+ }
num_cards++;
@@ -255,8 +257,10 @@
continue;
ret = add_new_sndcard(CPE_MAGIC_NUM+num_cpe, fd);
- if (ret != 0)
+ if (ret != 0) {
+ close(fd);
continue;
+ }
num_cpe++;
num_cards++;
@@ -623,9 +627,11 @@
write(sndmonitor.intpipe[1], "Q", 1);
pthread_join(sndmonitor.monitor_thread, (void **) NULL);
+ free_dev_events();
listeners_deinit();
free_sndcards();
- free_dev_events();
+ close(sndmonitor.intpipe[0]);
+ close(sndmonitor.intpipe[1]);
sndmonitor.initcheck = 0;
return 0;
}
@@ -639,13 +645,13 @@
sndmonitor.initcheck = false;
if (pipe(sndmonitor.intpipe) < 0)
- return -ENODEV;
+ goto pipe_error;
if (enum_sndcards() < 0)
- return -ENODEV;
+ goto enum_sncards_error;
if (listeners_init() < 0)
- return -ENODEV;
+ goto listeners_error;
#ifdef MONITOR_DEVICE_EVENTS
enum_dev_events(); // failure here isn't fatal
@@ -656,14 +662,20 @@
monitor_thread_loop, NULL);
if (ret) {
- free_sndcards();
- free_dev_events();
- close(sndmonitor.intpipe[0]);
- close(sndmonitor.intpipe[1]);
- return -ENODEV;
+ goto monitor_thread_create_error;
}
sndmonitor.initcheck = true;
return 0;
+
+monitor_thread_create_error:
+ listeners_deinit();
+listeners_error:
+ free_sndcards();
+enum_sncards_error:
+ close(sndmonitor.intpipe[0]);
+ close(sndmonitor.intpipe[1]);
+pipe_error:
+ return -ENODEV;
}
int audio_extn_snd_mon_register_listener(void *stream, snd_mon_cb cb)