Prevent sending dbus messages to panel if panel is not enabled 05/235405/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 4 Jun 2020 08:38:22 +0000 (17:38 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 4 Jun 2020 08:38:22 +0000 (17:38 +0900)
Change-Id: I85518b160461f93829cc0fe77a1a5af680659b02

src/service_main.cpp
src/service_plugin.cpp

index 656a91c..83f5f69 100644 (file)
@@ -138,9 +138,13 @@ int CServiceMain::client_send_voice_key_status_change(pid_t pid, ma_voice_key_st
 int CServiceMain::client_send_asr_result(pid_t pid, int event, const char* asr_result)
 {
        MAS_LOGD("[Enter] pid(%d), event(%d), asr_result(%s)", pid, event, asr_result);
-       int ret = mServiceIpc.masc_ui_dbus_send_asr_result(pid, event, asr_result);
-       if (0 != ret){
-               MAS_LOGE("[ERROR] Fail to send asr result, ret(%d)", ret);
+       bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled();
+       int ret = 0;
+       if (ui_panel_enabled) {
+               ret = mServiceIpc.masc_ui_dbus_send_asr_result(pid, event, asr_result);
+               if (0 != ret){
+                       MAS_LOGE("[ERROR] Fail to send asr result, ret(%d)", ret);
+               }
        }
 
        // if final event is , launch assistant app which is invoked with wakeup word.
@@ -152,9 +156,13 @@ int CServiceMain::client_send_result(pid_t pid, const char* display_text,
        const char* utterance_text, const char* result_json)
 {
        MAS_LOGD("[Enter] pid(%d), display_text(%s), utterance_text(%s), result_json(%s)", pid, display_text, utterance_text, result_json);
-       int ret = mServiceIpc.masc_ui_dbus_send_result(pid, display_text, utterance_text, result_json);
-       if (0 != ret){
-               MAS_LOGE("[ERROR] Fail to send result, ret(%d)", ret);
+       bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled();
+       int ret = 0;
+       if (ui_panel_enabled) {
+               mServiceIpc.masc_ui_dbus_send_result(pid, display_text, utterance_text, result_json);
+               if (0 != ret){
+                       MAS_LOGE("[ERROR] Fail to send result, ret(%d)", ret);
+               }
        }
 
        std::string pid_appid;
@@ -170,9 +178,13 @@ int CServiceMain::client_send_result(pid_t pid, const char* display_text,
 int CServiceMain::client_send_recognition_result(pid_t pid, int result)
 {
        MAS_LOGD("[Enter] pid(%d), result(%d)", pid, result);
-       int ret = mServiceIpc.masc_ui_dbus_send_recognition_result(pid, result);
-       if (0 != ret){
-               MAS_LOGE("[ERROR] Fail to send recognition result, ret(%d)", ret);
+       bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled();
+       int ret = 0;
+       if (ui_panel_enabled) {
+               mServiceIpc.masc_ui_dbus_send_recognition_result(pid, result);
+               if (0 != ret){
+                       MAS_LOGE("[ERROR] Fail to send recognition result, ret(%d)", ret);
+               }
        }
 
        std::string pid_appid;
@@ -416,7 +428,10 @@ int CServiceMain::ui_client_change_assistant(const char* appid)
        }
 
        bool use_custom_ui = get_client_custom_ui_option_by_appid(appid);
-       mServiceIpc.masc_ui_dbus_enable_common_ui(!use_custom_ui);
+       bool ui_panel_enabled = mServicePlugin.is_ui_panel_enabled();
+       if (ui_panel_enabled) {
+               mServiceIpc.masc_ui_dbus_enable_common_ui(!use_custom_ui);
+       }
 
        set_current_client_by_appid(appid);
        pid_t pid = get_client_pid_by_appid(appid);
index 6cef985..2af558b 100644 (file)
@@ -45,7 +45,7 @@ typedef struct {
 bool CServicePlugin::is_ui_panel_enabled()
 {
        /* By default we assume the ui panel is always enabled unless explicitly turned off */
-       bool ret = true;
+       bool ret = false;
        if (mPluginSettings) {
                ret = mPluginSettings->ui_panel_enabled;
        }