Disable vconf related code that are not being currently used 34/288034/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 9 Feb 2023 09:25:23 +0000 (18:25 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 9 Feb 2023 09:26:21 +0000 (18:26 +0900)
Change-Id: Idbf6118351b74ea30e971cf627ac69236f05c685

inc/service_main.h
plugins/wakeup-manager/inc/wakeup_settings.h
plugins/wakeup-manager/src/wakeup_settings.cpp
src/service_main.cpp

index 9b70246..135e3d4 100644 (file)
@@ -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"
index d73437b..994a345 100644 (file)
@@ -22,6 +22,8 @@
 #include <vconf.h>
 #include <map>
 
+//#define ENABLE_VOICE_INPUT_LANGUAGE_SETTINGS
+
 typedef void (*input_language_changed_cb)(void* data);
 
 namespace multiassistant
index d88d81b..327e07c 100644 (file)
@@ -273,6 +273,7 @@ void CWakeupSettings::initialize(map<string, string> 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<string, string> 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<string, string> 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;
 }
 
index 0c5eedf..874a433 100644 (file)
@@ -63,6 +63,7 @@ bool CServiceMain::check_preprocessing_assistant_exists()
 {
        bool ret = false;
 
+#ifdef ENABLE_PREPROCESSING_ASSISTANT
        boost::optional<std::string> 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<std::string> 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<std::string> 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<std::string> 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;