From e1b9e6660737d3711a8d73dccf98e46f81455c94 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 20 Mar 2020 10:32:30 +0900 Subject: [PATCH] Fix stte TC fail while tct-mgr execute Change-Id: I82aa425cd7b89703cd03d86d4c03ea302251d5b6 --- server/stte.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/server/stte.c b/server/stte.c index 04b86ad..48ddc0f 100755 --- a/server/stte.c +++ b/server/stte.c @@ -11,7 +11,9 @@ * limitations under the License. */ +#include #include +#include #include "stt_engine.h" #include "stt_defs.h" @@ -21,6 +23,28 @@ #include "stte.h" +static bool __is_default_engine() +{ + char* engine = NULL; + engine = vconf_get_str(VCONFKEY_STT_ENGINE_DEFAULT); + if (NULL == engine) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get sting for stt engine"); + return FALSE; + } + + char appid[1024] = {'\0', }; + if (0 != aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1)) { + SLOG(LOG_ERROR, TAG_STTD, "[Server ERROR] Fail to get callee appid by pid"); + } + + SLOG(LOG_DEBUG, TAG_STTD, "[Server] STT Default Engine(%s), appId(%s)", engine, appid); + if (0 == strncmp(engine, appid, strlen(engine))) { + free(engine); + return TRUE; + } + free(engine); + return FALSE; +} int stte_main(int argc, char**argv, stte_request_callback_s *callback) { @@ -33,10 +57,12 @@ int stte_main(int argc, char**argv, stte_request_callback_s *callback) return STTE_ERROR_OPERATION_FAILED; } - if (0 != sttd_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open connection"); - ecore_shutdown(); - return STTE_ERROR_OPERATION_FAILED; + if (TRUE == __is_default_engine()) { + if (0 != sttd_dbus_open_connection()) { + SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open connection"); + ecore_shutdown(); + return STTE_ERROR_OPERATION_FAILED; + } } ret = sttd_initialize(callback); -- 2.7.4