From: Ji-hoon Lee Date: Wed, 24 Jul 2019 06:26:03 +0000 (+0900) Subject: Save launching appid only when ACTIVATION flag is set X-Git-Tag: accepted/tizen/unified/20191001.062542~2^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=251c197b95fc8d9e9b935b625e5299ab8cfac6b4;p=platform%2Fcore%2Fuifw%2Fmulti-assistant-service.git Save launching appid only when ACTIVATION flag is set Change-Id: I869ebe8edcfc4be0721275d3a398d0e7470bc21f --- diff --git a/inc/multi_assistant_service.h b/inc/multi_assistant_service.h index 7f55bc8..0e0c51c 100644 --- a/inc/multi_assistant_service.h +++ b/inc/multi_assistant_service.h @@ -75,7 +75,11 @@ int mas_set_current_client_by_appid(const char *appid); int mas_launch_client_by_wakeup_word(const char *wakeup_word); -int mas_launch_client_by_appid(const char *appid); +typedef enum { + CLIENT_LAUNCH_MODE_ACTIVATION, + CLIENT_LAUNCH_MODE_PRELAUNCH, +} CLIENT_LAUNCH_MODE; +int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode); int mas_process_voice_key_event(bool pressed); diff --git a/src/multi_assistant_service.c b/src/multi_assistant_service.c index 21889fa..d945d5e 100644 --- a/src/multi_assistant_service.c +++ b/src/multi_assistant_service.c @@ -401,7 +401,7 @@ int mas_ui_client_change_assistant(const char* appid) int pid = mas_get_client_pid_by_appid(appid); if (pid != -1) { /* Bring MA client to foreground - is there a better way instead of launching? */ - mas_launch_client_by_appid(appid); + mas_launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION); masc_dbus_active_state_change(pid, MA_ACTIVE_STATE_ACTIVE); MAS_LOGD("MA Client with appid %s exists, requesting speech data", (appid ? appid : "NULL")); /* @@ -420,7 +420,7 @@ int mas_ui_client_change_assistant(const char* appid) 0 < strlen(g_maclient_info[loop].appid) && 0 < strlen(g_maclient_info[loop].wakeup_word[0])) { if (strncmp(appid, g_maclient_info[loop].appid, MAX_APPID_LEN) == 0) { - mas_launch_client_by_appid(g_maclient_info[loop].appid); + mas_launch_client_by_appid(g_maclient_info[loop].appid, CLIENT_LAUNCH_MODE_ACTIVATION); } } } @@ -794,7 +794,7 @@ int mas_set_current_client_by_appid(const char *appid) return ret; } -int mas_launch_client_by_appid(const char *appid) +int mas_launch_client_by_appid(const char *appid, CLIENT_LAUNCH_MODE launch_mode) { app_control_h app_control; int ret = 0; @@ -830,7 +830,7 @@ int mas_launch_client_by_appid(const char *appid) } app_control_destroy (app_control); - if (APP_CONTROL_ERROR_NONE == ret) { + if (APP_CONTROL_ERROR_NONE == ret && CLIENT_LAUNCH_MODE_ACTIVATION == launch_mode) { bool found = false; for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM; loop++) { if (g_maclient_info[loop].used && @@ -850,7 +850,7 @@ int mas_launch_client_by_appid(const char *appid) int mas_launch_client_by_wakeup_word(const char *wakeup_word) { const char *appid = mas_get_client_appid_by_wakeup_word(wakeup_word); - return mas_launch_client_by_appid(appid); + return mas_launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION); } diff --git a/src/multi_assistant_service_plugin.c b/src/multi_assistant_service_plugin.c index e8b0c74..9a4e38b 100644 --- a/src/multi_assistant_service_plugin.c +++ b/src/multi_assistant_service_plugin.c @@ -110,11 +110,11 @@ Eina_Bool __launch_assistant_by_wakeup_appid_timer(char* appid) if ((pid = mas_get_client_pid_by_appid(appid)) != -1) { masc_dbus_active_state_change(pid, MA_ACTIVE_STATE_ACTIVE); /* Bring MA client to foreground - is there a better way instead of launching? */ - mas_launch_client_by_appid(appid); + mas_launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION); } else { // Appropriate MA Client not available, trying to launch new one MAS_LOGD("MA Client with appid %s does not exist, launching client", appid); - mas_launch_client_by_appid(appid); + mas_launch_client_by_appid(appid, CLIENT_LAUNCH_MODE_ACTIVATION); } if (appid) free(appid);