From 67555bc4cea9dee94977b62bd3bbc05ec9d8900d Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 14 Nov 2018 13:45:05 +0900 Subject: [PATCH] Always execute launch_client function to ensure it is in foreground Change-Id: Ia6a3384cb9a817e8dee4cdbf2b42f2ac403951b6 --- src/multi_assistant_dbus.c | 2 +- src/multi_assistant_service.c | 10 ++++++++++ src/multi_assistant_service_plugin.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/multi_assistant_dbus.c b/src/multi_assistant_dbus.c index fa6aa54..a6ebc26 100644 --- a/src/multi_assistant_dbus.c +++ b/src/multi_assistant_dbus.c @@ -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; diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 0559ee8..77065de 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -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; } diff --git a/src/multi_assistant_service_plugin.c b/src/multi_assistant_service_plugin.c index 92f7bdb..894046a 100644 --- a/src/multi_assistant_service_plugin.c +++ b/src/multi_assistant_service_plugin.c @@ -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; -- 2.34.1