Loading hal/Android.mk +5 −1 Original line number Diff line number Diff line Loading @@ -80,9 +80,13 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true) ifneq ($(strip $(AUDIO_FEATURE_ENABLED_INCALL_MUSIC)),false) LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED endif ifeq ($(strip $(AUDIO_FEATURE_HTC_DUAL_SIM)),true) LOCAL_CFLAGS += -DHTC_DUAL_SIM LOCAL_SRC_FILES += voice_extn/msim_voice_extn.c endif ifeq ($(strip $(AUDIO_FEATURE_SAMSUNG_DUAL_SIM)),true) LOCAL_CFLAGS += -DSAMSUNG_DUAL_SIM LOCAL_SRC_FILES += voice_extn/sec_voice_extn.c LOCAL_SRC_FILES += voice_extn/msim_voice_extn.c endif endif Loading hal/voice.c +7 −7 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ #include "audio_hw.h" #include "voice.h" #include "voice_extn/voice_extn.h" #include "voice_extn/sec_voice_extn.h" #include "voice_extn/msim_voice_extn.h" #include "platform.h" #include "platform_api.h" #include "audio_extn.h" Loading @@ -50,7 +50,7 @@ static struct voice_session *voice_get_session_from_use_case(struct audio_device struct voice_session *session = NULL; int ret = 0; ret = sec_voice_extn_get_session_from_use_case(adev, usecase_id, &session); ret = msim_voice_extn_get_session_from_use_case(adev, usecase_id, &session); if (ret == 0) { return session; } Loading Loading @@ -203,7 +203,7 @@ bool voice_is_call_state_active(struct audio_device *adev) bool call_state = false; int ret = 0; ret = sec_voice_extn_is_call_state_active(adev, &call_state); ret = msim_voice_extn_is_call_state_active(adev, &call_state); if (ret == 0) { return call_state; } Loading Loading @@ -234,7 +234,7 @@ uint32_t voice_get_active_session_id(struct audio_device *adev) int ret = 0; uint32_t session_id; ret = sec_voice_extn_get_active_session_id(adev, &session_id); ret = msim_voice_extn_get_active_session_id(adev, &session_id); if (ret == 0) { return session_id; } Loading Loading @@ -388,7 +388,7 @@ int voice_start_call(struct audio_device *adev) { int ret = 0; ret = sec_voice_extn_start_call(adev); ret = msim_voice_extn_start_call(adev); if (ret != -ENOSYS) { adev->voice.in_call = true; return ret; Loading @@ -407,7 +407,7 @@ int voice_stop_call(struct audio_device *adev) int ret = 0; adev->voice.in_call = false; ret = sec_voice_extn_stop_call(adev); ret = msim_voice_extn_stop_call(adev); if (ret != -ENOSYS) { return 0; } Loading Loading @@ -436,7 +436,7 @@ int voice_set_parameters(struct audio_device *adev, struct str_parms *parms) ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs); ret = sec_voice_extn_set_parameters(adev, parms); ret = msim_voice_extn_set_parameters(adev, parms); if (ret != 0 && ret != -ENOSYS) goto done; Loading hal/voice_extn/sec_voice_extn.c→hal/voice_extn/msim_voice_extn.c +36 −17 Original line number Diff line number Diff line Loading @@ -14,9 +14,9 @@ * limitations under the License. */ #define LOG_TAG "sec_voice_extn" #define LOG_TAG "msim_voice_extn" /*#define LOG_NDEBUG 0*/ /*#define LOG_NDDEBUG 0*/ #define LOG_NDDEBUG 0 #include <errno.h> #include <cutils/log.h> Loading @@ -26,15 +26,20 @@ #include "voice.h" #include "platform.h" #include "platform_api.h" #include "sec_voice_extn.h" #include "msim_voice_extn.h" #define AUDIO_PARAMETER_KEY_PHONETYPE "phone_type" #define AUDIO_PARAMETER_VALUE_CP1 "cp1" #define AUDIO_PARAMETER_VALUE_CP2 "cp2" #ifdef HTC_DUAL_SIM #define RADIO_PREFER_NETWORK_SLOT0 "persist.radio.prefer.network" #define RADIO_PREFER_NETWORK_SLOT1 "persist.radio.prefer.nw.sub" #elif SAMSUNG_DUAL_SIM #define AUDIO_PROPERTY_SEC_VSID1 "gsm.current.vsid" #define AUDIO_PROPERTY_SEC_VSID2 "gsm.current.vsid2" #endif #define VOICE2_VSID 0x10DC1000 Loading @@ -43,66 +48,80 @@ extern int start_call(struct audio_device *adev, audio_usecase_t usecase_id); extern int stop_call(struct audio_device *adev, audio_usecase_t usecase_id); static int sec_phone_type = 1; static int msim_phone_type = 1; int sec_voice_extn_start_call(struct audio_device *adev) int msim_voice_extn_start_call(struct audio_device *adev) { audio_usecase_t usecase_id; usecase_id = sec_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; usecase_id = msim_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; return start_call(adev, usecase_id); } int sec_voice_extn_stop_call(struct audio_device *adev) int msim_voice_extn_stop_call(struct audio_device *adev) { audio_usecase_t usecase_id; usecase_id = sec_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; usecase_id = msim_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; return stop_call(adev, usecase_id); } int sec_voice_extn_get_session_from_use_case(struct audio_device *adev, int msim_voice_extn_get_session_from_use_case(struct audio_device *adev, const audio_usecase_t usecase_id __unused, struct voice_session **session) { int idx; idx = sec_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; idx = msim_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; *session = &adev->voice.session[idx]; return 0; } int sec_voice_extn_set_parameters(struct audio_device *adev __unused, int msim_voice_extn_set_parameters(struct audio_device *adev __unused, struct str_parms *parms) { int ret; int voice_slot = 0; char value[32] = {0}; ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_PHONETYPE, value, sizeof(value)); if (ret >= 0) { sec_phone_type = property_get_int32( #ifdef HTC_DUAL_SIM voice_slot = property_get_int32(RADIO_PREFER_NETWORK_SLOT0) != 1 ? 0 : 1; if (property_get_int32(RADIO_PREFER_NETWORK_SLOT0) == property_get_int32(RADIO_PREFER_NETWORK_SLOT1)) { voice_slot = 0; } if (strcmp(value, AUDIO_PARAMETER_VALUE_CP2)) { msim_phone_type = voice_slot == 0 ? 1 : 0; } else { msim_phone_type = voice_slot == 0 ? 0 : 1; } #elif SAMSUNG_DUAL_SIM msim_phone_type = property_get_int32( strcmp(value, AUDIO_PARAMETER_VALUE_CP2) ? AUDIO_PROPERTY_SEC_VSID1 : AUDIO_PROPERTY_SEC_VSID2) + 1; ALOGV("%s: phone_type: %d", __func__, sec_phone_type); #endif ALOGV("%s: phone_type: %d", __func__, msim_phone_type); } return 0; } int sec_voice_extn_is_call_state_active(struct audio_device *adev, int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active) { int idx; idx = sec_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; idx = msim_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; *is_call_active = (adev->voice.session[idx].state.current == CALL_ACTIVE) ? true : false; return 0; } int sec_voice_extn_get_active_session_id(struct audio_device *adev __unused, int msim_voice_extn_get_active_session_id(struct audio_device *adev __unused, uint32_t *session_id) { *session_id = sec_phone_type == 1 ? VOICE_VSID : VOICE2_VSID; *session_id = msim_phone_type == 1 ? VOICE_VSID : VOICE2_VSID; return 0; } hal/voice_extn/sec_voice_extn.h→hal/voice_extn/msim_voice_extn.h +16 −16 Original line number Diff line number Diff line Loading @@ -14,52 +14,52 @@ * limitations under the License. */ #ifndef SEC_VOICE_EXTN_H #define SEC_VOICE_EXTN_H #ifndef MSIM_VOICE_EXTN_H #define MSIM_VOICE_EXTN_H #ifdef SAMSUNG_DUAL_SIM int sec_voice_extn_start_call(struct audio_device *adev); int sec_voice_extn_stop_call(struct audio_device *adev); int sec_voice_extn_get_session_from_use_case(struct audio_device *adev, #if defined(HTC_DUAL_SIM) || defined(SAMSUNG_DUAL_SIM) int msim_voice_extn_start_call(struct audio_device *adev); int msim_voice_extn_stop_call(struct audio_device *adev); int msim_voice_extn_get_session_from_use_case(struct audio_device *adev, const audio_usecase_t usecase_id, struct voice_session **session); int sec_voice_extn_set_parameters(struct audio_device *adev, int msim_voice_extn_set_parameters(struct audio_device *adev, struct str_parms *parms); int sec_voice_extn_is_call_state_active(struct audio_device *adev, int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active); int sec_voice_extn_get_active_session_id(struct audio_device *adev, int msim_voice_extn_get_active_session_id(struct audio_device *adev, uint32_t *session_id); #else static int sec_voice_extn_start_call(struct audio_device *adev __unused) static int msim_voice_extn_start_call(struct audio_device *adev __unused) { return -ENOSYS; } static int sec_voice_extn_stop_call(struct audio_device *adev __unused) static int msim_voice_extn_stop_call(struct audio_device *adev __unused) { return -ENOSYS; } static int sec_voice_extn_get_session_from_use_case(struct audio_device *adev __unused, static int msim_voice_extn_get_session_from_use_case(struct audio_device *adev __unused, const audio_usecase_t usecase_id __unused, struct voice_session **session __unused) { return -ENOSYS; } static int sec_voice_extn_set_parameters(struct audio_device *adev __unused, static int msim_voice_extn_set_parameters(struct audio_device *adev __unused, struct str_parms *parms __unused) { return -ENOSYS; } static int sec_voice_extn_is_call_state_active(struct audio_device *adev, static int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active) { return -ENOSYS; } static int sec_voice_extn_get_active_session_id(struct audio_device *adev __unused, static int msim_voice_extn_get_active_session_id(struct audio_device *adev __unused, uint32_t *session_id __unused) { return -ENOSYS; Loading @@ -67,4 +67,4 @@ static int sec_voice_extn_get_active_session_id(struct audio_device *adev __unus #endif #endif /* SEC_VOICE_EXTN_H */ #endif /* MSIM_VOICE_EXTN_H */ Loading
hal/Android.mk +5 −1 Original line number Diff line number Diff line Loading @@ -80,9 +80,13 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_MULTI_VOICE_SESSIONS)),true) ifneq ($(strip $(AUDIO_FEATURE_ENABLED_INCALL_MUSIC)),false) LOCAL_CFLAGS += -DINCALL_MUSIC_ENABLED endif ifeq ($(strip $(AUDIO_FEATURE_HTC_DUAL_SIM)),true) LOCAL_CFLAGS += -DHTC_DUAL_SIM LOCAL_SRC_FILES += voice_extn/msim_voice_extn.c endif ifeq ($(strip $(AUDIO_FEATURE_SAMSUNG_DUAL_SIM)),true) LOCAL_CFLAGS += -DSAMSUNG_DUAL_SIM LOCAL_SRC_FILES += voice_extn/sec_voice_extn.c LOCAL_SRC_FILES += voice_extn/msim_voice_extn.c endif endif Loading
hal/voice.c +7 −7 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ #include "audio_hw.h" #include "voice.h" #include "voice_extn/voice_extn.h" #include "voice_extn/sec_voice_extn.h" #include "voice_extn/msim_voice_extn.h" #include "platform.h" #include "platform_api.h" #include "audio_extn.h" Loading @@ -50,7 +50,7 @@ static struct voice_session *voice_get_session_from_use_case(struct audio_device struct voice_session *session = NULL; int ret = 0; ret = sec_voice_extn_get_session_from_use_case(adev, usecase_id, &session); ret = msim_voice_extn_get_session_from_use_case(adev, usecase_id, &session); if (ret == 0) { return session; } Loading Loading @@ -203,7 +203,7 @@ bool voice_is_call_state_active(struct audio_device *adev) bool call_state = false; int ret = 0; ret = sec_voice_extn_is_call_state_active(adev, &call_state); ret = msim_voice_extn_is_call_state_active(adev, &call_state); if (ret == 0) { return call_state; } Loading Loading @@ -234,7 +234,7 @@ uint32_t voice_get_active_session_id(struct audio_device *adev) int ret = 0; uint32_t session_id; ret = sec_voice_extn_get_active_session_id(adev, &session_id); ret = msim_voice_extn_get_active_session_id(adev, &session_id); if (ret == 0) { return session_id; } Loading Loading @@ -388,7 +388,7 @@ int voice_start_call(struct audio_device *adev) { int ret = 0; ret = sec_voice_extn_start_call(adev); ret = msim_voice_extn_start_call(adev); if (ret != -ENOSYS) { adev->voice.in_call = true; return ret; Loading @@ -407,7 +407,7 @@ int voice_stop_call(struct audio_device *adev) int ret = 0; adev->voice.in_call = false; ret = sec_voice_extn_stop_call(adev); ret = msim_voice_extn_stop_call(adev); if (ret != -ENOSYS) { return 0; } Loading Loading @@ -436,7 +436,7 @@ int voice_set_parameters(struct audio_device *adev, struct str_parms *parms) ALOGV_IF(kv_pairs != NULL, "%s: enter: %s", __func__, kv_pairs); ret = sec_voice_extn_set_parameters(adev, parms); ret = msim_voice_extn_set_parameters(adev, parms); if (ret != 0 && ret != -ENOSYS) goto done; Loading
hal/voice_extn/sec_voice_extn.c→hal/voice_extn/msim_voice_extn.c +36 −17 Original line number Diff line number Diff line Loading @@ -14,9 +14,9 @@ * limitations under the License. */ #define LOG_TAG "sec_voice_extn" #define LOG_TAG "msim_voice_extn" /*#define LOG_NDEBUG 0*/ /*#define LOG_NDDEBUG 0*/ #define LOG_NDDEBUG 0 #include <errno.h> #include <cutils/log.h> Loading @@ -26,15 +26,20 @@ #include "voice.h" #include "platform.h" #include "platform_api.h" #include "sec_voice_extn.h" #include "msim_voice_extn.h" #define AUDIO_PARAMETER_KEY_PHONETYPE "phone_type" #define AUDIO_PARAMETER_VALUE_CP1 "cp1" #define AUDIO_PARAMETER_VALUE_CP2 "cp2" #ifdef HTC_DUAL_SIM #define RADIO_PREFER_NETWORK_SLOT0 "persist.radio.prefer.network" #define RADIO_PREFER_NETWORK_SLOT1 "persist.radio.prefer.nw.sub" #elif SAMSUNG_DUAL_SIM #define AUDIO_PROPERTY_SEC_VSID1 "gsm.current.vsid" #define AUDIO_PROPERTY_SEC_VSID2 "gsm.current.vsid2" #endif #define VOICE2_VSID 0x10DC1000 Loading @@ -43,66 +48,80 @@ extern int start_call(struct audio_device *adev, audio_usecase_t usecase_id); extern int stop_call(struct audio_device *adev, audio_usecase_t usecase_id); static int sec_phone_type = 1; static int msim_phone_type = 1; int sec_voice_extn_start_call(struct audio_device *adev) int msim_voice_extn_start_call(struct audio_device *adev) { audio_usecase_t usecase_id; usecase_id = sec_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; usecase_id = msim_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; return start_call(adev, usecase_id); } int sec_voice_extn_stop_call(struct audio_device *adev) int msim_voice_extn_stop_call(struct audio_device *adev) { audio_usecase_t usecase_id; usecase_id = sec_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; usecase_id = msim_phone_type == 1 ? USECASE_VOICE_CALL : USECASE_VOICE2_CALL; return stop_call(adev, usecase_id); } int sec_voice_extn_get_session_from_use_case(struct audio_device *adev, int msim_voice_extn_get_session_from_use_case(struct audio_device *adev, const audio_usecase_t usecase_id __unused, struct voice_session **session) { int idx; idx = sec_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; idx = msim_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; *session = &adev->voice.session[idx]; return 0; } int sec_voice_extn_set_parameters(struct audio_device *adev __unused, int msim_voice_extn_set_parameters(struct audio_device *adev __unused, struct str_parms *parms) { int ret; int voice_slot = 0; char value[32] = {0}; ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_PHONETYPE, value, sizeof(value)); if (ret >= 0) { sec_phone_type = property_get_int32( #ifdef HTC_DUAL_SIM voice_slot = property_get_int32(RADIO_PREFER_NETWORK_SLOT0) != 1 ? 0 : 1; if (property_get_int32(RADIO_PREFER_NETWORK_SLOT0) == property_get_int32(RADIO_PREFER_NETWORK_SLOT1)) { voice_slot = 0; } if (strcmp(value, AUDIO_PARAMETER_VALUE_CP2)) { msim_phone_type = voice_slot == 0 ? 1 : 0; } else { msim_phone_type = voice_slot == 0 ? 0 : 1; } #elif SAMSUNG_DUAL_SIM msim_phone_type = property_get_int32( strcmp(value, AUDIO_PARAMETER_VALUE_CP2) ? AUDIO_PROPERTY_SEC_VSID1 : AUDIO_PROPERTY_SEC_VSID2) + 1; ALOGV("%s: phone_type: %d", __func__, sec_phone_type); #endif ALOGV("%s: phone_type: %d", __func__, msim_phone_type); } return 0; } int sec_voice_extn_is_call_state_active(struct audio_device *adev, int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active) { int idx; idx = sec_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; idx = msim_phone_type == 1 ? VOICE_SESS_IDX : VOICE2_SESS_IDX; *is_call_active = (adev->voice.session[idx].state.current == CALL_ACTIVE) ? true : false; return 0; } int sec_voice_extn_get_active_session_id(struct audio_device *adev __unused, int msim_voice_extn_get_active_session_id(struct audio_device *adev __unused, uint32_t *session_id) { *session_id = sec_phone_type == 1 ? VOICE_VSID : VOICE2_VSID; *session_id = msim_phone_type == 1 ? VOICE_VSID : VOICE2_VSID; return 0; }
hal/voice_extn/sec_voice_extn.h→hal/voice_extn/msim_voice_extn.h +16 −16 Original line number Diff line number Diff line Loading @@ -14,52 +14,52 @@ * limitations under the License. */ #ifndef SEC_VOICE_EXTN_H #define SEC_VOICE_EXTN_H #ifndef MSIM_VOICE_EXTN_H #define MSIM_VOICE_EXTN_H #ifdef SAMSUNG_DUAL_SIM int sec_voice_extn_start_call(struct audio_device *adev); int sec_voice_extn_stop_call(struct audio_device *adev); int sec_voice_extn_get_session_from_use_case(struct audio_device *adev, #if defined(HTC_DUAL_SIM) || defined(SAMSUNG_DUAL_SIM) int msim_voice_extn_start_call(struct audio_device *adev); int msim_voice_extn_stop_call(struct audio_device *adev); int msim_voice_extn_get_session_from_use_case(struct audio_device *adev, const audio_usecase_t usecase_id, struct voice_session **session); int sec_voice_extn_set_parameters(struct audio_device *adev, int msim_voice_extn_set_parameters(struct audio_device *adev, struct str_parms *parms); int sec_voice_extn_is_call_state_active(struct audio_device *adev, int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active); int sec_voice_extn_get_active_session_id(struct audio_device *adev, int msim_voice_extn_get_active_session_id(struct audio_device *adev, uint32_t *session_id); #else static int sec_voice_extn_start_call(struct audio_device *adev __unused) static int msim_voice_extn_start_call(struct audio_device *adev __unused) { return -ENOSYS; } static int sec_voice_extn_stop_call(struct audio_device *adev __unused) static int msim_voice_extn_stop_call(struct audio_device *adev __unused) { return -ENOSYS; } static int sec_voice_extn_get_session_from_use_case(struct audio_device *adev __unused, static int msim_voice_extn_get_session_from_use_case(struct audio_device *adev __unused, const audio_usecase_t usecase_id __unused, struct voice_session **session __unused) { return -ENOSYS; } static int sec_voice_extn_set_parameters(struct audio_device *adev __unused, static int msim_voice_extn_set_parameters(struct audio_device *adev __unused, struct str_parms *parms __unused) { return -ENOSYS; } static int sec_voice_extn_is_call_state_active(struct audio_device *adev, static int msim_voice_extn_is_call_state_active(struct audio_device *adev, bool *is_call_active) { return -ENOSYS; } static int sec_voice_extn_get_active_session_id(struct audio_device *adev __unused, static int msim_voice_extn_get_active_session_id(struct audio_device *adev __unused, uint32_t *session_id __unused) { return -ENOSYS; Loading @@ -67,4 +67,4 @@ static int sec_voice_extn_get_active_session_id(struct audio_device *adev __unus #endif #endif /* SEC_VOICE_EXTN_H */ #endif /* MSIM_VOICE_EXTN_H */