From 890ea44d44e8cbcf4b1d74cf88e9dfb92857b29f Mon Sep 17 00:00:00 2001 From: ulgal-park Date: Thu, 11 Aug 2022 20:58:02 +0900 Subject: [PATCH 01/16] Change interval and order when client connect to daemon Change-Id: Ie6dc0b87e757171b372918d85d99637bd921f0f5 --- client/vc.c | 2 +- client/vc_mgr.c | 6 ++--- client/vc_mgr_tidl.c | 14 +++++----- common/vc_defs.h | 3 ++- server/vcd_client_data.c | 9 ++----- server/vcd_client_data.h | 3 +-- server/vcd_tidl.c | 68 +++++++++++++++++++++--------------------------- 7 files changed, 44 insertions(+), 61 deletions(-) diff --git a/client/vc.c b/client/vc.c index 1c9b8b9..45fb98c 100644 --- a/client/vc.c +++ b/client/vc.c @@ -612,7 +612,7 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) /* Send hello */ while (0 != ret) { - if (retry_count == 20) { // 200 ms * 20 = 4 sec + if (retry_count == VC_TIDL_RETRY_COUNT) { // 200 ms * 20 = 4 sec SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE return; } diff --git a/client/vc_mgr.c b/client/vc_mgr.c index cef9eb4..1202871 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -526,16 +526,14 @@ static Eina_Bool __send_hello_message(void *data) { /* Send hello */ if (0 != vc_mgr_tidl_request_hello()) { - if (g_tidl_send_hello_count == VC_TIDL_RETRY_COUNT) { + if (g_tidl_send_hello_count == VCM_TIDL_RETRY_COUNT) { g_tidl_send_hello_count = 0; SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request hello !! send error to manager"); __vc_mgr_cb_error(VC_ERROR_TIMED_OUT, -1, "voice_framework.error.vcfw.connect_engine_fail"); g_send_hello_timer = NULL; return EINA_FALSE; } else { - // TODO: discuss when updating connect/reconnect g_tidl_send_hello_count++; - usleep(200000); return EINA_TRUE; } } @@ -575,7 +573,7 @@ int vc_mgr_prepare(void) g_tidl_send_hello_count = 0; SLOG(LOG_INFO, TAG_VCM, "[DEBUG] Create a new timer for preparation"); ecore_thread_main_loop_begin(); - g_send_hello_timer = ecore_timer_add(0.02, __send_hello_message, NULL); + g_send_hello_timer = ecore_timer_add(0.1, __send_hello_message, NULL); ecore_thread_main_loop_end(); } else { SLOG(LOG_INFO, TAG_VCM, "[INFO] timer handle is already created"); diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index a6218ba..6d095dd 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -517,10 +517,10 @@ static int __vcd_mgr_auth_cancel_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h return ret; } -static void __register_stub_callback() +static int __register_stub_callback() { if (g_stub_tidl_info->register_callback_requesting) { - return; + return VC_ERROR_NONE; } SLOG(LOG_DEBUG, TAG_VCM, "[TIDL] __register_stub_callback"); @@ -540,11 +540,11 @@ static void __register_stub_callback() if (0 == ret) { SLOG(LOG_DEBUG, TAG_VCM, "register callback"); g_stub_tidl_info->register_callback_requesting = true; - return; + return VC_ERROR_NONE; } - SLOG(LOG_ERROR, TAG_VCM, "Fail to rister callback(%d)", ret); - return; + SLOG(LOG_ERROR, TAG_VCM, "Fail to register callback(%d)", ret); + return VC_ERROR_OPERATION_FAILED; } int vc_mgr_tidl_open_connection() @@ -734,8 +734,8 @@ int vc_mgr_tidl_request_hello() if (!g_stub_tidl_info->connected) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Stub Not Connected"); - __register_stub_callback(); - return VC_ERROR_OPERATION_FAILED; + int ret = __register_stub_callback(); + return ret; } SLOG(LOG_DEBUG, TAG_VCM, ">>>>> VCM Hello"); diff --git a/common/vc_defs.h b/common/vc_defs.h index 327038d..b5ab4ec 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -269,7 +269,8 @@ extern "C" { #define VC_CONNECTION_RETRY_COUNT 10 #define VC_INVALID_TTS_UID 0 #define VC_ENGINE_APPID_LEN 256 -#define VC_TIDL_RETRY_COUNT 100 +#define VCM_TIDL_RETRY_COUNT 200 +#define VC_TIDL_RETRY_COUNT 20 #define VC_MGR_DEFAULT_FARFIELD_DUCKING_RATIO 0.0 #define VC_MGR_DEFAULT_NEARFIELD_DUCKING_RATIO 0.7 diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 6620180..de4c8cf 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -264,15 +264,11 @@ char* vcd_client_manager_get_result_text() return g_result_text; } -int vcd_client_manager_create_tidl_info(int pid) +int vcd_client_manager_create_tidl_info() { /*Check already created*/ if (NULL != g_mgr_tidl_info) { SLOG(LOG_WARN, TAG_VCD, "[Client Data] Manager tidl info pid is already registered"); - if (pid != g_mgr_tidl_info->pid) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Manager pid is different"); - return VCD_ERROR_OPERATION_FAILED; - } return VCD_ERROR_NONE; } @@ -283,7 +279,6 @@ int vcd_client_manager_create_tidl_info(int pid) return VCD_ERROR_OUT_OF_MEMORY; } - g_mgr_tidl_info->pid = pid; g_mgr_tidl_info->notify_cb = NULL; g_mgr_tidl_info->notify_cb_user_data = NULL; g_mgr_tidl_info->send_buffer_cb = NULL; @@ -293,7 +288,7 @@ int vcd_client_manager_create_tidl_info(int pid) g_mgr_tidl_info->connection_requesting = false; g_mgr_tidl_info->rpc_h = NULL; - SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new manager tidl info. pid(%d)", pid); + SLOG(LOG_INFO, TAG_VCD, "[Client Data SUCCESS] Add new manager tidl info."); return VCD_ERROR_NONE; } diff --git a/server/vcd_client_data.h b/server/vcd_client_data.h index 4c7fbdc..43c35a1 100644 --- a/server/vcd_client_data.h +++ b/server/vcd_client_data.h @@ -80,7 +80,6 @@ typedef struct { } client_tidl_info_s; typedef struct { - int pid; rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h notify_cb; void* notify_cb_user_data; rpc_port_stub_vcd_mgr_stub_vc_mgr_send_buffer_cb_h send_buffer_cb; @@ -177,7 +176,7 @@ char* vcd_client_manager_get_result_text(); bool vcd_client_manager_is_system_command_valid(int pid); -int vcd_client_manager_create_tidl_info(int pid); +int vcd_client_manager_create_tidl_info(); int vcd_client_manager_set_tidl_notify_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_notify_cb_h callback, void* user_data); diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index a881cd7..3d16d29 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -844,7 +844,35 @@ static void __vc_mgr_create_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h conte SLOG(LOG_DEBUG, TAG_VCD, "@@@ Manager connect. appid(%s)", sender); + pthread_mutex_lock(&g_mgr_tidl_info_mutex); + int ret = -1; + ret = vcd_client_manager_create_tidl_info(); + + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info."); + pthread_mutex_unlock(&g_mgr_tidl_info_mutex); + return; + } + + manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); + + if (NULL == mgr_tidl_info) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info"); + pthread_mutex_unlock(&g_mgr_tidl_info_mutex); + return; + } + + mgr_tidl_info->rpc_h = __mgr_create_rpc_port(sender); + + if (NULL == mgr_tidl_info->rpc_h) { + SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy"); + } else { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender); + } + free(sender); + pthread_mutex_unlock(&g_mgr_tidl_info_mutex); + __request_tidl_connect(VCD_CLIENT_TYPE_MANAGER, -1); } static void __vc_mgr_terminate_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h context, void *user_data) @@ -857,7 +885,7 @@ static void __vc_mgr_terminate_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h co return; } - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE. pid(%u)", mgr_tidl_info->pid); + SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER FINALIZE."); if (0 != vcd_client_manager_unset_tidl_notify_cb()) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to unset notify callback"); @@ -890,42 +918,6 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h pthread_mutex_lock(&g_mgr_tidl_info_mutex); SLOG(LOG_INFO, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK"); - int ret = -1; - ret = vcd_client_manager_create_tidl_info(pid); - - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info."); - pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - return; - } - - manager_tidl_info_s* mgr_tidl_info = vcd_client_manager_get_tidl_info(); - - if (NULL == mgr_tidl_info) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info. pid(%d)", pid); - pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - return; - } - - char *sender = NULL; - rpc_port_stub_vcd_mgr_stub_vc_mgr_context_get_sender(context, &sender); - - if (!sender){ - SLOG(LOG_ERROR, TAG_VCD, "Sender is NULL"); - pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - return; - } - - mgr_tidl_info->rpc_h = __mgr_create_rpc_port(sender); - - if (NULL == mgr_tidl_info->rpc_h) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create server proxy"); - } else { - SLOG(LOG_INFO, TAG_VCD, "[TIDL] rpc_h(%p), engine_app_id(%s)", mgr_tidl_info->rpc_h, sender); - } - - free(sender); - if (0 != vcd_client_manager_set_tidl_notify_cb(notify_callback, user_data)) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to set notify callback"); } else { @@ -940,8 +932,6 @@ static void __vc_mgr_register_cb_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h pthread_mutex_unlock(&g_mgr_tidl_info_mutex); - __request_tidl_connect(VCD_CLIENT_TYPE_MANAGER, pid); - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC MANAGER REGISTER CALLBACK DONE"); } -- 2.7.4 From 65ce3aed2444e0b2a415a2119382c5853272e4d4 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Tue, 6 Sep 2022 10:52:24 +0900 Subject: [PATCH 02/16] Fix coverity issues Change-Id: I3db738f369e0a7a36f09e73ca1f9740a79f1b8ef Signed-off-by: sooyeon --- client/vc_mgr_ducking.cpp | 3 ++- client/vc_mgr_tidl.c | 4 ++++ client/vc_setting_tidl.c | 3 +++ server/vcd_tidl.c | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/vc_mgr_ducking.cpp b/client/vc_mgr_ducking.cpp index f8e8756..06a2290 100644 --- a/client/vc_mgr_ducking.cpp +++ b/client/vc_mgr_ducking.cpp @@ -68,8 +68,9 @@ static void __destroy_ducking_handle(sound_stream_ducking_h ducking_handle) return; } + SLOG(LOG_WARN, TAG_VCM, "Destroy ducking handle. handle(%p)", ducking_handle); int ret = sound_manager_destroy_stream_ducking(ducking_handle); - SLOG(LOG_WARN, TAG_VCM, "Destroy ducking handle. handle(%p) ret(%d/%s)", ducking_handle, ret, get_error_message(ret)); + SLOG(LOG_WARN, TAG_VCM, "Destroy ducking handle DONE. ret(%d/%s)", ret, get_error_message(ret)); } static bool __is_all_ducking_handle_valid() diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index 69b51d5..94f3bd9 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -945,6 +945,8 @@ int vc_mgr_tidl_request_get_audio_type(int pid, char** audio_type) if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get audio type : Fail to invoke message, error(%d)", ret); + *audio_type = NULL; + free(tmp); return ret; } SLOG(LOG_DEBUG, TAG_VCM, "[TIDL] Request vc manager get audio type : Success"); @@ -996,6 +998,8 @@ int vc_mgr_tidl_request_get_private_data(int pid, const char* key, char** data) if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager get private data : Fail to invoke message, error(%d)", ret); + *data = NULL; + free(tmp); return ret; } SLOG(LOG_DEBUG, TAG_VCM, "[TIDL] Request vc manager get private data : Success"); diff --git a/client/vc_setting_tidl.c b/client/vc_setting_tidl.c index 4f33b25..33ec24a 100644 --- a/client/vc_setting_tidl.c +++ b/client/vc_setting_tidl.c @@ -228,6 +228,7 @@ int vc_setting_tidl_open_connection() if (NULL == info->rpc_h) { SLOG(LOG_ERROR, TAG_VCC, "[TIDL ERROR] Fail to create proxy"); free(info); + free(engine_appid); return VC_ERROR_OPERATION_FAILED; } @@ -235,6 +236,8 @@ int vc_setting_tidl_open_connection() g_tidl_infos = g_list_append(g_tidl_infos, info); SLOG(LOG_ERROR, TAG_VCC, "[TIDL] pid(%d) rpc_h(%p), engine_appid(%s)", pid, info->rpc_h, info->engine_appid); + free(engine_appid); + return VC_ERROR_NONE; } diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index 9025949..e142039 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -850,6 +850,7 @@ static void __vc_mgr_create_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h conte if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to create manager tidl info."); + free(sender); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; } @@ -858,6 +859,7 @@ static void __vc_mgr_create_cb(rpc_port_stub_vcd_mgr_stub_vc_mgr_context_h conte if (NULL == mgr_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Fail to get manager tidl info"); + free(sender); pthread_mutex_unlock(&g_mgr_tidl_info_mutex); return; } @@ -2556,6 +2558,8 @@ int vcdc_send_request_get_private_data(int pid, const char* key, char** data) int ret = rpc_port_proxy_vcd_mgr_proxy_vcd_mgr_invoke_get_private_data(mgr_tidl_info->rpc_h, pid, key, &tmp); if (RPC_PORT_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCD, "[TIDL ERROR] Request vcd manager get private data : Fail to invoke message, error(%d)", ret); + *data = NULL; + free(tmp); return ret; } SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Request vcd manager get private data : Success"); -- 2.7.4 From d5963e3d8ccf43401b36bf8d62b9bf094aa4418e Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 20 Sep 2022 20:46:23 +0900 Subject: [PATCH 03/16] Add to disconnect rpc socket when client is finalized Cause: __on_disconnection is called when engine is terminated due to no more clients. Change-Id: If3cfaa9c35ce8477e3c08e7d12c211d49e622c42 Solution: To avoid reconnect by service reset, disconnect rpc socket when client is finalized. --- client/vc_mgr_tidl.c | 13 ++++++++++++- client/vc_tidl.c | 13 ++++++++++++- client/vc_widget_tidl.c | 14 +++++++++++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index 94f3bd9..9757e1e 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -803,7 +803,18 @@ int vc_mgr_tidl_request_finalize(int pid) } if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke message, error(%d)", ret); + SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to invoke finalize, error(%d)", ret); + return ret; + } + + ret = rpc_port_proxy_vc_mgr_proxy_vc_mgr_disconnect(g_proxy_tidl_info->rpc_h); + exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[TIDL ERROR] Request vc manager finalize : Fail to disconnect, error(%d)", ret); return ret; } diff --git a/client/vc_tidl.c b/client/vc_tidl.c index 205ee2f..c92aa53 100644 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -457,7 +457,18 @@ int vc_tidl_request_finalize(int pid) } if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke message. err(%d)", ret); + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to invoke finalize. err(%d)", ret); + return ret; + } + + ret = rpc_port_proxy_vc_proxy_vc_disconnect(info->rpc_h); + exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to disconnect. err(%d)", ret); return ret; } diff --git a/client/vc_widget_tidl.c b/client/vc_widget_tidl.c index 2c7e705..9b6a80b 100644 --- a/client/vc_widget_tidl.c +++ b/client/vc_widget_tidl.c @@ -501,7 +501,19 @@ int vc_widget_tidl_request_finalize(int pid) } if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke message, error(%d)", ret); + SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to invoke finalize, error(%d)", ret); + pthread_mutex_unlock(&g_w_init_mutex); + return ret; + } + + ret = rpc_port_proxy_vc_widget_proxy_vc_widget_disconnect(g_proxy_tidl_info->rpc_h); + exception = get_last_result(); + if (RPC_PORT_ERROR_NONE != exception) { + ret = __convert_unhandled_error(exception); + } + + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCW, "[TIDL ERROR] Request vc widget finalize : Fail to disconnect, error(%d)", ret); pthread_mutex_unlock(&g_w_init_mutex); return ret; } -- 2.7.4 From 5218c956d8e76ce58300b81921b6b359435735bf Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 21 Sep 2022 08:46:22 +0900 Subject: [PATCH 04/16] Add prepare_sync function to connect directly Cause: The Web TCs were blocked and failed. Change-Id: I5b64a3f281b59191d8c41fc60a44eacdcdd5edb3 Solution: Connect directly when web api request to prepare --- client/vc.c | 6 ++++++ client/vc_tidl.c | 41 +++++++++++++++++++++++++++++++++++++++++ client/vc_tidl.h | 2 ++ 3 files changed, 49 insertions(+) diff --git a/client/vc.c b/client/vc.c index 45fb98c..1e2cdad 100644 --- a/client/vc.c +++ b/client/vc.c @@ -692,6 +692,12 @@ int vc_prepare_sync(void) /* check state */ RETVM_IF(state != VC_STATE_INITIALIZED, VC_ERROR_INVALID_STATE, TAG_VCC, "[ERROR] Invalid State: Current state(%d) is not 'Initialized'", state); + ret = vc_tidl_request_hello_sync(); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello_sync, ret(%d)", ret); + return ret; + } + int cnt = 0; while (EINA_TRUE == __vc_connect_daemon(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { cnt++; diff --git a/client/vc_tidl.c b/client/vc_tidl.c index c92aa53..b9c5a18 100644 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -168,6 +168,19 @@ static void __request_tidl_connect(vc_tidl_info_s* info) info->connection_requesting = true; } +static int __request_tidl_connect_sync(vc_tidl_info_s* info) +{ + int ret = rpc_port_proxy_vc_proxy_vc_connect_sync(info->rpc_h); + if (RPC_PORT_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request connection to stub. ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_INFO, TAG_VCC, "[INFO] Success to connect stub synchronously. ret(%d)", ret); + return VC_ERROR_NONE; +} + + static void __notify_cb(void* user_data, int pid, bundle* msg) { // corresponding to listener_event_callback @@ -409,6 +422,34 @@ int vc_tidl_request_hello() } +int vc_tidl_request_hello_sync() +{ + SLOG(LOG_INFO, TAG_VCC, "[TIDL] vc_tidl_request_hello"); + + int pid = getpid(); + vc_tidl_info_s* info = __get_tidl_info_s(pid); + RETVM_IF(NULL == info, VC_ERROR_INVALID_PARAMETER, TAG_VCC, "[ERROR] Fail to get tidl info"); + + if (!info->connected) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Not Connected. Call __request_tidl_connect()"); + int ret = __request_tidl_connect_sync(info); + if (VC_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[TIDL] Fail to connect, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + SLOG(LOG_ERROR, TAG_VCC, "[TIDL] Stub is connected"); + } + + SLOG(LOG_DEBUG, TAG_VCC, ">>>>> VCC Hello"); + if (VC_ERROR_NONE != __invoke_register_notify_callback(pid, info)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to invoke register callback"); + return VC_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_DEBUG, TAG_VCC, "<<<<"); + return VC_ERROR_NONE; +} + static int __convert_unhandled_error(int ret) { if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) { diff --git a/client/vc_tidl.h b/client/vc_tidl.h index 7b84703..b2d80f6 100644 --- a/client/vc_tidl.h +++ b/client/vc_tidl.h @@ -31,6 +31,8 @@ int vc_tidl_close_connection(); int vc_tidl_request_hello(); +int vc_tidl_request_hello_sync(); + int vc_tidl_request_initialize(int pid, int* mgr_pid, int* service_state, int* daemon_pid); int vc_tidl_request_finalize(int pid); -- 2.7.4 From a2b3d86cd444a476d875e7f9be1f913af53cec0f Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 23 Sep 2022 16:50:49 +0900 Subject: [PATCH 05/16] Add logic to avoid reconnetion when finalize Cause: The on_disconnect() cb is called, even a client requtests to disconnect. Change-Id: I463ad1321968cc86b775125b220dfc8f1ce8b9b3 Solution: Check whether ipc listening state or not when tries to reconnect. --- client/vc.c | 5 +++++ client/vc_client.c | 21 +++++++++++++++++++++ client/vc_client.h | 3 +++ client/vc_tidl.c | 17 ++++------------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/client/vc.c b/client/vc.c index 1e2cdad..2f18575 100644 --- a/client/vc.c +++ b/client/vc.c @@ -404,6 +404,9 @@ static void __vc_internal_unprepare(void) SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request finalize : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } + /* TODO set_start_listening should be move to proper place */ + vc_client_set_start_listening(false); + if (NULL != g_focus_in_handler) { ecore_event_handler_del(g_focus_in_handler); g_focus_in_handler = NULL; @@ -599,6 +602,8 @@ static Eina_Bool __vc_connect_daemon(void *data) SLOG(LOG_ERROR, TAG_VCC, "[Not ERROR] The current client is not valid. It is destroyed."); //LCOV_EXCL_LINE return EINA_FALSE; } + /* TODO set_start_listening should be move to proper place */ + vc_client_set_start_listening(true); SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Connect daemon DONE"); diff --git a/client/vc_client.c b/client/vc_client.c index 442ac1f..601b840 100644 --- a/client/vc_client.c +++ b/client/vc_client.c @@ -69,6 +69,9 @@ typedef struct { /* Invocation name */ char* invocation_name; + + /* Listening IPC message from service */ + bool start_listening; } vc_client_s; static vc_client_s *g_client = NULL; @@ -124,6 +127,7 @@ int vc_client_create(void) g_client->is_foreground = false; g_client->invocation_name = NULL; + g_client->start_listening = false; SLOG(LOG_INFO, TAG_VCC, "[INFO] client create. pid(%u)", g_client->pid); @@ -616,3 +620,20 @@ int vc_client_get_tts_utterance_status_cb(vc_tts_utterance_status_cb* callback, return VC_ERROR_NONE; } + +int vc_client_set_start_listening(bool is_listening_started) +{ + if (NULL == g_client) + return VC_ERROR_INVALID_PARAMETER; + + g_client->start_listening = is_listening_started; + return VC_ERROR_NONE; +} + +bool vc_client_is_listening_started() +{ + if (NULL == g_client) + return false; + + return g_client->start_listening; +} \ No newline at end of file diff --git a/client/vc_client.h b/client/vc_client.h index 21c3ea9..3505421 100644 --- a/client/vc_client.h +++ b/client/vc_client.h @@ -126,6 +126,9 @@ int vc_client_set_tts_utterance_status_cb(vc_tts_utterance_status_cb callback, v int vc_client_get_tts_utterance_status_cb(vc_tts_utterance_status_cb* callback, void** user_data); +int vc_client_set_start_listening(bool is_listening_started); + +bool vc_client_is_listening_started(); #ifdef __cplusplus } diff --git a/client/vc_tidl.c b/client/vc_tidl.c index b9c5a18..b38097e 100644 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -18,6 +18,7 @@ #include "vc_tidl.h" #include "vc_proxy.h" #include "vc_main.h" +#include "vc_client.h" #include @@ -113,8 +114,9 @@ static void __on_disconnected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data) /* retry to connect */ SLOG(LOG_INFO, TAG_VCC, "[INFO] Disconnected to server"); - __vc_cb_error(VC_ERROR_SERVICE_RESET, "Server Disconnected"); - + if (vc_client_is_listening_started()) { + __vc_cb_error(VC_ERROR_SERVICE_RESET, "Server Disconnected"); + } } static void __on_rejected(rpc_port_proxy_vc_proxy_vc_h h, void* user_data) @@ -502,17 +504,6 @@ int vc_tidl_request_finalize(int pid) return ret; } - ret = rpc_port_proxy_vc_proxy_vc_disconnect(info->rpc_h); - exception = get_last_result(); - if (RPC_PORT_ERROR_NONE != exception) { - ret = __convert_unhandled_error(exception); - } - - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCC, ">>>> Request vc finalize : Fail to disconnect. err(%d)", ret); - return ret; - } - SLOG(LOG_DEBUG, TAG_VCC, "@@ vc finalize : result = %d", ret); return VC_ERROR_NONE; -- 2.7.4 From 731d7e69bc8c62ad11c078f0ccc4c5ba837b871c Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 28 Sep 2022 09:55:08 +0900 Subject: [PATCH 06/16] Retry when prepare_sync is failed Change-Id: I9a96cd1254fefd746a76e6f8bb1fe2bba255293e --- client/vc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/vc.c b/client/vc.c index 2f18575..d0d19db 100644 --- a/client/vc.c +++ b/client/vc.c @@ -697,13 +697,22 @@ int vc_prepare_sync(void) /* check state */ RETVM_IF(state != VC_STATE_INITIALIZED, VC_ERROR_INVALID_STATE, TAG_VCC, "[ERROR] Invalid State: Current state(%d) is not 'Initialized'", state); - ret = vc_tidl_request_hello_sync(); + ret = -1; + int cnt = 0; + while (VC_CONNECTION_RETRY_COUNT > cnt) { + ret= vc_tidl_request_hello_sync(); + if (VC_ERROR_NONE == ret) + break; + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello_sync and retry, ret(%d)", ret); + usleep(100000); + cnt++; + } if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello_sync, ret(%d)", ret); return ret; } - int cnt = 0; + cnt = 0; while (EINA_TRUE == __vc_connect_daemon(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { cnt++; } -- 2.7.4 From 3e8ef5daf87f35278a2ca0fe8528edfc4e4baaa9 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 28 Sep 2022 13:13:31 +0900 Subject: [PATCH 07/16] Add usleep while waiting for releasing callback function Change-Id: I3516ec0834dda1eb4d9d8af2e993671e9a89dda8 --- client/vc_client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/vc_client.c b/client/vc_client.c index 601b840..30a6bed 100644 --- a/client/vc_client.c +++ b/client/vc_client.c @@ -143,6 +143,7 @@ int vc_client_destroy(void) while (0 != g_client->cb_ref_count) { /* wait for release callback function */ + usleep(10000); } if (NULL != g_client->invocation_name) { free(g_client->invocation_name); -- 2.7.4 From 62070b9c397410610f791ff3811dbaa60e382d01 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 28 Sep 2022 13:14:37 +0900 Subject: [PATCH 08/16] Update version to 1.70.6 Change-Id: I10ed1ade43238e73c857acf21251d238f1412557 --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 415086c..6639667 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.70.5 +Version: 1.70.6 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From 8feeb3fd875229f82437733face7c45e4a416ac0 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Mon, 8 Aug 2022 11:44:01 +0900 Subject: [PATCH 09/16] Add TIDL privileges in vce header description Change-Id: Ic689323869a141bcc21d51fa695cae1e0b63574d Signed-off-by: sooyeon --- include/vce.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/vce.h b/include/vce.h index 1b16529..72f4f94 100644 --- a/include/vce.h +++ b/include/vce.h @@ -686,6 +686,8 @@ typedef struct { * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The service_app_main() should be used for working the engine after this function. * @param[in] argc The argument count(original) * @param[in] argv The argument(original) @@ -897,6 +899,8 @@ int vce_send_error(vce_error_e error, const char* msg, void* user_data); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. * @param[in] callback_func vce_private_data_set event callback function * @return @c 0 on success, otherwise a negative error value @@ -916,6 +920,8 @@ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. * @param[in] callback_func vce_private_data_requested event callback function * @return @c 0 on success, otherwise a negative error value @@ -1008,6 +1014,8 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The @a audio_type must be released using free() when it is no longer required. * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @return the value greater than 0 on success, otherwise a negative error value @@ -1023,6 +1031,8 @@ int vce_get_audio_type(char** audio_type); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @param[in] key Private key * @param[in] data Private data * @return 0 on success, otherwise a negative error value. @@ -1041,6 +1051,8 @@ int vce_set_private_data(const char* key, const char* data); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The @a data must be released using free() when it is no longer required. * @param[in] key Private key * @param[out] data Private data @@ -1060,6 +1072,8 @@ int vce_get_private_data(const char* key, char** data); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported @@ -1074,6 +1088,8 @@ int vce_start_recording(void); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported -- 2.7.4 From 2b3b31db0b70593fe077ea55984f225c8ccfa273 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Mon, 8 Aug 2022 14:03:41 +0900 Subject: [PATCH 10/16] Add and Rearrange descriptions Change-Id: I78f52786dbcb48d34b56ffd41ba47c41a7a6316c Signed-off-by: sooyeon --- include/vce.h | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/include/vce.h b/include/vce.h index 72f4f94..851dddd 100644 --- a/include/vce.h +++ b/include/vce.h @@ -689,6 +689,7 @@ typedef struct { * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The service_app_main() should be used for working the engine after this function. + * * @param[in] argc The argument count(original) * @param[in] argv The argument(original) * @param[in] callback The structure of engine request callback function @@ -795,6 +796,9 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); /** * @brief Sends the results to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @param[in] event A result event * @param[in] result_id Result ids * @param[in] count Result count @@ -819,6 +823,9 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c /** * @brief Sends the ASR result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @param[in] event A asr result event * @param[in] asr_result A asr result text * @param[in] user_data The user data passed from the start @@ -835,6 +842,9 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo /** * @brief Sends the NLG (Natural Language Generation) result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @param[in] nlg_result A nlg result * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value @@ -850,6 +860,8 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); /** * @brief Sends the specific engine result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * * @param[in] engine_app_id A specific engine's app id * @param[in] event A specific engine result event @@ -882,6 +894,9 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * #VCE_ERROR_NOT_SUPPORTED_FEATURE \n * #VCE_ERROR_TTS_FAILED. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @param[in] error Error type * @param[in] msg Error message * @param[in] user_data The user data passed from set callback function @@ -899,9 +914,8 @@ int vce_send_error(vce_error_e error, const char* msg, void* user_data); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) - * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. + * * @param[in] callback_func vce_private_data_set event callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -920,9 +934,8 @@ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) - * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. + * * @param[in] callback_func vce_private_data_requested event callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -1014,9 +1027,8 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) - * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The @a audio_type must be released using free() when it is no longer required. + * * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @return the value greater than 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -1033,6 +1045,7 @@ int vce_get_audio_type(char** audio_type); * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @param[in] key Private key * @param[in] data Private data * @return 0 on success, otherwise a negative error value. @@ -1054,6 +1067,7 @@ int vce_set_private_data(const char* key, const char* data); * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks The @a data must be released using free() when it is no longer required. + * * @param[in] key Private key * @param[out] data Private data * @return 0 on success, otherwise a negative error value. @@ -1074,6 +1088,7 @@ int vce_get_private_data(const char* key, char** data); * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported @@ -1088,8 +1103,7 @@ int vce_start_recording(void); * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) - * %http://tizen.org/privilege/datasharing (Since 7.0) + * * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported @@ -1101,6 +1115,8 @@ int vce_stop_recording(void); /** * @brief Sends audio formats necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * * @param[in] rate A sampling rate * @param[in] channel The audio channel @@ -1118,6 +1134,8 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au /** * @brief Sends audio streaming necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * %http://tizen.org/privilege/datasharing (Since 7.0) * * @param[in] event A feedback event * @param[in] buffer The feedback data -- 2.7.4 From 45e83e3370e2357fed9a82bf1820483fba171f7a Mon Sep 17 00:00:00 2001 From: sooyeon Date: Thu, 22 Sep 2022 10:29:22 +0900 Subject: [PATCH 11/16] Add remarks for additional privileges Change-Id: I3ce6765012901624f928e0c86c80a0248d0e6dea Signed-off-by: sooyeon --- include/vce.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/vce.h b/include/vce.h index 851dddd..4509c32 100644 --- a/include/vce.h +++ b/include/vce.h @@ -688,7 +688,8 @@ typedef struct { * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) - * @remarks The service_app_main() should be used for working the engine after this function. + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n + * The service_app_main() should be used for working the engine after this function. * * @param[in] argc The argument count(original) * @param[in] argv The argument(original) @@ -796,8 +797,10 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); /** * @brief Sends the results to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] event A result event * @param[in] result_id Result ids @@ -823,8 +826,10 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c /** * @brief Sends the ASR result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] event A asr result event * @param[in] asr_result A asr result text @@ -842,8 +847,10 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo /** * @brief Sends the NLG (Natural Language Generation) result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] nlg_result A nlg result * @param[in] user_data The user data passed from the start @@ -860,8 +867,10 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); /** * @brief Sends the specific engine result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] engine_app_id A specific engine's app id * @param[in] event A specific engine result event @@ -894,8 +903,10 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * #VCE_ERROR_NOT_SUPPORTED_FEATURE \n * #VCE_ERROR_TTS_FAILED. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] error Error type * @param[in] msg Error message @@ -1045,6 +1056,7 @@ int vce_get_audio_type(char** audio_type); * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] key Private key * @param[in] data Private data @@ -1066,7 +1078,8 @@ int vce_set_private_data(const char* key, const char* data); * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) - * @remarks The @a data must be released using free() when it is no longer required. + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n + * The @a data must be released using free() when it is no longer required. * * @param[in] key Private key * @param[out] data Private data @@ -1088,6 +1101,7 @@ int vce_get_private_data(const char* key, char** data); * @privilege %http://tizen.org/privilege/recorder * %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful @@ -1115,8 +1129,10 @@ int vce_stop_recording(void); /** * @brief Sends audio formats necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] rate A sampling rate * @param[in] channel The audio channel @@ -1134,8 +1150,10 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au /** * @brief Sends audio streaming necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) * %http://tizen.org/privilege/datasharing (Since 7.0) + * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * * @param[in] event A feedback event * @param[in] buffer The feedback data -- 2.7.4 From dff097e2dd1cae019c15b830b0365ff9644a6cec Mon Sep 17 00:00:00 2001 From: sooyeon Date: Thu, 22 Sep 2022 13:46:47 +0900 Subject: [PATCH 12/16] Add permission denied error and descriptions Change-Id: Iaf1b54300feb01f789cac0af799982a3d6492a3b Signed-off-by: sooyeon --- common/vc_defs.h | 2 ++ include/vce.h | 37 +++++++++++++++++------------ server/vce.c | 71 ++++++++++++++++++++++++++++++++++---------------------- 3 files changed, 67 insertions(+), 43 deletions(-) diff --git a/common/vc_defs.h b/common/vc_defs.h index 0e12f46..1fb53d3 100644 --- a/common/vc_defs.h +++ b/common/vc_defs.h @@ -282,6 +282,8 @@ extern "C" { #define VC_MIC_FEATURE_PATH "tizen.org/feature/microphone" #define VC_PRIVILEGE_RECORDER "http://tizen.org/privilege/recorder" +#define VC_PRIVILEGE_APPMGR_LAUNCH "http://tizen.org/privilege/appmanager.launch" +#define VC_PRIVILEGE_DATASHARING "http://tizen.org/privilege/datasharing" #define VC_MGR_PRIVILEGE "http://tizen.org/privilege/voicecontrol.manager" /****************************************************************************************** diff --git a/include/vce.h b/include/vce.h index 4509c32..ae54abc 100644 --- a/include/vce.h +++ b/include/vce.h @@ -685,8 +685,8 @@ typedef struct { * @details This function is the main function for operating VC engine. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/recorder \n + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n * The service_app_main() should be used for working the engine after this function. @@ -798,7 +798,7 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); * @brief Sends the results to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -813,6 +813,7 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); * @param[in] user_data The user data passed from set callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_INVALID_STATE Invalid state @@ -827,7 +828,7 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c * @brief Sends the ASR result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -836,6 +837,7 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failure @@ -848,7 +850,7 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo * @brief Sends the NLG (Natural Language Generation) result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -856,6 +858,7 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failure @@ -868,7 +871,7 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); * @brief Sends the specific engine result to the engine service user. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -879,6 +882,7 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failure @@ -904,7 +908,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * #VCE_ERROR_TTS_FAILED. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -913,6 +917,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * @param[in] user_data The user data passed from set callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory * @retval #VCE_ERROR_OPERATION_FAILED Operation failure @@ -1053,8 +1058,8 @@ int vce_get_audio_type(char** audio_type); * @brief Sets private data to a voice manager client. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/recorder \n + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -1075,8 +1080,8 @@ int vce_set_private_data(const char* key, const char* data); * @brief Gets private data from a voice manager client. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/recorder \n + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. \n * The @a data must be released using free() when it is no longer required. @@ -1098,8 +1103,8 @@ int vce_get_private_data(const char* key, char** data); * @brief Starts recording voice. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/recorder - * %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/recorder \n + * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -1130,7 +1135,7 @@ int vce_stop_recording(void); * @brief Sends audio formats necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -1141,6 +1146,7 @@ int vce_stop_recording(void); * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -1151,7 +1157,7 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au * @brief Sends audio streaming necessary for playing TTS feedback. * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif * @privlevel public - * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) + * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) * @remarks To use this function, privileges of appmanager.launch and datasharing should be included since 7.0. * @@ -1162,6 +1168,7 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_NOT_SUPPORTED Not supported + * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory diff --git a/server/vce.c b/server/vce.c index 98826b5..7daff10 100644 --- a/server/vce.c +++ b/server/vce.c @@ -141,6 +141,28 @@ static int __vce_check_privilege() //LCOV_EXCL_STOP } + ret = __check_privilege(uid, VC_PRIVILEGE_APPMGR_LAUNCH); + if (false == ret) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_APPMGR_LAUNCH, uid); + __check_privilege_deinitialize(); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VCE_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP + } + + ret = __check_privilege(uid, VC_PRIVILEGE_DATASHARING); + if (false == ret) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_DATASHARING, uid); + __check_privilege_deinitialize(); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VCE_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP + } + __check_privilege_deinitialize(); } @@ -198,11 +220,10 @@ int vce_main(int argc, char** argv, vce_request_callback_s *callback) int vce_send_result(vce_result_event_e event, int* result_id, int count, const char* all_result, const char* non_fixed_result, const char* nlu_result, const char* msg, int* user_info, void *user_data) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (event < VCE_RESULT_EVENT_SUCCESS || event > VCE_RESULT_EVENT_ERROR) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); @@ -226,11 +247,10 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, void *user_data) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (event < VCE_ASR_RESULT_EVENT_FINAL_RESULT || event > VCE_ASR_RESULT_EVENT_ERROR) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); @@ -253,11 +273,10 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo int vce_send_specific_engine_result(const char* engine_app_id, const char* event, const char* result, void *user_info) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (NULL == engine_app_id || NULL == event) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); @@ -280,11 +299,10 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event int vce_send_nlg_result(const char* nlg_result, void *user_data) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (NULL == nlg_result) { SLOG(LOG_ERROR, TAG_VCD, "[INFO] Input parameter is NULL. (no result)"); @@ -302,11 +320,10 @@ int vce_send_nlg_result(const char* nlg_result, void *user_data) int vce_send_error(vce_error_e error, const char* msg, void *user_data) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (NULL == msg) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Input parameter is NULL. (no error message)"); @@ -566,11 +583,10 @@ int vce_unset_specific_engine_request_cb(void) /* for TTS feedback */ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_audio_type_e audio_type) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (channel < VCE_AUDIO_CHANNEL_MONO || channel > VCE_AUDIO_CHANNEL_STEREO) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid parameter"); @@ -592,11 +608,10 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au int vce_send_feedback_streaming(vce_feedback_event_e event, char* buffer, int len) { - if (0 != __vce_get_feature_enabled()) { - return VCE_ERROR_NOT_SUPPORTED; - } - int ret = VCE_ERROR_NONE; + ret = __check_engine_feature_privilege(); + if (VCE_ERROR_NONE != ret) + return ret; if (NULL == buffer) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Input parameter is NULL"); -- 2.7.4 From bc34a0658f313b7f1ce2fdab8975e0ad0af1a243 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Thu, 22 Sep 2022 16:38:35 +0900 Subject: [PATCH 13/16] Add NOT_SUPPORTED error description in the header Change-Id: I5f43440efbcf00e7ec6503a345b0a5a86b36f2c0 Signed-off-by: sooyeon --- include/vce.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/vce.h b/include/vce.h index ae54abc..1f4036e 100644 --- a/include/vce.h +++ b/include/vce.h @@ -813,6 +813,7 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); * @param[in] user_data The user data passed from set callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -837,6 +838,7 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -858,6 +860,7 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo * @param[in] user_data The user data passed from the start * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -882,6 +885,7 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -917,6 +921,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * @param[in] user_data The user data passed from set callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_PERMISSION_DENIED Permission denied * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OUT_OF_MEMORY Out of Memory @@ -970,6 +975,7 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun * @param[in] callback_func vce_nlu_base_info_requested event callback function * @return @c 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_NOT_SUPPORTED_FEATURE Not supported feature @@ -1014,6 +1020,7 @@ int vce_unset_specific_engine_request_cb(void); * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @retval #VCE_ERROR_INVALID_STATE Invalid state @@ -1032,6 +1039,7 @@ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void * * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful + * @retval #VCE_ERROR_NOT_SUPPORTED Not supported * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter * @retval #VCE_ERROR_OPERATION_FAILED Operation failure * @see vce_set_commands_cb() -- 2.7.4 From 5d48a2d5b90da07a0e63dc202b4a297ccd585b82 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Fri, 30 Sep 2022 11:02:36 +0900 Subject: [PATCH 14/16] Fix coverity issues Change-Id: Ica79c8c2c2804e9f11e45480914726085637eff7 Signed-off-by: sooyeon --- server/vcd_tidl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index e142039..08060ca 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -1905,6 +1905,8 @@ int vcdc_send_error_signal_to_app(int pid, int reason, char *err_msg) rpc_port_stub_vcd_stub_vc_notify_cb_invoke(info->notify_cb, pid, msg); + bundle_free(msg); + return VCD_ERROR_NONE; } @@ -2471,6 +2473,7 @@ int vcdc_send_feedback_streaming_to_manager(int manager_pid, int pid, int utt_id rpc_port_stub_vcd_mgr_stub_array_char_create(&streaming_data); if (NULL == streaming_data) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to create data handle"); + bundle_free(msg); return VCD_ERROR_OUT_OF_MEMORY; } -- 2.7.4 From 9eca186bb3fbbea45cd732ab9044ac1852c7312c Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 4 Oct 2022 21:00:37 +0900 Subject: [PATCH 15/16] Check if tidl_info is NULL before use when vc mgr app is terminated Change-Id: I43a3c753eabb0ccb308545c47fbe3beaf0fc8114 --- client/vc_mgr_tidl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index 9757e1e..02b6f81 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -384,8 +384,10 @@ static void __vcd_mgr_create_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h cont static void __vcd_mgr_terminate_cb(rpc_port_stub_vc_mgr_stub_vcd_mgr_context_h context, void *user_data) { - g_stub_tidl_info->connected = false; - g_stub_tidl_info->register_callback_requesting = false; + if (NULL != g_stub_tidl_info) { + g_stub_tidl_info->connected = false; + g_stub_tidl_info->register_callback_requesting = false; + } rpc_port_stub_vc_mgr_stub_vcd_mgr_context_set_tag(context, NULL); -- 2.7.4 From f0a2a9a35265b37a9e02e9c6363d63fcf4fac40b Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 5 Oct 2022 09:46:53 +0900 Subject: [PATCH 16/16] Update version to 1.70.7 Change-Id: I1f90e77141b0d188275521e2f66c466bfbd78a66 --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 6639667..68b734a 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.70.6 +Version: 1.70.7 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4