From ae4e8885a5d8a5b3e372092eb5b40349c7cee250 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Mon, 28 Aug 2023 20:23:39 +0900 Subject: [PATCH] Connect to widget client from server by on-demand - Issue: By the change of IPC to TIDL, app can receive unknown app launch request. - Solution: This patch postpones the server-to-client connection. TIDL does not support bi-directional call, so voice control widget client has stub implementation for receiving some special message from the server. However, this implementation causes unknown app launch requests for connection. Through this change, server will not connect to client immediately when the client requests to connect. It will try to connect when it actually needs to send some message to client. Change-Id: Ie3f13e0a58d80a973715c4c86e71ffa14722de3e Signed-off-by: Suyeon Hwang --- server/vcd_tidl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index bef79d8..22dcb6f 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -108,14 +108,18 @@ static void __request_tidl_connect(vcd_client_type_e type, int pid) return; } - if (widget_tidl_info->connection_requesting) { + if (widget_tidl_info->connected) { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] widget is already connected"); return; } - ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_connect(widget_tidl_info->rpc_h); + if (widget_tidl_info->connection_requesting) { + return; + } + ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_connect_sync(widget_tidl_info->rpc_h); if (0 == ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); widget_tidl_info->connection_requesting = true; } type_str = "widget"; @@ -1541,8 +1545,6 @@ static void __vc_widget_register_cb_cb(rpc_port_stub_vcd_widget_stub_vc_widget_ pthread_mutex_unlock(&g_widget_tidl_info_mutex); - __request_tidl_connect(VCD_CLIENT_TYPE_WIDGET, pid); - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC WIDGET REGISTER CALLBACK DONE"); } @@ -2722,12 +2724,14 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send asr result"); widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid); - if (NULL == widget_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info"); return VC_ERROR_OPERATION_FAILED; } + // FIXME: This is temproray fix for avoiding app launch in client side. + __request_tidl_connect(VCD_CLIENT_TYPE_WIDGET, pid); + if (!widget_tidl_info->connected) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected"); return VC_ERROR_OPERATION_FAILED; -- 2.7.4