Merge "mm-audio: Fix 64 bit compilation warnings"
diff --git a/hal/Android.mk b/hal/Android.mk
index 6239c01..39e5458 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -41,97 +41,94 @@
LOCAL_SRC_FILES += audio_extn/audio_extn.c \
audio_extn/utils.c
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_PCM_OFFLOAD)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PCM_OFFLOAD)),true)
LOCAL_CFLAGS += -DPCM_OFFLOAD_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_ANC_HEADSET)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_ANC_HEADSET)),true)
LOCAL_CFLAGS += -DANC_HEADSET_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_FLUENCE)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FLUENCE)),true)
LOCAL_CFLAGS += -DFLUENCE_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_PROXY_DEVICE)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAFE_PROXY_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_FM)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM)),true)
LOCAL_CFLAGS += -DFM_ENABLED
LOCAL_SRC_FILES += audio_extn/fm.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_USBAUDIO)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_USBAUDIO)),true)
LOCAL_CFLAGS += -DUSB_HEADSET_ENABLED
LOCAL_SRC_FILES += audio_extn/usb.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_HFP)),true)
+
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HFP)),true)
LOCAL_CFLAGS += -DHFP_ENABLED
LOCAL_SRC_FILES += audio_extn/hfp.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_CUSTOMSTEREO)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_CUSTOMSTEREO)),true)
LOCAL_CFLAGS += -DCUSTOM_STEREO_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_SSR)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_SSR)),true)
LOCAL_CFLAGS += -DSSR_ENABLED
LOCAL_SRC_FILES += audio_extn/ssr.c
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/mm-audio/surround_sound/
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/common/inc/
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_MULTI_VOICE_SESSIONS)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true)
LOCAL_CFLAGS += -DMULTI_VOICE_SESSION_ENABLED
LOCAL_SRC_FILES += voice_extn/voice_extn.c
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
-
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_INCALL_MUSIC)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_INCALL_MUSIC)),true)
LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED
endif
-
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_COMPRESS_VOIP)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_VOIP)),true)
LOCAL_CFLAGS += -DCOMPRESS_VOIP_ENABLED
LOCAL_SRC_FILES += voice_extn/compress_voip.c
endif
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_FORMATS)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_EXTN_FORMATS)),true)
LOCAL_CFLAGS += -DFORMATS_ENABLED
endif
-ifneq ($(strip, $(AUDIO_FEATURE_DISABLED_SPKR_PROTECTION)),true)
-ifneq ($(filter msm8974 apq8084,$(TARGET_BOARD_PLATFORM)),)
+ifeq ($(strip, $(AUDIO_FEATURE_ENABLED_SPKR_PROTECTION)),true)
LOCAL_CFLAGS += -DSPKR_PROT_ENABLED
LOCAL_SRC_FILES += audio_extn/spkr_protection.c
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
endif
-endif
ifdef MULTIPLE_HW_VARIANTS_ENABLED
LOCAL_CFLAGS += -DHW_VARIANTS_ENABLED
LOCAL_SRC_FILES += $(AUDIO_PLATFORM)/hw_info.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_COMPRESS_CAPTURE)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE)),true)
LOCAL_CFLAGS += -DCOMPRESS_CAPTURE_ENABLED
LOCAL_SRC_FILES += audio_extn/compress_capture.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_DS1_DOLBY_DDP)),true)
+ifeq ($(strip $(DOLBY_DDP)),true)
LOCAL_CFLAGS += -DDS1_DOLBY_DDP_ENABLED
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
LOCAL_SRC_FILES += audio_extn/dolby.c
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_DS1_DOLBY_DAP)),true)
+ifeq ($(strip $(DOLBY_DAP)),true)
LOCAL_CFLAGS += -DDS1_DOLBY_DAP_ENABLED
-ifeq ($(strip $(AUDIO_FEATURE_DISABLED_DS1_DOLBY_DDP)),true)
+ifneq ($(strip $(DOLBY_DDP)),true)
LOCAL_SRC_FILES += audio_extn/dolby.c
endif
endif
@@ -173,7 +170,7 @@
LOCAL_MODULE := audio.primary.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c
index 3776652..7d88ac9 100644
--- a/hal/audio_extn/audio_extn.c
+++ b/hal/audio_extn/audio_extn.c
@@ -62,7 +62,7 @@
struct str_parms *parms);
#endif
#ifndef HFP_ENABLED
-void audio_extn_hfp_set_parameters(adev, parms) (0)
+#define audio_extn_hfp_set_parameters(adev, parms) (0)
#else
void audio_extn_hfp_set_parameters(struct audio_device *adev,
struct str_parms *parms);
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
index 771d913..965e93e 100644
--- a/hal/audio_extn/audio_extn.h
+++ b/hal/audio_extn/audio_extn.h
@@ -27,9 +27,7 @@
#define AUDIO_FORMAT_PCM_16_BIT_OFFLOAD (AUDIO_FORMAT_PCM_OFFLOAD | AUDIO_FORMAT_PCM_SUB_16_BIT)
#define AUDIO_FORMAT_PCM_24_BIT_OFFLOAD (AUDIO_FORMAT_PCM_OFFLOAD | AUDIO_FORMAT_PCM_SUB_8_24_BIT)
#define AUDIO_OFFLOAD_CODEC_FORMAT "music_offload_codec_format"
-static inline bool audio_is_offload_pcm(audio_format_t format) {
- return ((format & AUDIO_FORMAT_MAIN_MASK) == AUDIO_FORMAT_PCM_OFFLOAD);
-}
+#define audio_is_offload_pcm(format) (0)
#endif
#ifndef AFE_PROXY_ENABLED
@@ -57,7 +55,7 @@
#define AUDIO_SOURCE_FM_RX 9
#define AUDIO_SOURCE_FM_RX_A2DP 10
#define AUDIO_DEVICE_IN_FM_RX (AUDIO_DEVICE_BIT_IN | 0x8000)
-#define AUDIO_DEVICE_IN_FM_RX_A2DP AUDIO_DEVICE_BIT_IN | 0x10000
+#define AUDIO_DEVICE_IN_FM_RX_A2DP (AUDIO_DEVICE_BIT_IN | 0x10000)
#endif
@@ -265,4 +263,7 @@
audio_format_t format,
struct stream_app_type_cfg *app_type_cfg);
int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase);
+void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
+ struct audio_usecase *usecase);
+
#endif /* AUDIO_EXTN_H */
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 0c5bb07..1d1613a 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -51,6 +51,8 @@
struct pcm *fm_pcm_tx;
bool is_fm_running;
float fm_volume;
+ bool restart_fm;
+ int scard_state;
};
static struct fm_module fmmod = {
@@ -58,6 +60,8 @@
.fm_pcm_tx = NULL,
.fm_volume = 0,
.is_fm_running = 0,
+ .restart_fm = 0,
+ .scard_state = SND_CARD_STATE_ONLINE,
};
static int32_t fm_set_volume(struct audio_device *adev, float value)
@@ -212,7 +216,23 @@
float vol =0.0;
ALOGV("%s: enter", __func__);
+ ret = str_parms_get_str(parms, "SND_CARD_STATUS", value, sizeof(value));
+ if (ret >= 0) {
+ char *snd_card_status = value+2;
+ if (strstr(snd_card_status, "OFFLINE")) {
+ fmmod.scard_state = SND_CARD_STATE_OFFLINE;
+ }
+ else if (strstr(snd_card_status, "ONLINE")) {
+ fmmod.scard_state = SND_CARD_STATE_ONLINE;
+ }
+ }
if(fmmod.is_fm_running) {
+ if (fmmod.scard_state == SND_CARD_STATE_OFFLINE) {
+ ALOGD("sound card is OFFLINE, stop FM");
+ fm_stop(adev);
+ fmmod.restart_fm = 1;
+ }
+
ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING,
value, sizeof(value));
if (ret >= 0) {
@@ -221,6 +241,11 @@
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
}
}
+ if (fmmod.restart_fm && (fmmod.scard_state == SND_CARD_STATE_ONLINE)) {
+ ALOGD("sound card is ONLINE, restart FM");
+ fmmod.restart_fm = 0;
+ fm_start(adev);
+ }
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HANDLE_FM,
value, sizeof(value));
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 91f69f3..cd2a94e 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -686,11 +686,6 @@
}
spkr_prot_calib_cancel(adev);
spkr_prot_set_spkrstatus(true);
- if (platform_send_audio_calibration(adev->platform,
- SND_DEVICE_OUT_SPEAKER_PROTECTED) < 0) {
- adev->snd_dev_ref_cnt[snd_device]--;
- return -EINVAL;
- }
ALOGV("%s: snd_device(%d: %s)", __func__, snd_device,
platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED));
audio_route_apply_and_update_path(adev->audio_route,
@@ -732,7 +727,8 @@
exit:
/* Clear VI feedback cal and replace with handset MIC */
platform_send_audio_calibration(adev->platform,
- SND_DEVICE_IN_HANDSET_MIC);
+ SND_DEVICE_IN_HANDSET_MIC,
+ platform_get_default_app_type(adev->platform), 8000);
if (ret) {
if (handle.pcm_tx)
pcm_close(handle.pcm_tx);
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index bb34bf0..6bb1b1b 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -174,7 +174,7 @@
static int parse_app_type_names(void *platform, char *name)
{
- int app_type = 0; /* TODO: default app type from acdb when exposed using "platform" */
+ int app_type = platform_get_default_app_type(platform);
char *str = strtok(name, "|");
if (str != NULL && strcmp(str, DYNAMIC_VALUE_TAG))
@@ -248,7 +248,7 @@
}
if (streams_output_cfg_list == NULL) {
app_type_cfg[length++] = 1;
- app_type_cfg[length++] = 0; /* TODO: default app type from acdb when exposed from "platform" */
+ app_type_cfg[length++] = platform_get_default_app_type(platform);
app_type_cfg[length++] = 48000;
app_type_cfg[length++] = 16;
mixer_ctl_set_array(ctl, app_type_cfg, length);
@@ -383,7 +383,7 @@
}
}
ALOGW("%s: App type could not be selected. Falling back to default", __func__);
- app_type_cfg->app_type = 0; /* TODO: default app type from acdb when exposed from "platform" */
+ app_type_cfg->app_type = platform_get_default_app_type(platform);
app_type_cfg->sample_rate = 48000;
app_type_cfg->bit_width = 16;
}
@@ -444,3 +444,26 @@
exit_send_app_type_cfg:
return rc;
}
+
+void audio_extn_utils_send_audio_calibration(struct audio_device *adev,
+ struct audio_usecase *usecase)
+{
+ int type = usecase->type;
+
+ if (type == PCM_PLAYBACK) {
+ struct stream_out *out = usecase->stream.out;
+ int snd_device = usecase->out_snd_device;
+ snd_device = (snd_device == SND_DEVICE_OUT_SPEAKER) ?
+ audio_extn_get_spkr_prot_snd_device(snd_device) : snd_device;
+ platform_send_audio_calibration(adev->platform, usecase->out_snd_device,
+ out->app_type_cfg.app_type,
+ out->app_type_cfg.sample_rate);
+ }
+ if ((type == PCM_HFP_CALL) || (type == PCM_CAPTURE)) {
+ /* when app type is default. the sample rate is not used to send cal */
+ platform_send_audio_calibration(adev->platform, usecase->in_snd_device,
+ platform_get_default_app_type(adev->platform),
+ 48000);
+ }
+}
+
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 0468b42..5793cce 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -257,6 +257,7 @@
audio_extn_dolby_set_dmid(adev);
audio_extn_dolby_set_endpoint(adev);
#endif
+ audio_extn_utils_send_audio_calibration(adev, usecase);
audio_extn_utils_send_app_type_cfg(usecase);
strcpy(mixer_path, use_case_table[usecase->id]);
platform_add_backend_name(mixer_path, snd_device);
@@ -323,6 +324,10 @@
if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
audio_extn_spkr_prot_is_enabled()) {
+ if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
+ adev->snd_dev_ref_cnt[snd_device]--;
+ return -EINVAL;
+ }
if (audio_extn_spkr_prot_start_processing(snd_device)) {
ALOGE("%s: spkr_start_processing failed", __func__);
return -EINVAL;
@@ -334,7 +339,7 @@
and audio, notify listen hal before audio calibration is sent */
audio_extn_listen_update_status(snd_device,
LISTEN_EVENT_SND_DEVICE_BUSY);
- if (platform_send_audio_calibration(adev->platform, snd_device) < 0) {
+ if (platform_get_snd_device_acdb_id(snd_device) < 0) {
adev->snd_dev_ref_cnt[snd_device]--;
audio_extn_listen_update_status(snd_device,
LISTEN_EVENT_SND_DEVICE_FREE);
@@ -377,7 +382,7 @@
/* exit usb capture thread */
if(SND_DEVICE_IN_USB_HEADSET_MIC == snd_device)
- audio_extn_usb_stop_capture(adev);
+ audio_extn_usb_stop_capture();
if ((snd_device == SND_DEVICE_OUT_SPEAKER ||
snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
@@ -837,11 +842,9 @@
pcm_close(in->pcm);
in->pcm = NULL;
ret = -EIO;
- in->pcm_error_type = PCM_ERROR_EIO;
goto error_open;
}
- in->pcm_error_type = PCM_ERROR_NONE;
ALOGV("%s: exit", __func__);
return ret;
@@ -976,18 +979,18 @@
send_callback = false;
switch(cmd->cmd) {
case OFFLOAD_CMD_WAIT_FOR_BUFFER:
- ALOGD("copl(%x):calling compress_wait", (unsigned int)out);
+ ALOGD("copl(%p):calling compress_wait", out);
compress_wait(out->compr, -1);
- ALOGD("copl(%x):out of compress_wait", (unsigned int)out);
+ ALOGD("copl(%p):out of compress_wait", out);
send_callback = true;
event = STREAM_CBK_EVENT_WRITE_READY;
break;
case OFFLOAD_CMD_PARTIAL_DRAIN:
ret = compress_next_track(out->compr);
if(ret == 0) {
- ALOGD("copl(%x):calling compress_partial_drain", (unsigned int)out);
+ ALOGD("copl(%p):calling compress_partial_drain", out);
compress_partial_drain(out->compr);
- ALOGD("copl(%x):out of compress_partial_drain", (unsigned int)out);
+ ALOGD("copl(%p):out of compress_partial_drain", out);
}
else if(ret == -ETIMEDOUT)
compress_drain(out->compr);
@@ -997,9 +1000,9 @@
event = STREAM_CBK_EVENT_DRAIN_READY;
break;
case OFFLOAD_CMD_DRAIN:
- ALOGD("copl(%x):calling compress_drain", (unsigned int)out);
+ ALOGD("copl(%p):calling compress_drain", out);
compress_drain(out->compr);
- ALOGD("copl(%x):calling compress_drain", (unsigned int)out);
+ ALOGD("copl(%p):calling compress_drain", out);
send_callback = true;
event = STREAM_CBK_EVENT_DRAIN_READY;
break;
@@ -1238,10 +1241,8 @@
pcm_close(out->pcm);
out->pcm = NULL;
ret = -EIO;
- out->pcm_error_type = PCM_ERROR_EIO;
goto error_open;
}
- out->pcm_error_type = PCM_ERROR_NONE;
} else {
out->pcm = NULL;
out->compr = compress_open(adev->snd_card,
@@ -1401,7 +1402,7 @@
out->pcm = NULL;
}
} else {
- ALOGD("copl(%x):standby", (unsigned int)out);
+ ALOGD("copl(%p):standby", out);
stop_compressed_output_l(out);
out->gapless_mdata.encoder_delay = 0;
out->gapless_mdata.encoder_padding = 0;
@@ -1679,12 +1680,6 @@
ALOGD(" %s: sound card is not active/SSR state", __func__);
ret= -ENETRESET;
goto exit;
- } else if (PCM_ERROR_ENETRESET == out->pcm_error_type) {
- ALOGD(" %s restarting pcm session on post SSR", __func__);
- out->standby = false;
- pthread_mutex_unlock(&out->lock);
- out_standby(&out->stream.common);
- pthread_mutex_lock(&out->lock);
}
}
@@ -1704,9 +1699,9 @@
}
if (is_offload_usecase(out->usecase)) {
- ALOGD("copl(%x): writing buffer (%d bytes) to compress device", (unsigned int)out, bytes);
+ ALOGD("copl(%p): writing buffer (%d bytes) to compress device", out, bytes);
if (out->send_new_metadata) {
- ALOGD("copl(%x):send new gapless metadata", (unsigned int)out);
+ ALOGD("copl(%p):send new gapless metadata", out);
compress_set_gapless_metadata(out->compr, &out->gapless_mdata);
out->send_new_metadata = 0;
}
@@ -1736,12 +1731,11 @@
}
exit:
-
+ /* ToDo: There may be a corner case when SSR happens back to back during
+ start/stop. Need to post different error to handle that. */
if (-ENETRESET == ret) {
pthread_mutex_lock(&adev->snd_card_status.lock);
adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
- out->pcm_error_type = PCM_ERROR_ENETRESET;
- out->standby = true; /*standby will be called on post SSR */
pthread_mutex_unlock(&adev->snd_card_status.lock);
}
@@ -1857,7 +1851,7 @@
int status = -ENOSYS;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
- ALOGD("copl(%x):pause compress driver", (unsigned int)out);
+ ALOGD("copl(%p):pause compress driver", out);
pthread_mutex_lock(&out->lock);
if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PLAYING) {
status = compress_pause(out->compr);
@@ -1874,7 +1868,7 @@
int status = -ENOSYS;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
- ALOGD("copl(%x):resume compress driver", (unsigned int)out);
+ ALOGD("copl(%p):resume compress driver", out);
status = 0;
pthread_mutex_lock(&out->lock);
if (out->compr != NULL && out->offload_state == OFFLOAD_STATE_PAUSED) {
@@ -1907,11 +1901,11 @@
struct stream_out *out = (struct stream_out *)stream;
ALOGV("%s", __func__);
if (is_offload_usecase(out->usecase)) {
- ALOGD("copl(%x):calling compress flush", (unsigned int)out);
+ ALOGD("copl(%p):calling compress flush", out);
pthread_mutex_lock(&out->lock);
stop_compressed_output_l(out);
pthread_mutex_unlock(&out->lock);
- ALOGD("copl(%x):out of compress flush", (unsigned int)out);
+ ALOGD("copl(%p):out of compress flush", out);
return 0;
}
return -ENOSYS;
@@ -2097,12 +2091,6 @@
ALOGD(" %s: sound card is not active/SSR state", __func__);
ret= -ENETRESET;
goto exit;
- } else if (PCM_ERROR_ENETRESET == in->pcm_error_type) {
- ALOGD(" %s restarting pcm session on post SSR", __func__);
- in->standby = false;
- pthread_mutex_unlock(&in->lock);
- in_standby(&in->stream.common);
- pthread_mutex_lock(&in->lock);
}
}
@@ -2136,13 +2124,12 @@
memset(buffer, 0, bytes);
exit:
-
+ /* ToDo: There may be a corner case when SSR happens back to back during
+ start/stop. Need to post different error to handle that. */
if (-ENETRESET == ret) {
pthread_mutex_lock(&adev->snd_card_status.lock);
adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
- in->pcm_error_type = PCM_ERROR_ENETRESET;
memset(buffer, 0, bytes);
- in->standby = true; /*standby will be called on post SSR */
pthread_mutex_unlock(&adev->snd_card_status.lock);
}
pthread_mutex_unlock(&in->lock);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 7d8d924..1b2606c 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -140,12 +140,6 @@
OFFLOAD_STATE_PAUSED,
};
-enum {
- PCM_ERROR_NONE,
- PCM_ERROR_EIO,
- PCM_ERROR_ENETRESET, /* For SSR */
-};
-
struct offload_cmd {
struct listnode node;
int cmd;
@@ -193,7 +187,6 @@
void *offload_cookie;
struct compr_gapless_mdata gapless_mdata;
int send_new_metadata;
- int pcm_error_type;
struct audio_device *dev;
};
@@ -212,7 +205,6 @@
bool enable_aec;
bool enable_ns;
audio_format_t format;
- int pcm_error_type;
struct audio_device *dev;
};
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index 8f11acd..81e7c43 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -70,6 +70,9 @@
/* EDID format ID for LPCM audio */
#define EDID_FORMAT_LPCM 1
+/* fallback app type if the default app type from acdb loader fails */
+#define DEFAULT_APP_TYPE 0x11130
+
/* Retry for delay in FW loading*/
#define RETRY_NUMBER 20
#define RETRY_US 500000
@@ -97,9 +100,10 @@
/* Audio calibration related functions */
typedef void (*acdb_deallocate_t)();
typedef int (*acdb_init_t)(char *);
-typedef void (*acdb_send_audio_cal_t)(int, int);
+typedef void (*acdb_send_audio_cal_t)(int, int, int, int);
typedef void (*acdb_send_voice_cal_t)(int, int);
typedef int (*acdb_reload_vocvoltable_t)(int);
+typedef int (*acdb_get_default_app_type_t)(void);
struct platform_data {
struct audio_device *adev;
@@ -119,6 +123,7 @@
acdb_send_audio_cal_t acdb_send_audio_cal;
acdb_send_voice_cal_t acdb_send_voice_cal;
acdb_reload_vocvoltable_t acdb_reload_vocvoltable;
+ acdb_get_default_app_type_t acdb_get_default_app_type;
void *hw_info;
struct csd_data *csd;
@@ -412,7 +417,7 @@
sizeof("msm8x16-skui-snd-card"))) {
strlcpy(mixer_xml_path, MIXER_XML_PATH_QRD_SKUI,
sizeof(MIXER_XML_PATH_QRD_SKUI));
- } if (!strncmp(snd_card_name, "msm8939-snd-card-mtp",
+ } else if (!strncmp(snd_card_name, "msm8939-snd-card-mtp",
sizeof("msm8939-snd-card-mtp"))) {
strlcpy(mixer_xml_path, MIXER_XML_PATH,
sizeof(MIXER_XML_PATH));
@@ -684,7 +689,7 @@
__func__, LIB_ACDB_LOADER);
my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
- "acdb_loader_send_audio_cal");
+ "acdb_loader_send_audio_cal_v2");
if (!my_data->acdb_send_audio_cal)
ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s",
__func__, LIB_ACDB_LOADER);
@@ -701,6 +706,13 @@
ALOGE("%s: Could not find the symbol acdb_loader_reload_vocvoltable from %s",
__func__, LIB_ACDB_LOADER);
+ my_data->acdb_get_default_app_type = (acdb_get_default_app_type_t)dlsym(
+ my_data->acdb_handle,
+ "acdb_loader_get_default_app_type");
+ if (!my_data->acdb_get_default_app_type)
+ ALOGE("%s: Could not find the symbol acdb_get_default_app_type from %s",
+ __func__, LIB_ACDB_LOADER);
+
my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
"acdb_loader_init_v2");
if (my_data->acdb_init == NULL)
@@ -898,6 +910,16 @@
return ret;
}
+int platform_get_default_app_type(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+
+ if (my_data->acdb_get_default_app_type)
+ return my_data->acdb_get_default_app_type();
+ else
+ return DEFAULT_APP_TYPE;
+}
+
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
@@ -907,7 +929,8 @@
return acdb_device_table[snd_device];
}
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate)
{
struct platform_data *my_data = (struct platform_data *)platform;
int acdb_dev_id, acdb_dev_type;
@@ -919,14 +942,15 @@
return -EINVAL;
}
if (my_data->acdb_send_audio_cal) {
- ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
+ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
__func__, snd_device, acdb_dev_id);
if (snd_device >= SND_DEVICE_OUT_BEGIN &&
snd_device < SND_DEVICE_OUT_END)
acdb_dev_type = ACDB_DEV_TYPE_OUT;
else
acdb_dev_type = ACDB_DEV_TYPE_IN;
- my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
+ my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
+ sample_rate);
}
return 0;
}
@@ -1322,7 +1346,7 @@
ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
__func__, out_device, in_device);
if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
- voice_extn_compress_voip_is_active(adev))) {
+ voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
if ((adev->voice.tty_mode != TTY_MODE_OFF) &&
!voice_extn_compress_voip_is_active(adev)) {
if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
@@ -1384,7 +1408,11 @@
} else if (source == AUDIO_SOURCE_CAMCORDER) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
in_device & AUDIO_DEVICE_IN_BACK_MIC) {
- snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
+ if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
+ channel_count == 2)
+ snd_device = SND_DEVICE_IN_SPEAKER_DMIC;
+ else
+ snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
}
} else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
@@ -1884,7 +1912,7 @@
if (info != NULL && info->has_video && info->is_streaming) {
fragment_size = COMPRESS_OFFLOAD_FRAGMENT_SIZE_FOR_AV_STREAMING;
ALOGV("%s: offload fragment size reduced for AV streaming to %d",
- __func__, out->compr_config.fragment_size);
+ __func__, fragment_size);
}
fragment_size = ALIGN( fragment_size, 1024);
diff --git a/hal/msm8974/hw_info.c b/hal/msm8974/hw_info.c
index 85a9771..845c3f8 100644
--- a/hal/msm8974/hw_info.c
+++ b/hal/msm8974/hw_info.c
@@ -206,19 +206,19 @@
hw_info->snd_devices = NULL;
hw_info->num_snd_devices = 0;
strlcpy(hw_info->dev_extn, "", sizeof(hw_info->dev_extn));
- } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card ")) {
+ } else if (!strcmp(snd_card_name, "msm8994-tomtom-cdp-snd-card")) {
strlcpy(hw_info->type, " cdp", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)tomtom_msm8994_CDP_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(tomtom_msm8994_CDP_variant_devices);
strlcpy(hw_info->dev_extn, "-cdp", sizeof(hw_info->dev_extn));
- } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card ")) {
+ } else if (!strcmp(snd_card_name, "msm8994-tomtom-stp-snd-card")) {
strlcpy(hw_info->type, " stp", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)tomtom_stp_variant_devices;
hw_info->num_snd_devices = ARRAY_SIZE(tomtom_stp_variant_devices);
strlcpy(hw_info->dev_extn, "-stp", sizeof(hw_info->dev_extn));
- } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card ")) {
+ } else if (!strcmp(snd_card_name, "msm8994-tomtom-liquid-snd-card")) {
strlcpy(hw_info->type, " liquid", sizeof(hw_info->type));
strlcpy(hw_info->name, "msm8994", sizeof(hw_info->name));
hw_info->snd_devices = (snd_device_t *)tomtom_liquid_variant_devices;
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index dae686e..ac747e4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -74,6 +74,9 @@
/* EDID format ID for LPCM audio */
#define EDID_FORMAT_LPCM 1
+/* fallback app type if the default app type from acdb loader fails */
+#define DEFAULT_APP_TYPE 0x11130
+
/* Retry for delay in FW loading*/
#define RETRY_NUMBER 10
#define RETRY_US 500000
@@ -101,9 +104,10 @@
/* Audio calibration related functions */
typedef void (*acdb_deallocate_t)();
typedef int (*acdb_init_t)(char *);
-typedef void (*acdb_send_audio_cal_t)(int, int);
+typedef void (*acdb_send_audio_cal_t)(int, int, int , int);
typedef void (*acdb_send_voice_cal_t)(int, int);
typedef int (*acdb_reload_vocvoltable_t)(int);
+typedef int (*acdb_get_default_app_type_t)(void);
struct platform_data {
struct audio_device *adev;
@@ -125,6 +129,7 @@
acdb_send_audio_cal_t acdb_send_audio_cal;
acdb_send_voice_cal_t acdb_send_voice_cal;
acdb_reload_vocvoltable_t acdb_reload_vocvoltable;
+ acdb_get_default_app_type_t acdb_get_default_app_type;
void *hw_info;
struct csd_data *csd;
@@ -743,7 +748,7 @@
__func__, LIB_ACDB_LOADER);
my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
- "acdb_loader_send_audio_cal");
+ "acdb_loader_send_audio_cal_v2");
if (!my_data->acdb_send_audio_cal)
ALOGE("%s: Could not find the symbol acdb_send_audio_cal from %s",
__func__, LIB_ACDB_LOADER);
@@ -760,6 +765,13 @@
ALOGE("%s: Could not find the symbol acdb_loader_reload_vocvoltable from %s",
__func__, LIB_ACDB_LOADER);
+ my_data->acdb_get_default_app_type = (acdb_get_default_app_type_t)dlsym(
+ my_data->acdb_handle,
+ "acdb_loader_get_default_app_type");
+ if (!my_data->acdb_get_default_app_type)
+ ALOGE("%s: Could not find the symbol acdb_get_default_app_type from %s",
+ __func__, LIB_ACDB_LOADER);
+
my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
"acdb_loader_init_v2");
if (my_data->acdb_init == NULL)
@@ -970,6 +982,16 @@
return ret;
}
+int platform_get_default_app_type(void *platform)
+{
+ struct platform_data *my_data = (struct platform_data *)platform;
+
+ if (my_data->acdb_get_default_app_type)
+ return my_data->acdb_get_default_app_type();
+ else
+ return DEFAULT_APP_TYPE;
+}
+
int platform_get_snd_device_acdb_id(snd_device_t snd_device)
{
if ((snd_device < SND_DEVICE_MIN) || (snd_device >= SND_DEVICE_MAX)) {
@@ -979,7 +1001,8 @@
return acdb_device_table[snd_device];
}
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate)
{
struct platform_data *my_data = (struct platform_data *)platform;
int acdb_dev_id, acdb_dev_type;
@@ -991,14 +1014,15 @@
return -EINVAL;
}
if (my_data->acdb_send_audio_cal) {
- ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
+ ALOGV("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
__func__, snd_device, acdb_dev_id);
if (snd_device >= SND_DEVICE_OUT_BEGIN &&
snd_device < SND_DEVICE_OUT_END)
acdb_dev_type = ACDB_DEV_TYPE_OUT;
else
acdb_dev_type = ACDB_DEV_TYPE_IN;
- my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
+ my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type, app_type,
+ sample_rate);
}
return 0;
}
@@ -1419,7 +1443,7 @@
ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
__func__, out_device, in_device);
if ((out_device != AUDIO_DEVICE_NONE) && ((mode == AUDIO_MODE_IN_CALL) ||
- voice_extn_compress_voip_is_active(adev))) {
+ voice_extn_compress_voip_is_active(adev) || audio_extn_hfp_is_active(adev))) {
if ((adev->voice.tty_mode != TTY_MODE_OFF) &&
!voice_extn_compress_voip_is_active(adev)) {
if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h
index ff2ae9a..d7d1944 100644
--- a/hal/msm8974/platform.h
+++ b/hal/msm8974/platform.h
@@ -254,7 +254,7 @@
#define VOICE2_CALL_PCM_DEVICE 22
#define VOLTE_CALL_PCM_DEVICE 14
#define QCHAT_CALL_PCM_DEVICE 20
-#define VOWLAN_CALL_PCM_DEVICE -1
+#define VOWLAN_CALL_PCM_DEVICE 36
#endif
#ifdef PLATFORM_MSM8x26
diff --git a/hal/platform_api.h b/hal/platform_api.h
index 15deea5..1e97adf 100644
--- a/hal/platform_api.h
+++ b/hal/platform_api.h
@@ -32,7 +32,9 @@
int platform_get_fluence_type(void *platform, char *value, uint32_t len);
int platform_set_snd_device_acdb_id(snd_device_t snd_device, unsigned int acdb_id);
int platform_get_snd_device_acdb_id(snd_device_t snd_device);
-int platform_send_audio_calibration(void *platform, snd_device_t snd_device);
+int platform_send_audio_calibration(void *platform, snd_device_t snd_device,
+ int app_type, int sample_rate);
+int platform_get_default_app_type(void *platform);
int platform_switch_voice_call_device_pre(void *platform);
int platform_switch_voice_call_enable_device_config(void *platform,
snd_device_t out_snd_device,
diff --git a/hal/voice.c b/hal/voice.c
index bad9255..449c0c2 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -67,6 +67,8 @@
session = (struct voice_session *)voice_get_session_from_use_case(adev, usecase_id);
session->state.current = CALL_INACTIVE;
+ if (adev->mode == AUDIO_MODE_NORMAL)
+ adev->voice.is_in_call = false;
ret = platform_stop_voice_call(adev->platform, session->vsid);
diff --git a/hal/voice.h b/hal/voice.h
index 0098f94..4df2d6a 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -61,6 +61,7 @@
bool mic_mute;
float volume;
bool voice_device_set;
+ bool is_in_call;
};
enum {
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index d42cc53..ea25a4b 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -40,6 +40,7 @@
#define AUDIO_PARAMETER_KEY_ALL_CALL_STATES "all_call_states"
#define AUDIO_PARAMETER_KEY_DEVICE_MUTE "device_mute"
#define AUDIO_PARAMETER_KEY_DIRECTION "direction"
+#define AUDIO_PARAMETER_KEY_IN_CALL "in_call"
#define VOICE_EXTN_PARAMETER_VALUE_MAX_LEN 256
@@ -505,6 +506,15 @@
}
}
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_IN_CALL, str_value,
+ sizeof(str_value));
+ if (err >= 0) {
+ str_parms_del(parms, AUDIO_PARAMETER_KEY_IN_CALL);
+ if (!strncmp("true", str_value, sizeof("true"))) {
+ adev->voice.is_in_call = true;
+ }
+ }
+
done:
ALOGV("%s: exit with code(%d)", __func__, ret);
free(kv_pairs);
@@ -536,10 +546,19 @@
int ret;
char value[VOICE_EXTN_PARAMETER_VALUE_MAX_LEN] = {0};
char *str = str_parms_to_str(query);
+ int val = 0;
ALOGV_IF(str != NULL, "%s: enter %s", __func__, str);
free(str);
+ ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_IN_CALL, value,
+ sizeof(value));
+ if (ret >=0) {
+ if (adev->voice.is_in_call)
+ val = 1;
+ str_parms_add_int(reply, AUDIO_PARAMETER_KEY_IN_CALL, val);
+ }
+
ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_AUDIO_MODE, value,
sizeof(value));
if (ret >= 0) {
diff --git a/mm-audio/Android.mk b/mm-audio/Android.mk
index 5053e7d..3885afc 100644
--- a/mm-audio/Android.mk
+++ b/mm-audio/Android.mk
@@ -1 +1,3 @@
+ifeq ($(strip $(TARGET_USES_QCOM_MM_AUDIO)),true)
include $(call all-subdir-makefiles)
+endif
diff --git a/policy_hal/Android.mk b/policy_hal/Android.mk
index 480df92..7d365d6 100644
--- a/policy_hal/Android.mk
+++ b/policy_hal/Android.mk
@@ -1,4 +1,4 @@
-ifneq ($(strip $(BOARD_USES_AOSP_AUDIO_POLICY_MANAGER)),true)
+ifeq ($(strip $(BOARD_USES_EXTN_AUDIO_POLICY_MANAGER)),true)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -17,19 +17,19 @@
libaudiopolicy_legacy
LOCAL_MODULE := audio_policy.$(TARGET_BOARD_PLATFORM)
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
+LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_FM)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_FM)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_FM_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_PROXY_DEVICE)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_AFE_PROXY_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_INCALL_MUSIC)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_INCALL_MUSIC)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_INCALL_MUSIC_ENABLED
endif
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_HDMI_SPK)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HDMI_SPK)),true)
LOCAL_CFLAGS += -DAUDIO_EXTN_HDMI_SPK_ENABLED
endif
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index a8cbcda..2309730 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -45,6 +45,7 @@
// AudioPolicyInterface implementation
// ----------------------------------------------------------------------------
const char* AudioPolicyManager::HDMI_SPKR_STR = "hdmi_spkr";
+int AudioPolicyManager::mvoice_call_state = 0;
status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device,
AudioSystem::device_connection_state state,
@@ -429,7 +430,7 @@
prop_voip_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
}
- if (prop_rec_enabled) {
+ if (prop_rec_enabled && mvoice_call_state) {
//check if voice call is active / running in background
//some of VoIP apps(like SIP2SIP call) supports resume of VoIP call when call in progress
//Need to block input request
@@ -444,20 +445,19 @@
ALOGD("Creating input during incall mode for inputSource: %d ",inputSource);
break;
- case AUDIO_SOURCE_VOICE_COMMUNICATION:
+ case AUDIO_SOURCE_VOICE_COMMUNICATION:
if(prop_voip_enabled) {
- ALOGD("BLOCKING VoIP request during incall mode for inputSource: %d ",inputSource);
- return 0;
+ ALOGD("BLOCKING VoIP request during incall mode for inputSource: %d ",inputSource);
+ return 0;
}
break;
-
- default:
- ALOGD("BLOCKING input during incall mode for inputSource: %d ",inputSource);
- return 0;
+ default:
+ ALOGD("BLOCKING input during incall mode for inputSource: %d ",inputSource);
+ return 0;
}
}
}//check for VoIP flag
- else if(prop_voip_enabled) {
+ else if(prop_voip_enabled && mvoice_call_state) {
//check if voice call is active / running in background
//some of VoIP apps(like SIP2SIP call) supports resume of VoIP call when call in progress
//Need to block input request
@@ -1030,7 +1030,7 @@
prop_voip_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
}
- if (prop_play_enabled) {
+ if (prop_play_enabled && mvoice_call_state) {
//check if voice call is active / running in background
if((AudioSystem::MODE_IN_CALL == mPhoneState) ||
((AudioSystem::MODE_IN_CALL == mPrevPhoneState)
@@ -1048,7 +1048,7 @@
flags = (AudioSystem::output_flags)AUDIO_OUTPUT_FLAG_FAST;
}
}
- } else if (prop_voip_enabled) {
+ } else if (prop_voip_enabled && mvoice_call_state) {
//check if voice call is active / running in background
//some of VoIP apps(like SIP2SIP call) supports resume of VoIP call when call in progress
//return only ULL ouput
@@ -1401,6 +1401,7 @@
int oldState = mPhoneState;
mPhoneState = state;
bool force = false;
+ int voice_call_state = 0;
// are we entering or starting a call
if (!isStateInCall(oldState) && isStateInCall(state)) {
@@ -1457,10 +1458,19 @@
prop_voip_enabled = atoi(propValue) || !strncmp("true", propValue, 4);
}
- if((AudioSystem::MODE_IN_CALL != oldState) && (AudioSystem::MODE_IN_CALL == state)) {
- ALOGD("Entering to call mode oldState :: %d state::%d ",oldState, state);
+ bool mode_in_call = (AudioSystem::MODE_IN_CALL != oldState) && (AudioSystem::MODE_IN_CALL == state);
+ //query if it is a actual voice call initiated by telephony
+ if (mode_in_call) {
+ String8 valueStr = mpClientInterface->getParameters((audio_io_handle_t)0, String8("in_call"));
+ AudioParameter result = AudioParameter(valueStr);
+ if (result.getInt(String8("in_call"), voice_call_state) == NO_ERROR)
+ ALOGD("SetPhoneState: Voice call state = %d", voice_call_state);
+ }
- if(prop_playback_enabled) {
+ if (mode_in_call && voice_call_state) {
+ ALOGD("Entering to call mode oldState :: %d state::%d ",oldState, state);
+ mvoice_call_state = voice_call_state;
+ if (prop_playback_enabled) {
//Call invalidate to reset all opened non ULL audio tracks
// Move tracks associated to this strategy from previous output to new output
for (int i = AudioSystem::SYSTEM; i < (int)AudioSystem::NUM_STREAM_TYPES; i++) {
@@ -1471,7 +1481,7 @@
}
}
- if(prop_rec_enabled) {
+ if (prop_rec_enabled) {
//Close all active inputs
audio_io_handle_t activeInput = getActiveInput();
if (activeInput != 0) {
@@ -1498,11 +1508,11 @@
break;
}
}
- } else if(prop_voip_enabled) {
+ } else if (prop_voip_enabled) {
audio_io_handle_t activeInput = getActiveInput();
if (activeInput != 0) {
AudioInputDescriptor *activeDesc = mInputs.valueFor(activeInput);
- if(AUDIO_SOURCE_VOICE_COMMUNICATION == activeDesc->mInputSource) {
+ if (AUDIO_SOURCE_VOICE_COMMUNICATION == activeDesc->mInputSource) {
ALOGD("CLOSING VoIP on call setup : %d",activeDesc->mInputSource);
stopInput(activeInput);
releaseInput(activeInput);
@@ -1519,25 +1529,26 @@
}
if (((!outputDesc->isDuplicated() &&outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY))
&& prop_playback_enabled) {
- ALOGD(" calling suspendOutput on call mdoe for primary output");
+ ALOGD(" calling suspendOutput on call mode for primary output");
mpClientInterface->suspendOutput(mOutputs.keyAt(i));
} //Close compress all sessions
else if ((outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
&& prop_playback_enabled) {
- ALOGD(" calling closeOutput on call mdoe for COMPRESS output");
+ ALOGD(" calling closeOutput on call mode for COMPRESS output");
closeOutput(mOutputs.keyAt(i));
}
else if ((outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_VOIP_RX)
&& prop_voip_enabled) {
- ALOGD(" calling closeOutput on call mdoe for DIRECT output");
+ ALOGD(" calling closeOutput on call mode for DIRECT output");
closeOutput(mOutputs.keyAt(i));
}
}
}
- if((AudioSystem::MODE_IN_CALL == oldState) && (AudioSystem::MODE_IN_CALL != state)
- && prop_playback_enabled) {
+ if ((AudioSystem::MODE_IN_CALL == oldState) && (AudioSystem::MODE_IN_CALL != state)
+ && prop_playback_enabled && mvoice_call_state) {
ALOGD("EXITING from call mode oldState :: %d state::%d \n",oldState, state);
+ mvoice_call_state = 0;
//restore PCM (deep-buffer) output after call termination
for (size_t i = 0; i < mOutputs.size(); i++) {
AudioOutputDescriptor *outputDesc = mOutputs.valueAt(i);
diff --git a/policy_hal/AudioPolicyManager.h b/policy_hal/AudioPolicyManager.h
index ab57768..9f2b473 100644
--- a/policy_hal/AudioPolicyManager.h
+++ b/policy_hal/AudioPolicyManager.h
@@ -105,6 +105,7 @@
private:
// Used for voip + voice concurrency usecase
int mPrevPhoneState;
+ static int mvoice_call_state;
};
};
diff --git a/post_proc/Android.mk b/post_proc/Android.mk
index c50b7d0..6ed1416 100644
--- a/post_proc/Android.mk
+++ b/post_proc/Android.mk
@@ -3,7 +3,7 @@
include $(CLEAR_VARS)
-ifneq ($(strip $(AUDIO_FEATURE_DISABLED_PROXY_DEVICE)),true)
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PROXY_DEVICE)),true)
LOCAL_CFLAGS += -DAFE_PROXY_ENABLED
endif
@@ -24,7 +24,7 @@
LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
+LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libqcompostprocbundle
LOCAL_C_INCLUDES := \
diff --git a/visualizer/Android.mk b/visualizer/Android.mk
index 3c92044..393eec3 100644
--- a/visualizer/Android.mk
+++ b/visualizer/Android.mk
@@ -26,7 +26,7 @@
liblog \
libtinyalsa
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
+LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_MODULE:= libqcomvisualizer
LOCAL_C_INCLUDES := \
diff --git a/voice_processing/Android.mk b/voice_processing/Android.mk
index b64c0e3..9b86eaf 100644
--- a/voice_processing/Android.mk
+++ b/voice_processing/Android.mk
@@ -5,7 +5,7 @@
LOCAL_MODULE:= libqcomvoiceprocessing
LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/soundfx
+LOCAL_MODULE_RELATIVE_PATH := soundfx
LOCAL_SRC_FILES:= \
voice_processing.c