From 42564dcb38fd1beb1656b5b4be71b3b1a03787e5 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 18 Jan 2019 10:44:32 +0900 Subject: [PATCH 01/16] Remove vc-config in RW when xmlParseFile is failed Change-Id: Ib3c3b3d58c5bfa05936525091a3b345051f63990 Signed-off-by: sooyeon.kim (cherry picked from commit 55868619bb9c5903b61707c52a0586e604fe16aa) --- common/vc_config_parser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/vc_config_parser.c b/common/vc_config_parser.c index a862549..4c991f3 100644 --- a/common/vc_config_parser.c +++ b/common/vc_config_parser.c @@ -322,6 +322,9 @@ int vc_parser_load_config(vc_config_s** config_info) if (VC_RETRY_COUNT == retry_count) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG); + SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Remove the file"); + remove(VC_CONFIG); + doc = xmlParseFile(VC_DEFAULT_CONFIG); if (NULL == doc) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_DEFAULT_CONFIG); -- 2.7.4 From 65b4188e1f60b56c7bdf9549de9f64566c4d3698 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 16 Jan 2019 20:57:27 +0900 Subject: [PATCH 02/16] Add managing prepare thread Change-Id: Ibc4aacb3b0982c5c15b1f18f3f22b39ddcda64ff Signed-off-by: sooyeon.kim (cherry picked from commit f582749f23e386815bd15d2c51e16de0c286364e) --- client/vc_mgr.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 1d0974f..b65a48f 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -71,6 +71,8 @@ static vc_audio_channel_e g_feedback_audio_channel = 0; static vc_audio_type_e g_feedback_audio_type = 0; static Ecore_Thread* g_feedback_thread = NULL; +static Ecore_Thread* g_mgr_thread = NULL; + static Eina_Bool __vc_mgr_notify_state_changed(void *data); static void __vc_mgr_notify_error(void *data); static Eina_Bool __vc_mgr_notify_result(void *data); @@ -530,6 +532,7 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) static void __end_prepare_thread(void *data, Ecore_Thread *thread) { SLOG(LOG_INFO, TAG_VCM, "@@@ End prepare thread"); + g_mgr_thread = NULL; } int vc_mgr_prepare(void) @@ -559,9 +562,13 @@ int vc_mgr_prepare(void) return VC_ERROR_INVALID_STATE; } - ecore_thread_main_loop_begin(); - ecore_thread_run(__start_prepare_thread, __end_prepare_thread, NULL, NULL); - ecore_thread_main_loop_end(); + bool is_exist = ecore_thread_check(g_mgr_thread); + if (NULL == g_mgr_thread || TRUE == is_exist) { + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Create a new thread for preparation"); + ecore_thread_main_loop_begin(); + g_mgr_thread = ecore_thread_run(__start_prepare_thread, __end_prepare_thread, NULL, NULL); + ecore_thread_main_loop_end(); + } SLOG(LOG_DEBUG, TAG_VCM, "@@@"); @@ -4210,8 +4217,8 @@ int vc_mgr_start_feedback(void) } #if 1 - bool is_canceled = ecore_thread_check(g_feedback_thread); - if (NULL == g_feedback_thread || TRUE == is_canceled) { + bool is_exist = ecore_thread_check(g_feedback_thread); + if (NULL == g_feedback_thread || TRUE == is_exist) { SLOG(LOG_INFO, TAG_VCM, "[INFO] ecore thread run : __tts_feedback_thread"); g_feedback_thread = ecore_thread_run(__tts_feedback_thread, __end_tts_feedback_thread, NULL, NULL); } -- 2.7.4 From 160074bac82b9e2d491512912f577b27f820a5ee Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 14 Jan 2019 20:47:13 +0900 Subject: [PATCH 03/16] Update description for vc_cmd_list_filter_by_type Change-Id: Ib4af0d2d469e1146e013f5aebcf31417e7ece968 Signed-off-by: Wonnam Jang (cherry picked from commit c2b7b3e92bb384fdf495f9de317c5116216c47d0) --- include/voice_control_command_expand.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h index d8d02c3..ca353e7 100755 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -101,22 +101,19 @@ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain); int vc_cmd_list_remove_all(vc_cmd_list_h vc_cmd_list, bool free_command); /** -* @brief Retrieves all commands of command list using callback function. +* @brief Gets the commands list which consists of specific type of commands such as foreground or background. * @since_tizen 3.0 -* -* @param[in] vc_cmd_list The command list handle -* @param[in] callback Callback function to invoke -* @param[in] user_data The user data to be passed to the callback function -* -* @return 0 on success, otherwise a negative error value +* @privilege %http://tizen.org/privilege/recorder +* @param[in] original The original command list handle +* @param[in] type The command type wants to get +* @param[out] filtered The filtered command list handle +* @return @c 0 on success, +* otherwise a negative error value * @retval #VC_ERROR_NONE Successful * @retval #VC_ERROR_INVALID_PARAMETER Invalid parameter +* @retval #VC_ERROR_OPERATION_FAILED Operation failure * @retval #VC_ERROR_PERMISSION_DENIED Permission denied * @retval #VC_ERROR_NOT_SUPPORTED Not supported -* -* @post This function invokes vc_cmd_list_cb() repeatedly for getting commands. -* -* @see vc_cmd_list_cb() */ int vc_cmd_list_filter_by_type(vc_cmd_list_h original, int type, vc_cmd_list_h* filtered); -- 2.7.4 From 721403c20282af9330a71b761cc7fdbae6a514fb Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 14 Jan 2019 21:26:25 +0900 Subject: [PATCH 04/16] Fix memory leak due to sending dbus when no reply Change-Id: I327b07a1e3a658221ccc0bb33ca3512c5657e561 Signed-off-by: Wonnam Jang (cherry picked from commit 81c5fa0c165ddd329b5d1f90c7a81d7304ccc3b5) --- client/vc_dbus.c | 3 ++ client/vc_mgr_dbus.c | 28 ++++--------- client/vc_widget_dbus.c | 18 +-------- server/vcd_dbus_server.c | 101 +++-------------------------------------------- 4 files changed, 19 insertions(+), 131 deletions(-) diff --git a/client/vc_dbus.c b/client/vc_dbus.c index ebdce04..5ea2841 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -854,6 +854,7 @@ int vc_dbus_set_foreground(int pid, bool value) if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + dbus_message_unref(msg); return VC_ERROR_OPERATION_FAILED; } @@ -882,6 +883,7 @@ int vc_dbus_set_foreground(int pid, bool value) if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + dbus_message_unref(msg); return VC_ERROR_OPERATION_FAILED; } @@ -1001,6 +1003,7 @@ int vc_dbus_request_dialog(int pid, const char* disp_text, const char* utt_text, if (1 != dbus_connection_send(g_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCC, "[Dbus ERROR] Fail to Send"); //LCOV_EXCL_LINE + dbus_message_unref(msg); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "[Dbus DEBUG] Success to Send"); diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 68b78f2..195d2c7 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -268,7 +268,7 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd SLOG(LOG_DEBUG, TAG_VCM, "@@@"); - } /* VCD_MANAGER_METHOD_ALL_RESULT */ + } /* VCD_MANAGER_METHOD_DIALOG */ else if (dbus_message_is_signal(msg, if_name, VCD_MANAGER_METHOD_ERROR)) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get Error"); @@ -304,7 +304,6 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd else if (dbus_message_is_method_call(msg, if_name, VCD_MANAGER_METHOD_SET_PRIVATE_DATA)) { SLOG(LOG_DEBUG, TAG_VCM, "@@@ Get request set private data"); int pid = 0; - int ret = -1; char* key = NULL; char* private_data = NULL; @@ -321,28 +320,11 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd if (pid > 0) { SLOG(LOG_DEBUG, TAG_VCM, "@@ vc mgr get request set private data : pid(%d) ", pid); - ret = __vc_mgr_cb_private_data_set(key, private_data); + __vc_mgr_cb_private_data_set(key, private_data); } else { SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get request set private data : invalid pid "); } - DBusMessage *reply = NULL; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (!dbus_connection_send(g_m_conn_listener, reply, NULL)) - SLOG(LOG_ERROR, TAG_VCM, "@@ vc get request set private data : fail to send reply"); - else - SLOG(LOG_DEBUG, TAG_VCM, "@@ vc get request set private data : result(%d)", ret); - - dbus_connection_flush(g_m_conn_listener); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr get request set private data : fail to create reply message"); - } - SLOG(LOG_DEBUG, TAG_VCM, "@@@"); } /* VCD_MANAGER_METHOD_SET_PRIVATE_DATA */ @@ -1814,11 +1796,13 @@ int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send if (1 != dbus_connection_send(g_m_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCM, "[Dbus ERROR] Fail to Send"); + dbus_message_unref(msg); return -1; } else { SLOG(LOG_DEBUG, TAG_VCM, "[Dbus] SUCCESS Send"); dbus_connection_flush(g_m_conn_sender); } + dbus_message_unref(msg); return 0; } @@ -2383,11 +2367,13 @@ int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, if (1 != dbus_connection_send(g_m_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCM, "[Dbus ERROR] Fail to Send"); + dbus_message_unref(msg); return -1; } else { SLOG(LOG_DEBUG, TAG_VCM, "[Dbus] SUCCESS Send"); dbus_connection_flush(g_m_conn_sender); } + dbus_message_unref(msg); return 0; } @@ -2417,11 +2403,13 @@ int vc_mgr_dbus_send_utterance_status(int pid, int utt_id, int utt_status) if (1 != dbus_connection_send(g_m_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCM, "[Dbus ERROR] Fail to Send"); + dbus_message_unref(msg); return -1; } else { SLOG(LOG_DEBUG, TAG_VCM, "[Dbus] SUCCESS Send"); dbus_connection_flush(g_m_conn_sender); } + dbus_message_unref(msg); return 0; } diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 4cd4b9d..52bee5e 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -149,22 +149,6 @@ static Eina_Bool widget_listener_event_callback(void* data, Ecore_Fd_Handler *fd __vc_widget_cb_result(); - /* - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - if (!dbus_connection_send(g_w_conn_listener, reply, NULL)) - SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get result : fail to send reply"); - else - SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget get result"); - - dbus_connection_flush(g_w_conn_listener); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget get result : fail to create reply message"); - - */ - SLOG(LOG_DEBUG, TAG_VCW, "@@@"); } /* VCD_WIDGET_METHOD_RESULT */ @@ -781,6 +765,7 @@ int vc_widget_dbus_set_foreground(int pid, bool value) if (1 != dbus_connection_send(g_w_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCW, "[Dbus ERROR] Fail to Send"); + dbus_message_unref(msg); return VC_ERROR_OPERATION_FAILED; } @@ -809,6 +794,7 @@ int vc_widget_dbus_set_foreground(int pid, bool value) if (1 != dbus_connection_send(g_w_conn_sender, msg, NULL)) { SLOG(LOG_ERROR, TAG_VCW, "[Dbus ERROR] Fail to Send"); + dbus_message_unref(msg); return VC_ERROR_OPERATION_FAILED; } diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c index 2739c5b..b1affc8 100644 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -535,28 +535,9 @@ int vcd_dbus_server_mgr_set_private_data(DBusConnection* conn, DBusMessage* msg) } else { SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr set domain : pid(%d), key(%s), data(%s)", pid, key, data); ret = vcd_server_mgr_set_private_data(pid, key, data); - } - - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (0 == ret) { - SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to set private data"); } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); - } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); } SLOG(LOG_DEBUG, TAG_VCD, "@@@"); @@ -750,28 +731,9 @@ int vcd_dbus_server_mgr_do_action(DBusConnection* conn, DBusMessage* msg) } else { SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd mgr request to do action : pid(%d), type(%d) send_event(%s)", pid, type, send_event); ret = vcd_server_mgr_do_action(pid, type, send_event); - } - - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (0 == ret) { - SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to do action"); } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); - } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); } SLOG(LOG_DEBUG, TAG_VCD, "@@@"); @@ -1054,34 +1016,6 @@ int vcd_dbus_server_mgr_result_selection(DBusConnection* conn, DBusMessage* msg) vcd_server_mgr_result_select(); } return 0; - - /* - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (0 == ret) { - SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); - } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); - } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "@@@"); - - return 0; - */ } /* for TTS feedback */ @@ -1659,34 +1593,11 @@ int vcd_dbus_server_dialog(DBusConnection* conn, DBusMessage* msg) } else { SLOG(LOG_DEBUG, TAG_VCD, "[IN] vcd dialog : pid(%d), disp_text(%s), utt_text(%s), continuous(%d)", pid, disp_text, utt_text, continuous); ret = vcd_server_dialog(pid, disp_text, utt_text, continuous); - } - - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - if (0 == ret) { - /* Append result and language */ - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - SLOG(LOG_DEBUG, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); - } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to dialog"); } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); } - SLOG(LOG_DEBUG, TAG_VCD, "@@@"); return 0; -- 2.7.4 From a78655af7e01fd88ccd5b29ad58ea755981ede9b Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Mon, 11 Feb 2019 19:29:42 +0900 Subject: [PATCH 05/16] Fix memory leak Change-Id: I4b4c64a72c9ff5c2f12390ccb135984f9c9f6f9e Signed-off-by: Wonnam Jang --- server/vcd_client_data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 2944216..ac1bee7 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -62,6 +62,8 @@ int vcd_client_manager_set(int pid) if (-1 != g_manager.pid && NULL != g_manager.appid && 0 == strncmp(g_manager.appid, appid, strlen(g_manager.appid))) { SLOG(LOG_WARN, TAG_VCD, "Same manager has already registered. It doesn't need to set manager again."); + if (appid) + free(appid); return 0; } -- 2.7.4 From 025197c2bd58336a3be24fefe01cfae3923c320c Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 21 Feb 2019 16:10:17 +0900 Subject: [PATCH 06/16] Remove far field package Change-Id: I1e5c4aaa5bf5151e50cc2bdadaef6d8474e8f79c Signed-off-by: Wonnam Jang --- CMakeLists.txt | 3 ++- packaging/voice-control.spec | 2 +- server/vcd_recorder.c | 11 ++++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffeca96..7a6f5ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,8 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi +#farfield-voice-api ) ELSE() pkg_check_modules(pkgs REQUIRED diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 1115948..5eeb57e 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -36,7 +36,7 @@ BuildRequires: pkgconfig(pkgmgr-installer) BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(capi-network-bluetooth-tv) BuildRequires: pkgconfig(msfapi) -BuildRequires: pkgconfig(farfield-voice-api) +#BuildRequires: pkgconfig(farfield-voice-api) %endif BuildRequires: pkgconfig(vconf) BuildRequires: cmake diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index d1c3329..8f69004 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -17,7 +17,7 @@ #ifdef TV_PRODUCT #define TV_BT_MODE #define TV_MSF_WIFI_MODE -#define TV_FFV_MODE +//#define TV_FFV_MODE #endif #include @@ -451,13 +451,11 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb #ifdef TV_FFV_MODE g_farfieldvoice_h = farfield_voice_init(); - if (NULL == g_farfieldvoice_h) - { + if (NULL == g_farfieldvoice_h) { SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to init farfield_voice_init"); } - if (g_farfieldvoice_h) - { + if (g_farfieldvoice_h) { farfield_voice_register_audio_cb(g_farfieldvoice_h, _ffv_audio_function_cb, NULL); } #endif @@ -534,8 +532,7 @@ int vcd_recorder_destroy() SLOG(LOG_ERROR, TAG_VCD, "[Recorder ERROR] Fail to audio in destroy, ret(%d)", ret); #ifdef TV_FFV_MODE - if (NULL != g_farfieldvoice_h) - { + if (NULL != g_farfieldvoice_h) { farfield_voice_unregister_audio_cb(g_farfieldvoice_h); farfield_voice_final(g_farfieldvoice_h); g_farfieldvoice_h = NULL; -- 2.7.4 From ea8e151a9398186798b7597552174fe6ddcae7c4 Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 28 Feb 2019 14:34:11 +0900 Subject: [PATCH 07/16] Add parameter to change system volume Change-Id: Ie19282c085c9ffb6a07b2a664cecbcff2b86b063 Signed-off-by: Wonnam Jang --- client/vc_mgr.c | 141 +++++++++++++++++++++++++++---- include/voice_control_manager_internal.h | 5 +- 2 files changed, 129 insertions(+), 17 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index b65a48f..76d7c12 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include "vc_cmd_db.h" #include "vc_config_mgr.h" @@ -65,6 +67,10 @@ static pthread_mutex_t g_cynara_mutex = PTHREAD_MUTEX_INITIALIZER; static bool g_err_callback_status = false; +/* for changing volume on each sound stream */ +static sound_stream_info_h g_stream_for_volume_h = NULL; +static virtual_sound_stream_h g_virtual_sound_stream_h = NULL; + /* for TTS feedback */ static int g_feedback_rate = 16000; static vc_audio_channel_e g_feedback_audio_channel = 0; @@ -4420,9 +4426,115 @@ int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e streaming_mode) return ret; } -int vc_mgr_change_system_volume() +int __vc_change_system_volume(vc_system_volume_event_e volume_event) { - SLOG(LOG_DEBUG, TAG_VCM, "[Manager] Change system volume"); + int stream_type = -1; + if (VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_FARFIELD == volume_event) { + stream_type = SOUND_STREAM_TYPE_VOICE_RECOGNITION; + } else if (VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_NEARFIELD == volume_event) { + stream_type = SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE; + } else { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] volume type is invalid, type(%d)", volume_event); + return VC_ERROR_INVALID_PARAMETER; + } + + SLOG(LOG_INFO, TAG_VCM, "[INFO] Change system volume, volume_type(%d)", volume_event); + + int ret = VC_ERROR_NONE; + if (g_stream_for_volume_h) { + SLOG(LOG_INFO, TAG_VCM, "[INFO] Stream is already created, destroy stream)"); + ret = sound_manager_destroy_stream_information(g_stream_for_volume_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy stream information, ret(%d)", ret); + } + g_stream_for_volume_h = NULL; + } + + ret = sound_manager_create_stream_information_internal(stream_type, NULL, NULL, &g_stream_for_volume_h); + if (0 != ret) { + SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Fail to create stream information, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + + if (g_virtual_sound_stream_h) { + SLOG(LOG_INFO, TAG_VCM, "[INFO] Virtual stream is already created, destroy virtual stream)"); + ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy virtual stream, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + g_virtual_sound_stream_h = NULL; + } + + ret = sound_manager_create_virtual_stream(g_stream_for_volume_h, &g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to create virtual stream, ret(%d)", ret); + ret = sound_manager_destroy_stream_information(g_stream_for_volume_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy stream information, ret(%d)", ret); + } + g_stream_for_volume_h = NULL; + return VC_ERROR_OPERATION_FAILED; + } + + ret = sound_manager_start_virtual_stream(g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to start virtual stream, ret(%d)", ret); + ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy virtual stream, ret(%d)", ret); + } + g_virtual_sound_stream_h = NULL; + + ret = sound_manager_destroy_stream_information(g_stream_for_volume_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy stream information, ret(%d)", ret); + } + g_stream_for_volume_h = NULL; + + return VC_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_INFO, TAG_VCM, "[SUCCESS] Change system volume"); + return 0; +} + +int __vc_recover_system_volume() +{ + SLOG(LOG_INFO, TAG_VCM, "[INFO] Recover system volume"); + + int ret = VC_ERROR_NONE; + + if (g_virtual_sound_stream_h) { + ret = sound_manager_stop_virtual_stream(g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to stop virtual stream, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy virtual stream, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + g_virtual_sound_stream_h = NULL; + } + + if (g_stream_for_volume_h) { + ret = sound_manager_destroy_stream_information(g_stream_for_volume_h); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to destroy stream information, ret(%d)", ret); + return VC_ERROR_OPERATION_FAILED; + } + g_stream_for_volume_h = NULL; + } + + SLOG(LOG_INFO, TAG_VCM, "[SUCCESS] Recover system volume"); + return 0; +} + +int vc_mgr_change_system_volume(vc_system_volume_event_e volume_event) +{ + SLOG(LOG_DEBUG, TAG_VCM, "[Manager] Change system volume, volume_event(%d)", volume_event); if (0 != __vc_mgr_get_feature_enabled()) { SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] not supported"); @@ -4441,18 +4553,18 @@ int vc_mgr_change_system_volume() } /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + if (state != VC_STATE_READY && state != VC_STATE_INITIALIZED) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY' and not 'INITIALIZED', state(%d)", state); SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return VC_ERROR_INVALID_STATE; } - /* send audio streaming */ - int ret = vc_mgr_dbus_change_system_volume(g_vc_m->handle, VC_SYSTEM_VOLUME_EVENT_CHANGE); + /* change system volume */ + int ret = __vc_change_system_volume(volume_event); if (0 != ret) { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry to change volume"); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to change volume"); } else { - SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to send"); + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to change volume"); } return ret; } @@ -4478,19 +4590,18 @@ int vc_mgr_recover_system_volume() } /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); + if (state != VC_STATE_READY && state != VC_STATE_INITIALIZED) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY' and not 'INITIALIZED', state(%d)", state); SLOG(LOG_DEBUG, TAG_VCM, "@@@"); return VC_ERROR_INVALID_STATE; } - /* send audio streaming */ - int ret = vc_mgr_dbus_change_system_volume(g_vc_m->handle, VC_SYSTEM_VOLUME_EVENT_RECOVER); + /* recover volume */ + int ret = __vc_recover_system_volume(); if (0 != ret) { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry to recover volume"); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to recover volume"); } else { - SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to send"); + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to recover volume"); } return ret; - } diff --git a/include/voice_control_manager_internal.h b/include/voice_control_manager_internal.h index e50011f..2a887ef 100644 --- a/include/voice_control_manager_internal.h +++ b/include/voice_control_manager_internal.h @@ -41,7 +41,8 @@ typedef enum { } vc_audio_streaming_mode_e; typedef enum { - VC_SYSTEM_VOLUME_EVENT_CHANGE, + VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_NEARFIELD, + VC_SYSTEM_VOLUME_EVENT_CHANGE_FOR_FARFIELD, VC_SYSTEM_VOLUME_EVENT_RECOVER } vc_system_volume_event_e; @@ -113,7 +114,7 @@ int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e streaming_mode); * @since_tizen 5.0 * */ -int vc_mgr_change_system_volume(); +int vc_mgr_change_system_volume(vc_system_volume_event_e volume_event); /** * @brief Recover system volume. -- 2.7.4 From 36964257dd641444f132067a7b60ab1431dc81ec Mon Sep 17 00:00:00 2001 From: Sooyeon Kim Date: Wed, 27 Mar 2019 11:26:24 +0000 Subject: [PATCH 08/16] Revert "Remove far field package" This reverts commit 025197c2bd58336a3be24fefe01cfae3923c320c. Change-Id: I38bb9b3df563d30c37ac96d46f691a5368418f52 --- CMakeLists.txt | 3 +-- packaging/voice-control.spec | 2 +- server/vcd_recorder.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a6f5ed..ffeca96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,8 +46,7 @@ INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland - capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi -#farfield-voice-api + capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api ) ELSE() pkg_check_modules(pkgs REQUIRED diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 5eeb57e..1115948 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -36,7 +36,7 @@ BuildRequires: pkgconfig(pkgmgr-installer) BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(capi-network-bluetooth-tv) BuildRequires: pkgconfig(msfapi) -#BuildRequires: pkgconfig(farfield-voice-api) +BuildRequires: pkgconfig(farfield-voice-api) %endif BuildRequires: pkgconfig(vconf) BuildRequires: cmake diff --git a/server/vcd_recorder.c b/server/vcd_recorder.c index 8f69004..7a85e9a 100644 --- a/server/vcd_recorder.c +++ b/server/vcd_recorder.c @@ -17,7 +17,7 @@ #ifdef TV_PRODUCT #define TV_BT_MODE #define TV_MSF_WIFI_MODE -//#define TV_FFV_MODE +#define TV_FFV_MODE #endif #include @@ -226,6 +226,16 @@ static void _bt_hid_audio_data_receive_cb(bt_hid_voice_data_s *voice_data, void #ifdef TV_FFV_MODE static void _ffv_audio_function_cb(void* data, unsigned int length, void* user_data) { + if (0 == g_buffer_count || 0 == g_buffer_count % 50) { + SLOG(LOG_INFO, TAG_VCD, "[Recorder INFO] farfield audio function callback is invoked"); + + if (100000 == g_buffer_count) { + g_buffer_count = 0; + } + } + + g_buffer_count++; + if (0 != strncmp(g_current_audio_type, VCE_AUDIO_ID_FFV, sizeof(VCE_AUDIO_ID_FFV))) { vcd_state_e state = vcd_config_get_service_state(); if (VCD_STATE_READY == state) { @@ -456,6 +466,7 @@ int vcd_recorder_create(vcd_recoder_audio_cb audio_cb, vcd_recorder_interrupt_cb } if (g_farfieldvoice_h) { + SLOG(LOG_INFO, TAG_VCD, "[Recorder INFO] Register farfield voice audio callback"); farfield_voice_register_audio_cb(g_farfieldvoice_h, _ffv_audio_function_cb, NULL); } #endif @@ -533,6 +544,7 @@ int vcd_recorder_destroy() #ifdef TV_FFV_MODE if (NULL != g_farfieldvoice_h) { + SLOG(LOG_INFO, TAG_VCD, "[Recorder INFO] Unregister farfield voice"); farfield_voice_unregister_audio_cb(g_farfieldvoice_h); farfield_voice_final(g_farfieldvoice_h); g_farfieldvoice_h = NULL; -- 2.7.4 From 3c1fd38a789bc80615d46a52f575b2597a2249f3 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Tue, 16 Apr 2019 17:13:55 +0900 Subject: [PATCH 09/16] Check null before add match if dbus was closed or not Change-Id: I61726c900d2638ebc330a97643e3afe16276ab15 Signed-off-by: wn.jang --- client/vc_dbus.c | 41 ++++++++++++++++++++++++++++++++++++++--- client/vc_mgr_dbus.c | 46 +++++++++++++++++++++++++++++++++++++++++----- client/vc_widget_dbus.c | 21 ++++++++++++++++++++- 3 files changed, 99 insertions(+), 9 deletions(-) diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 5ea2841..996a188 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -18,8 +18,10 @@ #include "vc_dbus.h" #include "vc_main.h" +static pthread_mutex_t g_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_waiting_time = 3000; +static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_fd_handler = NULL; @@ -243,8 +245,11 @@ static void __vc_dbus_connection_free() int vc_dbus_open_connection() { + pthread_mutex_lock(&g_dbus_mutex); + if (NULL != g_conn_sender && NULL != g_conn_listener) { SLOG(LOG_WARN, TAG_VCC, "already existed connection "); //LCOV_EXCL_LINE + pthread_mutex_unlock(&g_dbus_mutex); return 0; } @@ -264,6 +269,7 @@ int vc_dbus_open_connection() if (NULL == g_conn_sender) { SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); //LCOV_EXCL_LINE + pthread_mutex_unlock(&g_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -279,6 +285,7 @@ int vc_dbus_open_connection() if (NULL == g_conn_listener) { SLOG(LOG_ERROR, TAG_VCC, "Fail to get dbus connection "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); + pthread_mutex_unlock(&g_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -303,13 +310,15 @@ int vc_dbus_open_connection() if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { SLOG(LOG_ERROR, TAG_VCC, "fail dbus_bus_request_name()"); //LCOV_EXCL_LINE __vc_dbus_connection_free(); - return -2; + pthread_mutex_unlock(&g_dbus_mutex); + return VC_ERROR_OPERATION_FAILED; } if (NULL != g_fd_handler) { SLOG(LOG_WARN, TAG_VCC, "The handler already exists."); //LCOV_EXCL_LINE __vc_dbus_connection_free(); - return 0; + pthread_mutex_unlock(&g_dbus_mutex); + return VC_ERROR_NONE; } char rule[256] = {0, }; @@ -322,6 +331,7 @@ int vc_dbus_open_connection() SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); __vc_dbus_connection_free(); + pthread_mutex_unlock(&g_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -329,6 +339,7 @@ int vc_dbus_open_connection() if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { SLOG(LOG_ERROR, TAG_VCC, "fail to get fd from dbus "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); + pthread_mutex_unlock(&g_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCC, "Get fd from dbus : %d", fd); @@ -338,14 +349,23 @@ int vc_dbus_open_connection() if (NULL == g_fd_handler) { SLOG(LOG_ERROR, TAG_VCC, "fail to get fd handler from ecore "); //LCOV_EXCL_LINE __vc_dbus_connection_free(); + pthread_mutex_unlock(&g_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } - return 0; + g_is_connection_opened = true; + + pthread_mutex_unlock(&g_dbus_mutex); + + SLOG(LOG_INFO, TAG_VCC, "[INFO] vc client dbus connection is opened"); + + return VC_ERROR_NONE; } int vc_dbus_close_connection() { + pthread_mutex_lock(&g_dbus_mutex); + DBusError err; dbus_error_init(&err); @@ -371,6 +391,12 @@ int vc_dbus_close_connection() __vc_dbus_connection_free(); + g_is_connection_opened = false; + + pthread_mutex_unlock(&g_dbus_mutex); + + SLOG(LOG_INFO, TAG_VCC, "[INFO] vc client dbus connection is closed"); + return 0; } @@ -527,6 +553,15 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d /* add a rule for daemon error */ char rule[256] = {0, }; snprintf(rule, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE); + if (NULL == g_conn_listener) { + if (g_is_connection_opened) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] g_conn_listener is NULL abnormally"); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCC, "[INFO] g_conn_listener is NULL and DBUS connection was closed"); + return VC_ERROR_NONE; + } + } dbus_bus_add_match(g_conn_listener, rule, &err); if (dbus_error_is_set(&err)) { diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 195d2c7..8a6eff3 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -21,7 +21,10 @@ #include "vc_command.h" +static pthread_mutex_t g_m_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; + static int g_m_waiting_time = 3000; +static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_m_fd_handler = NULL; @@ -646,9 +649,12 @@ static void __vc_mgr_dbus_connection_free() int vc_mgr_dbus_open_connection() { + pthread_mutex_lock(&g_m_dbus_mutex); + if (NULL != g_m_conn_sender && NULL != g_m_conn_listener) { SLOG(LOG_WARN, TAG_VCM, "already existed connection "); - return 0; + pthread_mutex_unlock(&g_m_dbus_mutex); + return VC_ERROR_NONE; } DBusError err; @@ -667,6 +673,7 @@ int vc_mgr_dbus_open_connection() if (NULL == g_m_conn_sender) { SLOG(LOG_ERROR, TAG_VCM, "Fail to get dbus connection "); + pthread_mutex_unlock(&g_m_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -683,6 +690,7 @@ int vc_mgr_dbus_open_connection() if (NULL == g_m_conn_listener) { SLOG(LOG_ERROR, TAG_VCM, "Fail to get dbus connection "); __vc_mgr_dbus_connection_free(); + pthread_mutex_unlock(&g_m_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -701,13 +709,15 @@ int vc_mgr_dbus_open_connection() if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) { SLOG(LOG_ERROR, TAG_VCM, "fail dbus_bus_request_name()"); __vc_mgr_dbus_connection_free(); - return -2; + pthread_mutex_unlock(&g_m_dbus_mutex); + return VC_ERROR_OPERATION_FAILED; } if (NULL != g_m_fd_handler) { SLOG(LOG_WARN, TAG_VCM, "The handler already exists."); __vc_mgr_dbus_connection_free(); - return 0; + pthread_mutex_unlock(&g_m_dbus_mutex); + return VC_ERROR_NONE; } char rule[128] = {0, }; @@ -720,6 +730,7 @@ int vc_mgr_dbus_open_connection() SLOG(LOG_ERROR, TAG_VCM, "Match Error (%s)", err.message); dbus_error_free(&err); __vc_mgr_dbus_connection_free(); + pthread_mutex_unlock(&g_m_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -727,6 +738,7 @@ int vc_mgr_dbus_open_connection() if (1 != dbus_connection_get_unix_fd(g_m_conn_listener, &fd)) { SLOG(LOG_ERROR, TAG_VCM, "fail to get fd from dbus "); __vc_mgr_dbus_connection_free(); + pthread_mutex_unlock(&g_m_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCM, "Get fd from dbus : %d", fd); @@ -737,14 +749,23 @@ int vc_mgr_dbus_open_connection() if (NULL == g_m_fd_handler) { SLOG(LOG_ERROR, TAG_VCM, "fail to get fd handler from ecore "); __vc_mgr_dbus_connection_free(); + pthread_mutex_unlock(&g_m_dbus_mutex); return VC_ERROR_OPERATION_FAILED; } - return 0; + g_is_connection_opened = true; + + pthread_mutex_unlock(&g_m_dbus_mutex); + + SLOG(LOG_INFO, TAG_VCM, "[INFO] manager dbus connection is opened"); + + return VC_ERROR_NONE; } int vc_mgr_dbus_close_connection() { + pthread_mutex_lock(&g_m_dbus_mutex); + DBusError err; dbus_error_init(&err); @@ -770,7 +791,13 @@ int vc_mgr_dbus_close_connection() __vc_mgr_dbus_connection_free(); - return 0; + g_is_connection_opened = false; + + pthread_mutex_unlock(&g_m_dbus_mutex); + + SLOG(LOG_INFO, TAG_VCM, "[INFO] manager dbus connection is closed"); + + return VC_ERROR_NONE; } int vc_mgr_dbus_reconnect() @@ -969,6 +996,15 @@ int vc_mgr_dbus_request_initialize(int pid, int audio_streaming_mode, int* servi /* add a rule for daemon error */ char rule_err[256] = {0, }; snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE); + if (NULL == g_m_conn_listener) { + if (g_is_connection_opened) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] g_m_conn_listener is NULL abnormally"); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCM, "[INFO] g_m_conn_listener is NULL and DBUS connection was closed"); + return VC_ERROR_NONE; + } + } dbus_bus_add_match(g_m_conn_listener, rule_err, &err); if (dbus_error_is_set(&err)) { diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 52bee5e..adc05f5 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -25,6 +25,7 @@ static pthread_mutex_t g_w_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_w_waiting_time = 3000; +static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_w_fd_handler = NULL; @@ -279,7 +280,7 @@ int vc_widget_dbus_open_connection() if (NULL != g_w_conn_sender && NULL != g_w_conn_listener) { SLOG(LOG_WARN, TAG_VCW, "Already existed connection "); pthread_mutex_unlock(&g_w_dbus_mutex); - return 0; + return VC_ERROR_NONE; } DBusError err; @@ -383,7 +384,12 @@ int vc_widget_dbus_open_connection() return VC_ERROR_OPERATION_FAILED; } + g_is_connection_opened = true; + pthread_mutex_unlock(&g_w_dbus_mutex); + + SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is opened"); + return 0; } @@ -416,8 +422,12 @@ int vc_widget_dbus_close_connection() __vc_widget_dbus_connection_free(); + g_is_connection_opened = false; + pthread_mutex_unlock(&g_w_dbus_mutex); + SLOG(LOG_INFO, TAG_VCW, "[INFO] widget dbus connection is closed"); + return 0; } @@ -572,6 +582,15 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p /* add a rule for daemon error */ char rule_err[256] = {0, }; snprintf(rule_err, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE); + if (NULL == g_w_conn_listener) { + if (g_is_connection_opened) { + SLOG(LOG_ERROR, TAG_VCW, "[ERROR] g_w_conn_listener is NULL abnormally"); + return VC_ERROR_OPERATION_FAILED; + } else { + SLOG(LOG_INFO, TAG_VCW, "[INFO] g_w_conn_listener is NULL and DBUS connection was closed"); + return VC_ERROR_NONE; + } + } dbus_bus_add_match(g_w_conn_listener, rule_err, &err); if (dbus_error_is_set(&err)) { -- 2.7.4 From f2d13483e021b5d581812acac90487d57dcb15f1 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 24 Apr 2019 20:19:20 +0900 Subject: [PATCH 10/16] Add debug code for unhandled dbus message Change-Id: I0c045bc1dddf287a69c78d211bbd5ba3e0b851fc Signed-off-by: wn.jang --- client/vc.c | 7 ------- client/vc_dbus.c | 10 +++++++++- client/vc_mgr_dbus.c | 8 +++++++- client/vc_widget_dbus.c | 8 +++++++- server/vcd_dbus.c | 8 +++++++- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/client/vc.c b/client/vc.c index cc75683..b75d098 100644 --- a/client/vc.c +++ b/client/vc.c @@ -475,11 +475,6 @@ int vc_deinitialize(void) static Eina_Bool __vc_connect_daemon(void *data) { - /* Send hello */ - if (0 != vc_dbus_request_hello()) { - return EINA_TRUE; - } - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Connect daemon"); /* request initialization */ @@ -505,7 +500,6 @@ static Eina_Bool __vc_connect_daemon(void *data) vc_client_set_error(g_vc, VC_ERROR_ENGINE_NOT_FOUND); ecore_main_loop_thread_safe_call_async(__vc_notify_error, (void*)g_vc); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return EINA_FALSE; //LCOV_EXCL_STOP } else if (0 != ret) { @@ -514,7 +508,6 @@ static Eina_Bool __vc_connect_daemon(void *data) vc_client_set_error(g_vc, VC_ERROR_TIMED_OUT); ecore_main_loop_thread_safe_call_async(__vc_notify_error, (void*)g_vc); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); return EINA_TRUE; } else { /* Success to connect */ diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 996a188..5b7e47d 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -216,7 +216,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle } /* NameOwnerChanged */ else { - SLOG(LOG_DEBUG, TAG_VCC, "Message is NOT valid"); + const char* sender = dbus_message_get_sender(msg); + const char* destination = dbus_message_get_destination(msg); + const char* path = dbus_message_get_path(msg); + const char* interf = dbus_message_get_interface(msg); + const char* member = dbus_message_get_member(msg); + int type = dbus_message_get_type(msg); + SLOG(LOG_ERROR, TAG_VCC, "[INFO] Message is NOT valid, sender(%s), destination(%s), path(%s), interface(%s), member(%s), type(%d)", sender, destination, path, interf, member, type); dbus_message_unref(msg); break; } @@ -448,6 +454,8 @@ int vc_dbus_request_hello() return VC_ERROR_OPERATION_FAILED; } + SLOG(LOG_DEBUG, TAG_VCC, "[DBUS] Request vc hello"); //LCOV_EXCL_LINE + DBusMessage* msg; msg = dbus_message_new_method_call( diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 8a6eff3..3e334b6 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -621,7 +621,13 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd } /* NameOwnerChanged */ else { - SLOG(LOG_INFO, TAG_VCM, "Message is NOT valid"); + const char* sender = dbus_message_get_sender(msg); + const char* destination = dbus_message_get_destination(msg); + const char* path = dbus_message_get_path(msg); + const char* interf = dbus_message_get_interface(msg); + const char* member = dbus_message_get_member(msg); + int type = dbus_message_get_type(msg); + SLOG(LOG_ERROR, TAG_VCM, "[INFO] Message is NOT valid, sender(%s), destination(%s), path(%s), interface(%s), member(%s), type(%d)", sender, destination, path, interf, member, type); dbus_message_unref(msg); break; } diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index adc05f5..6660c42 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -247,7 +247,13 @@ static Eina_Bool widget_listener_event_callback(void* data, Ecore_Fd_Handler *fd } /* NameOwnerChanged */ else { - SLOG(LOG_ERROR, TAG_VCW, "Message is NOT valid"); + const char* sender = dbus_message_get_sender(msg); + const char* destination = dbus_message_get_destination(msg); + const char* path = dbus_message_get_path(msg); + const char* interf = dbus_message_get_interface(msg); + const char* member = dbus_message_get_member(msg); + int type = dbus_message_get_type(msg); + SLOG(LOG_ERROR, TAG_VCW, "[INFO] Message is NOT valid, sender(%s), destination(%s), path(%s), interface(%s), member(%s), type(%d)", sender, destination, path, interf, member, type); dbus_message_unref(msg); break; } diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 4c9fde0..b77b19c 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -1229,7 +1229,13 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle vcd_dbus_server_get_tts_audio_format(g_conn_listener, msg); else { - SLOG(LOG_DEBUG, TAG_VCD, "Message is NOT valid"); + const char* sender = dbus_message_get_sender(msg); + const char* destination = dbus_message_get_destination(msg); + const char* path = dbus_message_get_path(msg); + const char* interf = dbus_message_get_interface(msg); + const char* member = dbus_message_get_member(msg); + int type = dbus_message_get_type(msg); + SLOG(LOG_ERROR, TAG_VCD, "[INFO] Message is NOT valid, sender(%s), destination(%s), path(%s), interface(%s), member(%s), type(%d)", sender, destination, path, interf, member, type); dbus_message_unref(msg); break; } -- 2.7.4 From 4116e4a6f2af32aee87247e79ae036fc42974d8d Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Wed, 8 May 2019 15:17:59 +0900 Subject: [PATCH 11/16] Added mutex lock for widget Change-Id: I5dc841cc223c5ff3c20b7d153316f856bd30bf52 Signed-off-by: sungrae jo --- client/vc_widget.c | 13 +++++++++++++ client/vc_widget_dbus.c | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/client/vc_widget.c b/client/vc_widget.c index c3e634c..fafdda2 100644 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -39,6 +39,8 @@ static Ecore_Timer* g_w_start_timer = NULL; static Ecore_Timer* g_w_notify_state_timer = NULL; static Ecore_Timer* g_w_notify_result_timer = NULL; +static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; + static Ecore_Thread* g_w_prepare_thread = NULL; static int g_w_prepare_canceled = 0; @@ -171,8 +173,10 @@ int vc_widget_initialize(vc_h* vc_w) } } + pthread_mutex_lock(&g_w_init_mutex); if (0 != vc_widget_client_create(vc_w)) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to create client!!!!!"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OUT_OF_MEMORY; } @@ -182,6 +186,7 @@ int vc_widget_initialize(vc_h* vc_w) SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to init config manager : %s", __vc_widget_get_error_code(__vc_widget_convert_config_error_code(ret))); vc_widget_client_destroy((*vc_w)); + pthread_mutex_unlock(&g_w_init_mutex); return __vc_widget_convert_config_error_code(ret); } @@ -190,6 +195,7 @@ int vc_widget_initialize(vc_h* vc_w) SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set config changed : %d", ret); vc_config_mgr_finalize((*vc_w)->handle); vc_widget_client_destroy((*vc_w)); + pthread_mutex_unlock(&g_w_init_mutex); return __vc_widget_convert_config_error_code(ret); } @@ -199,6 +205,7 @@ int vc_widget_initialize(vc_h* vc_w) SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to initialize DB : %d", ret); vc_config_mgr_finalize((*vc_w)->handle); vc_widget_client_destroy((*vc_w)); + pthread_mutex_unlock(&g_w_init_mutex); return ret; } } @@ -207,6 +214,7 @@ int vc_widget_initialize(vc_h* vc_w) SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_NONE; } @@ -253,9 +261,11 @@ int vc_widget_deinitialize(vc_h vc_w) return VC_ERROR_NONE; } + pthread_mutex_lock(&g_w_init_mutex); if (false == vc_widget_client_is_valid(vc_w)) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] NOT initialized"); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -307,6 +317,7 @@ int vc_widget_deinitialize(vc_h vc_w) SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_NONE; } @@ -591,6 +602,8 @@ int vc_widget_unprepare(vc_h vc_w) ecore_thread_cancel(g_w_prepare_thread); } + SLOG(LOG_WARN, TAG_VCW, "[Widget] thread info %d %d %d", curr_thread_count, prev_thread_count - curr_thread_count, !ecore_thread_check(g_w_prepare_thread)); + SLOG(LOG_WARN, TAG_VCW, "[Widget] thread count %d", count); while (0 < curr_thread_count && 1 != prev_thread_count - curr_thread_count && !ecore_thread_check(g_w_prepare_thread)) { usleep(50000); diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index 6660c42..bd25de1 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -23,6 +23,7 @@ static pthread_mutex_t g_w_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_w_waiting_time = 3000; static bool g_is_connection_opened = false; @@ -527,7 +528,9 @@ int vc_widget_dbus_request_hello() int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_pid) { + pthread_mutex_lock(&g_w_init_mutex); if (0 != __dbus_check()) { + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -541,6 +544,7 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p if (NULL == msg) { SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget initialize : Fail to make message "); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget initialize : pid(%d)", pid); @@ -591,9 +595,11 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p if (NULL == g_w_conn_listener) { if (g_is_connection_opened) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] g_w_conn_listener is NULL abnormally"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_INFO, TAG_VCW, "[INFO] g_w_conn_listener is NULL and DBUS connection was closed"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_NONE; } } @@ -602,6 +608,7 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message); dbus_error_free(&err); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -615,12 +622,15 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p result = VC_ERROR_TIMED_OUT; } + pthread_mutex_unlock(&g_w_init_mutex); return result; } int vc_widget_dbus_request_finalize(int pid) { + pthread_mutex_lock(&g_w_init_mutex); if (0 != __dbus_check()) { + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -636,6 +646,7 @@ int vc_widget_dbus_request_finalize(int pid) if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message); dbus_error_free(&err); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } @@ -649,6 +660,7 @@ int vc_widget_dbus_request_finalize(int pid) if (NULL == msg) { SLOG(LOG_ERROR, TAG_VCW, "@@ vc widget finalize : Fail to make message "); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_OPERATION_FAILED; } else { SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget finalize : pid(%d)", pid); @@ -691,6 +703,7 @@ int vc_widget_dbus_request_finalize(int pid) result = VC_ERROR_TIMED_OUT; } + pthread_mutex_unlock(&g_w_init_mutex); return result; } -- 2.7.4 From 4590acee6cfcd5a2ff4db3237167b8ce2a93c61b Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 8 May 2019 20:55:13 +0900 Subject: [PATCH 12/16] Fix dbus issue when initialize Change-Id: I0d3d8461fd2e1a25ea35bf941ff91353a7913978 Signed-off-by: wn.jang --- client/vc_dbus.c | 15 ++++++++------- client/vc_mgr_dbus.c | 10 +++------- client/vc_widget_dbus.c | 11 +++-------- common/vc_cmd_db.c | 13 +------------ server/vcd_dbus.c | 36 ++++++++++++++++++++---------------- server/vcd_server.c | 11 ++++++++--- server/vce.c | 10 +++++----- 7 files changed, 48 insertions(+), 58 deletions(-) diff --git a/client/vc_dbus.c b/client/vc_dbus.c index 5b7e47d..c78d5db 100644 --- a/client/vc_dbus.c +++ b/client/vc_dbus.c @@ -21,6 +21,7 @@ static pthread_mutex_t g_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_waiting_time = 3000; +static int g_waiting_short_time = 200; static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_fd_handler = NULL; @@ -475,7 +476,7 @@ int vc_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, -1, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_short_time, &err); if (dbus_error_is_set(&err)) { SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE @@ -529,9 +530,12 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d result_msg = dbus_connection_send_with_reply_and_block(g_conn_sender, msg, g_waiting_time, &err); dbus_message_unref(msg); + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Receive the reply for initializing"); + if (dbus_error_is_set(&err)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Dbus Error (%s)", err.message); //LCOV_EXCL_LINE dbus_error_free(&err); + return VC_ERROR_OPERATION_FAILED; } if (NULL != result_msg) { @@ -558,6 +562,8 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d *service_state = tmp_service_state; *daemon_pid = tmp_daemon_pid; + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Get arguments for initializing"); + /* add a rule for daemon error */ char rule[256] = {0, }; snprintf(rule, 256, "sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',type='signal',arg0='%s'", VC_SERVER_SERVICE_INTERFACE); @@ -570,12 +576,7 @@ int vc_dbus_request_initialize(int pid, int* mgr_pid, int* service_state, int* d return VC_ERROR_NONE; } } - dbus_bus_add_match(g_conn_listener, rule, &err); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCC, "Match Error (%s)", err.message); //LCOV_EXCL_LINE - dbus_error_free(&err); - } + dbus_bus_add_match(g_conn_listener, rule, NULL); SLOG(LOG_DEBUG, TAG_VCC, "@@ vc initialize : result = %d mgr = %d service = %d daemon_pid = %d", result, *mgr_pid, *service_state, *daemon_pid); //LCOV_EXCL_LINE } else { diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 3e334b6..aa20c13 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -24,6 +24,7 @@ static pthread_mutex_t g_m_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_m_waiting_time = 3000; +static int g_m_waiting_short_time = 200; static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_m_fd_handler = NULL; @@ -874,7 +875,7 @@ int vc_mgr_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, -1, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, g_m_waiting_short_time, &err); if (dbus_error_is_set(&err)) { SLOG(LOG_DEBUG, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); @@ -1011,12 +1012,7 @@ int vc_mgr_dbus_request_initialize(int pid, int audio_streaming_mode, int* servi return VC_ERROR_NONE; } } - dbus_bus_add_match(g_m_conn_listener, rule_err, &err); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "Match Error (%s)", err.message); - dbus_error_free(&err); - } + dbus_bus_add_match(g_m_conn_listener, rule_err, NULL); SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr initialize : result = %d, service state = %d, foreground = %d, daemon_pid = %d", result, *service_state, *foreground, *daemon_pid); diff --git a/client/vc_widget_dbus.c b/client/vc_widget_dbus.c index bd25de1..eddeb77 100644 --- a/client/vc_widget_dbus.c +++ b/client/vc_widget_dbus.c @@ -26,6 +26,7 @@ static pthread_mutex_t g_w_dbus_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; static int g_w_waiting_time = 3000; +static int g_w_waiting_short_time = 200; static bool g_is_connection_opened = false; static Ecore_Fd_Handler* g_w_fd_handler = NULL; @@ -505,7 +506,7 @@ int vc_widget_dbus_request_hello() DBusMessage* result_msg = NULL; int result = 0; - result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, -1, &err); + result_msg = dbus_connection_send_with_reply_and_block(g_w_conn_sender, msg, g_w_waiting_short_time, &err); if (dbus_error_is_set(&err)) { if (!strncmp(err.name, DBUS_ERROR_SERVICE_UNKNOWN, strlen(err.name))) @@ -603,14 +604,8 @@ int vc_widget_dbus_request_initialize(int pid, int* service_state, int* daemon_p return VC_ERROR_NONE; } } - dbus_bus_add_match(g_w_conn_listener, rule_err, &err); - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCW, "Match Error (%s)", err.message); - dbus_error_free(&err); - pthread_mutex_unlock(&g_w_init_mutex); - return VC_ERROR_OPERATION_FAILED; - } + dbus_bus_add_match(g_w_conn_listener, rule_err, NULL); SLOG(LOG_DEBUG, TAG_VCW, "@@ vc widget initialize : result = %d service = %d daemon_pid = %d", result, *service_state, *daemon_pid); } else { diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 164dff8..0fee6eb 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -391,9 +391,6 @@ static int __vc_db_get_commands(sqlite3* db_handle, int pid, vc_cmd_type_e type, if (VC_COMMAND_TYPE_BACKGROUND == type && 0 == strncmp(appid, temp_text, strlen(appid))) { SLOG(LOG_DEBUG, vc_db_tag(), "Skip get background commands when app is foreground, appid(%s)", appid); - free(temp_text); - temp_text = NULL; - vc_cmd_destroy(temp_cmd); temp_cmd = NULL; @@ -405,11 +402,6 @@ static int __vc_db_get_commands(sqlite3* db_handle, int pid, vc_cmd_type_e type, } } - if (NULL != temp_text) { - free(temp_text); - temp_text = NULL; - } - temp = sqlite3_column_int(stmt, 0); vc_cmd_set_id(temp_cmd, temp); @@ -870,10 +862,6 @@ static int __vc_db_get_result(sqlite3* db_handle, char** result_text, int* event __vc_db_extract_unfixed_command(*result_text, temp_fixed, &temp_unfixed); vc_cmd_set_command(temp_cmd, temp_fixed); vc_cmd_set_unfixed_command(temp_cmd, temp_unfixed); - if (NULL != temp_unfixed) { - free(temp_unfixed); - temp_unfixed = NULL; - } } else { vc_cmd_set_command(temp_cmd, temp_command); } @@ -1773,6 +1761,7 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ g_slist_free(cmd_list); SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to insert command, %d", ret); + vc_cmd_destroy((vc_cmd_h)tmp_cmd); return ret; } cmd_list = NULL; diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index b77b19c..462f1a6 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -1079,6 +1079,7 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle /* loop again if we haven't read a message */ if (NULL == msg) { + SLOG(LOG_INFO, TAG_VCD, "@@@ no Dbus message anymore"); break; } @@ -1317,24 +1318,12 @@ int vcd_dbus_open_connection() } /* Flush messages which are received before fd event handler registration */ - while (DBUS_DISPATCH_DATA_REMAINS == dbus_connection_get_dispatch_status(g_conn_listener)) { + while (DBUS_DISPATCH_COMPLETE != dbus_connection_get_dispatch_status(g_conn_listener)) { + SLOG(LOG_DEBUG, TAG_VCD, "Dbus data is remained, g_conn_listener(%p)", g_conn_listener); listener_event_callback(NULL, NULL); } - /* add a rule for getting signal */ - char rule[128]; - snprintf(rule, 128, "type='signal',interface='%s'", VC_SERVER_SERVICE_INTERFACE); - - /* add a rule for which messages we want to see */ - dbus_bus_add_match(g_conn_listener, rule, &err);/* see signals from the given interface */ - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] dbus_bus_add_match() : %s", err.message); - dbus_error_free(&err); - __vcd_dbus_connection_free(); - return VCD_ERROR_OPERATION_FAILED; - } - + /* add fd handler to receive dbus metohd */ int fd = 0; if (1 != dbus_connection_get_unix_fd(g_conn_listener, &fd)) { SLOG(LOG_ERROR, TAG_VCD, "fail to get fd from dbus "); @@ -1344,7 +1333,6 @@ int vcd_dbus_open_connection() SLOG(LOG_DEBUG, TAG_VCD, "Get fd from dbus : %d", fd); } - g_dbus_fd_handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, (Ecore_Fd_Cb)listener_event_callback, g_conn_listener, NULL, NULL); if (NULL == g_dbus_fd_handler) { @@ -1353,6 +1341,22 @@ int vcd_dbus_open_connection() return VCD_ERROR_OPERATION_FAILED; } + /* add a rule for getting signal */ + char rule[128]; + snprintf(rule, 128, "type='signal',interface='%s'", VC_SERVER_SERVICE_INTERFACE); + + /* add a rule for which messages we want to see */ + dbus_bus_add_match(g_conn_listener, rule, &err);/* see signals from the given interface */ + + if (dbus_error_is_set(&err)) { + SLOG(LOG_ERROR, TAG_VCD, "[Dbus ERROR] dbus_bus_add_match() : %s", err.message); + dbus_error_free(&err); + __vcd_dbus_connection_free(); + return VCD_ERROR_OPERATION_FAILED; + } + + SLOG(LOG_INFO, TAG_VCD, "[INFO] Success to open dbus connection"); + return 0; } diff --git a/server/vcd_server.c b/server/vcd_server.c index fe5f960..41deae9 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -548,10 +548,9 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c filtered_count = 1; top_priority = temp_cmd->priority; } - - vc_cmd_destroy((vc_cmd_h)temp_cmd); - temp_cmd = NULL; } + vc_cmd_destroy((vc_cmd_h)temp_cmd); + temp_cmd = NULL; } // ASR consume @@ -1251,6 +1250,12 @@ int vcd_initialize(vce_request_callback_s *callback) /* Initialize manager info */ vcd_client_manager_unset(); + /* Open dbus connection */ + if (0 != vcd_dbus_open_connection()) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to open connection"); + return VCD_ERROR_OPERATION_FAILED; + } + vcd_config_set_service_state(VCD_STATE_READY); // vcdc_send_service_state(VCD_STATE_READY); diff --git a/server/vce.c b/server/vce.c index cc9f73f..3b89000 100644 --- a/server/vce.c +++ b/server/vce.c @@ -151,11 +151,11 @@ int vce_main(int argc, char** argv, vce_request_callback_s *callback) return VCE_ERROR_OPERATION_FAILED; } - if (0 != vcd_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to open connection"); - ecore_shutdown(); - return VCE_ERROR_OPERATION_FAILED; - } + // if (0 != vcd_dbus_open_connection()) { + // SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to open connection"); + // ecore_shutdown(); + // return VCE_ERROR_OPERATION_FAILED; + // } ret = vcd_initialize(callback); if (0 != ret) { -- 2.7.4 From 7ba3d1877c2baa944c3a7fbd2ac9590c04d94cea Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 10 May 2019 14:46:13 +0900 Subject: [PATCH 13/16] Remove unnecessary 'close connection' codes Change-Id: I95cdc9b4b35912ada9c84dd44726217b4f0a9a21 Signed-off-by: wn.jang --- server/vce.c | 1 - 1 file changed, 1 deletion(-) diff --git a/server/vce.c b/server/vce.c index 3b89000..7a9bf97 100644 --- a/server/vce.c +++ b/server/vce.c @@ -160,7 +160,6 @@ int vce_main(int argc, char** argv, vce_request_callback_s *callback) ret = vcd_initialize(callback); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to initialize"); - vcd_dbus_close_connection(); ecore_shutdown(); return ret; } -- 2.7.4 From a63c952df33968231f585694fd1d6e2103de3fc4 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 15 May 2019 15:35:09 +0900 Subject: [PATCH 14/16] Fix memory deference issue Change-Id: Ied7439593b1d4c8e104f80af43b0045ba515be67 --- common/vc_cmd_db.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 0fee6eb..a395550 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -862,6 +862,9 @@ static int __vc_db_get_result(sqlite3* db_handle, char** result_text, int* event __vc_db_extract_unfixed_command(*result_text, temp_fixed, &temp_unfixed); vc_cmd_set_command(temp_cmd, temp_fixed); vc_cmd_set_unfixed_command(temp_cmd, temp_unfixed); + if (temp_unfixed) + free(temp_unfixed); + temp_unfixed = NULL; } else { vc_cmd_set_command(temp_cmd, temp_command); } @@ -1761,7 +1764,6 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ g_slist_free(cmd_list); SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to insert command, %d", ret); - vc_cmd_destroy((vc_cmd_h)tmp_cmd); return ret; } cmd_list = NULL; -- 2.7.4 From 18fe532983f2d66d0c8842c60ee6429694abe87b Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 24 May 2019 16:07:23 +0900 Subject: [PATCH 15/16] Fix thread unsafety issue when preparing Change-Id: Idafff2ce66490ceade64919f37ad1918ad9be899 --- client/vc_widget.c | 65 ++++++++++++++++++++++++++++++++--------------------- server/vcd_server.c | 11 ++++++++- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/client/vc_widget.c b/client/vc_widget.c index fafdda2..c185aba 100644 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -42,7 +42,8 @@ static Ecore_Timer* g_w_notify_result_timer = NULL; static pthread_mutex_t g_w_init_mutex = PTHREAD_MUTEX_INITIALIZER; static Ecore_Thread* g_w_prepare_thread = NULL; -static int g_w_prepare_canceled = 0; +static bool g_ask_to_cancel_preparing = false; +static bool g_is_prepare_thread_alive = false; static int g_daemon_pid = 0; @@ -269,7 +270,7 @@ int vc_widget_deinitialize(vc_h vc_w) return VC_ERROR_INVALID_STATE; } - g_w_prepare_canceled = 1; + g_ask_to_cancel_preparing = true; vc_state_e state; vc_widget_client_get_state(vc_w, &state); @@ -476,17 +477,22 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) SLOG(LOG_INFO, TAG_VCW, "@@@ Start prepare thread"); int ret = -1, retry_count = 0; vc_h vc_w = (vc_h)data; + g_is_prepare_thread_alive = true; /* Send hello */ while (0 != ret) { - if (g_w_prepare_canceled) { + if (g_ask_to_cancel_preparing) { SLOG(LOG_WARN, TAG_VCW, "[WARNING] Thread is canceled."); + __vc_widget_internal_unprepare(vc_w); + ecore_main_loop_thread_safe_call_async(__vc_widget_delete_focus_event_handler, NULL); + g_is_prepare_thread_alive = false; return; } if (retry_count == 30) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to request hello !!"); ecore_main_loop_thread_safe_call_async(__vc_widget_delete_focus_event_handler, NULL); + g_is_prepare_thread_alive = false; return; } @@ -502,14 +508,19 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) ret = -1; retry_count = 0; while (0 != ret) { - if (g_w_prepare_canceled) { + if (g_ask_to_cancel_preparing) { SLOG(LOG_WARN, TAG_VCW, "[WARNING] Thread is canceled."); + __vc_widget_internal_unprepare(vc_w); + ecore_main_loop_thread_safe_call_async(__vc_widget_delete_focus_event_handler, NULL); + g_is_prepare_thread_alive = false; return; } if (retry_count == 10) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to connect daemon !!"); + __vc_widget_internal_unprepare(vc_w); ecore_main_loop_thread_safe_call_async(__vc_widget_delete_focus_event_handler, NULL); + g_is_prepare_thread_alive = false; return; } ret = __vc_widget_connect_daemon((void*)vc_w); @@ -520,21 +531,20 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) } SLOG(LOG_DEBUG, TAG_VCW, "@@@"); - + g_is_prepare_thread_alive = false; return; } static void __end_prepare_thread(void *data, Ecore_Thread *thread) { - g_w_prepare_thread = NULL; SLOG(LOG_DEBUG, TAG_VCW, "@@@ End prepare thread"); + g_w_prepare_thread = NULL; } static void __cancel_prepare_thread(void *data, Ecore_Thread *thread) { SLOG(LOG_DEBUG, TAG_VCW, "@@@ Cancel prepare thread"); g_w_prepare_thread = NULL; - g_w_prepare_canceled = 1; } int vc_widget_prepare(vc_h vc_w) @@ -546,10 +556,12 @@ int vc_widget_prepare(vc_h vc_w) return VC_ERROR_NONE; } + pthread_mutex_lock(&g_w_init_mutex); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] A handle is not available"); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -557,6 +569,7 @@ int vc_widget_prepare(vc_h vc_w) if (state != VC_STATE_INITIALIZED) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid State: Current state is not 'Initialized'"); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -564,6 +577,7 @@ int vc_widget_prepare(vc_h vc_w) if (NULL == widget) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to get widget handle"); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -572,14 +586,15 @@ int vc_widget_prepare(vc_h vc_w) // Check ecore thread if (g_w_prepare_thread && !ecore_thread_check(g_w_prepare_thread)) { - ecore_thread_cancel(g_w_prepare_thread); - g_w_prepare_thread = NULL; + SLOG(LOG_INFO, TAG_VCW, "[INFO] prepare_thread is already runnning"); + pthread_mutex_unlock(&g_w_init_mutex); + return VC_ERROR_NONE; } - g_w_prepare_canceled = 0; + g_ask_to_cancel_preparing = false; g_w_prepare_thread = ecore_thread_run(__start_prepare_thread, __end_prepare_thread, __cancel_prepare_thread, (void*)vc_w); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); - + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_NONE; } @@ -592,36 +607,33 @@ int vc_widget_unprepare(vc_h vc_w) return VC_ERROR_NONE; } - int prev_thread_count = ecore_thread_active_get(); - int curr_thread_count = prev_thread_count; + pthread_mutex_lock(&g_w_init_mutex); int count = 0; - SLOG(LOG_INFO, TAG_VCW, "[Widget] Current thread count(%d)", curr_thread_count); - + SLOG(LOG_WARN, TAG_VCW, "[Widget] prepare_thread info(%p), check(%d)", g_w_prepare_thread, ecore_thread_check(g_w_prepare_thread)); if (g_w_prepare_thread && !ecore_thread_check(g_w_prepare_thread)) { - SLOG(LOG_WARN, TAG_VCW, "[WARNING] Thread is alive. Call cancel thread."); - ecore_thread_cancel(g_w_prepare_thread); + bool ret = ecore_thread_cancel(g_w_prepare_thread); + g_ask_to_cancel_preparing = true; + SLOG(LOG_WARN, TAG_VCW, "[WARNING] Thread is alive. The cancel_thread is called, ret(%d)", ret); } - SLOG(LOG_WARN, TAG_VCW, "[Widget] thread info %d %d %d", curr_thread_count, prev_thread_count - curr_thread_count, !ecore_thread_check(g_w_prepare_thread)); - SLOG(LOG_WARN, TAG_VCW, "[Widget] thread count %d", count); - while (0 < curr_thread_count && 1 != prev_thread_count - curr_thread_count && !ecore_thread_check(g_w_prepare_thread)) { + while (g_is_prepare_thread_alive) { usleep(50000); if (100 == count) { - SLOG(LOG_WARN, TAG_VCW, "[WARNING!!] Thread is blocked, cnt(%d), thread count(%d)", count, curr_thread_count); + SLOG(LOG_WARN, TAG_VCW, "[WARNING!!] Thread is blocked, cnt(%d)", count); break; - } else if (0 == count % 5) { - SLOG(LOG_WARN, TAG_VCW, "[WARNING!!] Thread is alive, cnt(%d), thread count(%d)", count, curr_thread_count); + } else if (0 != count && 0 == count % 5) { + SLOG(LOG_WARN, TAG_VCW, "[WARNING!!] Thread is alive, cnt(%d)", count); } count++; - curr_thread_count = ecore_thread_active_get(); } - g_w_prepare_thread = NULL; + SLOG(LOG_WARN, TAG_VCW, "[Widget] prepare_thread is terminated"); vc_state_e state; if (0 != vc_widget_client_get_state(vc_w, &state)) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] A handle is not available"); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -629,6 +641,7 @@ int vc_widget_unprepare(vc_h vc_w) if (state != VC_STATE_READY) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Invalid State: Current state is not 'READY', state(%d)", state); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_INVALID_STATE; } @@ -638,7 +651,7 @@ int vc_widget_unprepare(vc_h vc_w) g_w_notify_state_timer = ecore_timer_add(0, __vc_widget_notify_state_changed, vc_w); SLOG(LOG_DEBUG, TAG_VCW, "@@@"); - + pthread_mutex_unlock(&g_w_init_mutex); return VC_ERROR_NONE; } diff --git a/server/vcd_server.c b/server/vcd_server.c index 41deae9..e74003f 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -1439,6 +1439,10 @@ Eina_Bool vcd_cleanup_client_all(void *data) __vcd_cleanup_client(VCD_CLIENT_TYPE_WIDGET); __vcd_cleanup_client(VCD_CLIENT_TYPE_MANAGER); + if (0 == vcd_client_get_ref_count()) { + SLOG(LOG_DEBUG, TAG_VCD, "[Server] Connected client list is empty"); + ecore_timer_add(0, __finalize_quit_ecore_loop, NULL); + } #if 0 if (0 == vcd_client_get_list(&client_list, &client_count)) { SLOG(LOG_DEBUG, TAG_VCD, "@@@ Clean up client "); @@ -2849,6 +2853,11 @@ int vcd_server_widget_finalize(int pid) /* check if pid is valid */ if (false == vcd_client_widget_is_available(pid)) { SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] pid is NOT valid "); + if (0 == vcd_client_get_ref_count()) { + SLOG(LOG_ERROR, TAG_VCD, "[Server] connected client list is empty, vc-service will be terminated"); + ecore_timer_add(0, __finalize_quit_ecore_loop, NULL); + return 0; + } return VCD_ERROR_INVALID_PARAMETER; } @@ -2858,7 +2867,7 @@ int vcd_server_widget_finalize(int pid) } if (0 == vcd_client_get_ref_count()) { - SLOG(LOG_ERROR, TAG_VCD, "[Server] connected client list is empty"); + SLOG(LOG_ERROR, TAG_VCD, "[Server] connected client list is empty, vc-service will be terminated"); ecore_timer_add(0, __finalize_quit_ecore_loop, NULL); return 0; } -- 2.7.4 From e7fa2ef21ad25c68dd3e892500fc7bda819e5c7d Mon Sep 17 00:00:00 2001 From: Jongmin Lee Date: Thu, 30 May 2019 14:45:10 +0900 Subject: [PATCH 16/16] replace the use of ecore_wayland into ecore_wl2 Change-Id: I8d276f76a313426f2d85bb5447d841e8baf78f90 --- CMakeLists.txt | 6 ++++-- client/vc.c | 10 +++++----- client/vc_widget.c | 10 +++++----- packaging/voice-control.spec | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffeca96..67eb451 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,8 @@ EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") ADD_DEFINITIONS("-DVOICE_LIBDIR=\"${LIBDIR}\"") ADD_DEFINITIONS("-Werror") +# for the use of ecore_wl2 +ADD_DEFINITIONS("-DEFL_BETA_API_SUPPORT") # pkg config tool INCLUDE(FindPkgConfig) @@ -45,12 +47,12 @@ INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include") INCLUDE(FindPkgConfig) IF("${_TV_PRODUCT}" STREQUAL "TRUE") pkg_check_modules(pkgs REQUIRED - aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland + aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 capi-network-bluetooth capi-network-bluetooth-tv capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf msfapi farfield-voice-api ) ELSE() pkg_check_modules(pkgs REQUIRED - aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wayland + aul capi-appfw-app-control capi-appfw-app-manager capi-base-common capi-media-audio-io capi-media-sound-manager ecore-wl2 capi-system-info cynara-client cynara-session dbus-1 db-util dlog ecore glib-2.0 json-glib-1.0 libgum libtzplatform-config libxml-2.0 sqlite3 vconf ) ENDIF() diff --git a/client/vc.c b/client/vc.c index b75d098..77f19a7 100644 --- a/client/vc.c +++ b/client/vc.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -251,7 +251,7 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) SLOG(LOG_DEBUG, TAG_VCC, "@@@ Focus changed"); int ret; - if (ECORE_WL_EVENT_FOCUS_IN == type) { + if (ECORE_WL2_EVENT_FOCUS_IN == type) { SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set foreground"); ret = vc_dbus_set_foreground(getpid(), true); if (0 != ret) { @@ -274,7 +274,7 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) /* notify auth changed cb */ ecore_timer_add(0, __notify_auth_changed_cb, NULL); } - } else if (ECORE_WL_EVENT_FOCUS_OUT == type) { + } else if (ECORE_WL2_EVENT_FOCUS_OUT == type) { SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set background"); ret = vc_dbus_set_foreground(getpid(), false); if (0 != ret) { @@ -534,8 +534,8 @@ static Eina_Bool __vc_connect_daemon(void *data) /* Register focus handler */ ecore_thread_main_loop_begin(); - g_focus_in_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, __focus_changed_cb, NULL); - g_focus_out_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); + g_focus_in_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, __focus_changed_cb, NULL); + g_focus_out_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); ecore_thread_main_loop_end(); char appid[1024] = {'\0',}; diff --git a/client/vc_widget.c b/client/vc_widget.c index c185aba..0fb7460 100644 --- a/client/vc_widget.c +++ b/client/vc_widget.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include "vc_cmd_db.h" #include "vc_command.h" #include "vc_config_mgr.h" @@ -327,13 +327,13 @@ static Eina_Bool __focus_changed_cb(void *data, int type, void *event) SLOG(LOG_DEBUG, TAG_VCW, "@@@ Focus changed"); int ret; - if (ECORE_WL_EVENT_FOCUS_IN == type) { + if (ECORE_WL2_EVENT_FOCUS_IN == type) { SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set foreground"); ret = vc_widget_dbus_set_foreground(getpid(), true); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCW, "[ERROR] Fail to set foreground (true) : %d", ret); } - } else if (ECORE_WL_EVENT_FOCUS_OUT == type) { + } else if (ECORE_WL2_EVENT_FOCUS_OUT == type) { SLOG(LOG_DEBUG, TAG_VCW, "@@@ Set background"); ret = vc_widget_dbus_set_foreground(getpid(), false); if (0 != ret) { @@ -354,9 +354,9 @@ static void __vc_widget_add_focus_event_handler(void *data) SLOG(LOG_INFO, TAG_VCW, "@@@ [Widget] add focus event handler"); if (NULL == g_focus_in_handler) - g_focus_in_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, __focus_changed_cb, NULL); + g_focus_in_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, __focus_changed_cb, NULL); if (NULL == g_focus_out_handler) - g_focus_out_handler = ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); + g_focus_out_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); return; } diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 1115948..6014e70 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -23,7 +23,7 @@ BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(ecore-wayland) +BuildRequires: pkgconfig(ecore-wl2) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(json-glib-1.0) BuildRequires: pkgconfig(libgum) -- 2.7.4