From ccf41b075d60b6a039827c008f7223975405748f Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 9 Feb 2023 18:25:23 +0900 Subject: [PATCH] Disable vconf related code that are not being currently used Change-Id: Idbf6118351b74ea30e971cf627ac69236f05c685 --- inc/service_main.h | 2 ++ plugins/wakeup-manager/inc/wakeup_settings.h | 2 ++ plugins/wakeup-manager/src/wakeup_settings.cpp | 10 ++++++++++ src/service_main.cpp | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/inc/service_main.h b/inc/service_main.h index 9b70246..135e3d4 100644 --- a/inc/service_main.h +++ b/inc/service_main.h @@ -61,6 +61,8 @@ typedef enum { #define ENABLE_MULTI_ASSISTANT_BY_DEFAULT +//#define ENABLE_PREPROCESSING_ASSISTANT + #define MULTI_ASSISTANT_SETTINGS_ACTIVATED "db/multi-assistant/activated" #define WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID "db/multi-assistant/preprocessing_assistant_appid" #define WAKEUP_SETTINGS_KEY_PRELAUNCH_MODE "db/multi-assistant/prelaunch_mode" diff --git a/plugins/wakeup-manager/inc/wakeup_settings.h b/plugins/wakeup-manager/inc/wakeup_settings.h index d73437b..994a345 100644 --- a/plugins/wakeup-manager/inc/wakeup_settings.h +++ b/plugins/wakeup-manager/inc/wakeup_settings.h @@ -22,6 +22,8 @@ #include #include +//#define ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS + typedef void (*input_language_changed_cb)(void* data); namespace multiassistant diff --git a/plugins/wakeup-manager/src/wakeup_settings.cpp b/plugins/wakeup-manager/src/wakeup_settings.cpp index d88d81b..327e07c 100644 --- a/plugins/wakeup-manager/src/wakeup_settings.cpp +++ b/plugins/wakeup-manager/src/wakeup_settings.cpp @@ -273,6 +273,7 @@ void CWakeupSettings::initialize(map custom_keys) mStreamingDurationMax = vconf_double; MWR_LOGD("streaming_duration_max : %f", mStreamingDurationMax); } +#ifdef ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS vconf_str = vconf_get_str(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE); if (vconf_str) { mVoiceInputLanguage = vconf_str; @@ -287,9 +288,12 @@ void CWakeupSettings::initialize(map custom_keys) free(vconf_str); vconf_str = nullptr; } +#endif +#ifdef ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS vconf_notify_key_changed(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE, wakeup_setting_input_language_changed_cb, this); +#endif vconf_notify_key_changed(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID].c_str(), wakeup_setting_default_assistant_appid_changed_cb, this); if (true == mMultipleMode) { @@ -304,8 +308,10 @@ void CWakeupSettings::initialize(map custom_keys) void CWakeupSettings::deinitialize() { +#ifdef ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS vconf_ignore_key_changed(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE, wakeup_setting_input_language_changed_cb); +#endif vconf_ignore_key_changed(mCustomVconfKeys[WAKEUP_SETTINGS_KEY_DEFAULT_ASSISTANT_APPID].c_str(), wakeup_setting_default_assistant_appid_changed_cb); if (true == mMultipleMode) { @@ -404,11 +410,15 @@ float CWakeupSettings::get_streaming_duration_max() std::string CWakeupSettings::get_current_language(void) { std::string result{"en_US"}; + +#ifdef ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS char* language = vconf_get_str(WAKEUP_SETTINGS_KEY_VOICE_INPUT_LANGUAGE); if (language) { result = language; free(language); } +#endif + return result; } diff --git a/src/service_main.cpp b/src/service_main.cpp index 0c5eedf..874a433 100644 --- a/src/service_main.cpp +++ b/src/service_main.cpp @@ -63,6 +63,7 @@ bool CServiceMain::check_preprocessing_assistant_exists() { bool ret = false; +#ifdef ENABLE_PREPROCESSING_ASSISTANT boost::optional preprocessing_appid = mPreferenceManager.get_string(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); if (preprocessing_appid) { @@ -76,6 +77,7 @@ bool CServiceMain::check_preprocessing_assistant_exists() } } } +#endif MAS_LOGD("result : %d", ret); @@ -107,6 +109,7 @@ bool CServiceMain::is_current_preprocessing_assistant(const char* appid) bool ret = false; +#ifdef ENABLE_PREPROCESSING_ASSISTANT boost::optional preprocessing_appid = mPreferenceManager.get_string(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); if (preprocessing_appid) { @@ -114,6 +117,7 @@ bool CServiceMain::is_current_preprocessing_assistant(const char* appid) ret = true; } } +#endif return ret; } @@ -155,12 +159,14 @@ int CServiceMain::client_send_preprocessing_information(pid_t pid) int ret = -1; MAS_LOGI("[Enter] pid(%d)", pid); +#ifdef ENABLE_PREPROCESSING_ASSISTANT boost::optional preprocessing_appid = mPreferenceManager.get_string(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); if (preprocessing_appid) { MAS_LOGD("preprocessing_assistant_appid : %s", (*preprocessing_appid).c_str()); ret = mServiceIpc.send_preprocessing_information(pid, (*preprocessing_appid).c_str()); } +#endif return ret; } @@ -1419,6 +1425,7 @@ bool CServiceMain::app_create(void *data) prelaunch_default_assistant(); update_voice_key_support_mode(); +#ifdef ENABLE_PREPROCESSING_ASSISTANT /* For the case of preprocessing assistant, it always have to be launched beforehand */ boost::optional preprocessing_assistant = mPreferenceManager.get_string(WAKEUP_SETTINGS_KEY_PREPROCESSING_ASSISTANT_APPID); @@ -1427,6 +1434,7 @@ bool CServiceMain::app_create(void *data) launch_client_by_appid((*preprocessing_assistant).c_str(), nullptr, nullptr, 0, nullptr, CLIENT_LAUNCH_MODE_PRELAUNCH); } +#endif MAS_LOGE("[END] Service app create"); return true; -- 2.7.4