Always execute launch_client function to ensure it is in foreground
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 14 Nov 2018 04:45:05 +0000 (13:45 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 14 Nov 2018 05:15:31 +0000 (14:15 +0900)
Change-Id: Ia6a3384cb9a817e8dee4cdbf2b42f2ac403951b6

src/multi_assistant_dbus.c
src/multi_assistant_service.c
src/multi_assistant_service_plugin.c

index fa6aa54..a6ebc26 100644 (file)
@@ -321,7 +321,7 @@ int masc_ui_dbus_send_asr_result(int pid, int event, char* asr_result)
                MAS_LOGE("@@ Request multi-assistant send ASR result : Fail to make message");
                return -1; //MA_ERROR_OPERATION_FAILED;
        } else {
-               MAS_LOGD("[DEBUG] multi-assistant send ASR result, asr_result(%d)", asr_result);
+               MAS_LOGD("[DEBUG] multi-assistant send ASR result, asr_result(%p)", asr_result);
        }
 
        char* temp_asr_result = NULL;
index 0559ee8..77065de 100644 (file)
@@ -325,6 +325,8 @@ int mas_ui_client_change_assistant(const char* appid)
 
        mas_set_current_client_by_appid(appid);
        if (mas_get_client_pid_by_appid(appid) != -1) {
+               /* Bring MA client to foreground - is there a better way instead of launching? */
+               mas_launch_client_by_appid(appid);
                MAS_LOGD("MA Client with appid %s exists, requesting speech data", (appid ? appid : "NULL"));
                ma_client_set_temp_speech_data_requested(1);
                int ret = multi_assistant_service_plugin_request_speech_data();
@@ -526,6 +528,14 @@ int mas_get_client_pid_by_appid(const char *appid)
                }
        }
 
+       int status = aul_app_get_status_bypid(ret);
+       if (-1 != ret && 0 > status) {
+               MAS_LOGE("The PID for %s was %d, but it seems to be terminated : %d",
+                       (appid ? appid : "NULL"), ret, status);
+               mas_client_deinitialize(ret);
+               ret = -1;
+       }
+
        return ret;
 }
 
index 92f7bdb..894046a 100644 (file)
@@ -90,6 +90,8 @@ Eina_Bool __request_speech_data(void *data)
        mas_set_current_client_by_wakeup_word(wakeup_word);
        masc_ui_dbus_change_assistant(mas_get_client_appid_by_wakeup_word(wakeup_word));
        if ((pid = mas_get_client_pid_by_wakeup_word(wakeup_word)) != -1) {
+               /* Bring MA client to foreground - is there a better way instead of launching? */
+               mas_launch_client_by_wakeup_word(wakeup_word);
                MAS_LOGD("MA Client with wakeup word %s exists, requesting speech data", (wakeup_word ? wakeup_word : "NULL"));
                ma_client_set_temp_speech_data_requested(1);
                int ret = -1;