Merge "hal: Fix 64 bit compilation errors"
diff --git a/hal/Android.mk b/hal/Android.mk
index 6239c01..c8acf5e 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
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 ac8896e..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
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_hw.c b/hal/audio_hw.c
index c394888..5793cce 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -842,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;
@@ -1243,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,
@@ -1684,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);
}
}
@@ -1741,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);
}
@@ -2102,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);
}
}
@@ -2141,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 e4ac5ac..81e7c43 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -417,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));
@@ -1346,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 ||
@@ -1408,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) {
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 82bafe5..ac747e4 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -1443,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/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..4e9ed01 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)
@@ -20,16 +20,16 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/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..97002fa 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