From: Ji-hoon Lee Date: Fri, 10 Feb 2023 09:56:40 +0000 (+0900) Subject: Do not consider scheduled restart as an error X-Git-Tag: accepted/tizen/7.0/unified/20230303.102015^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efb2c3dc3122080c56939b8aa7e1b41777555604;p=platform%2Fcore%2Fuifw%2Fmulti-assistant.git Do not consider scheduled restart as an error When a scheduled restart takes place on the agent side, the client application receives a service reset error, canceling all the ongoing operations that are not directly related to the multi-assistant framework. To avoid this problem, added a restart notification signal for letting the clients to know the subsequent dbus name owner change event is caused by a scheduled restart event or not. Change-Id: I0e1acf293d62d04356a59bb0f9bba29860946285 --- diff --git a/client/ma.c b/client/ma.c index 8eadce7..37e1a6e 100644 --- a/client/ma.c +++ b/client/ma.c @@ -738,7 +738,7 @@ int __ma_cb_audio_streaming(int event, char* buffer, int len) return 0; } -int __ma_cb_error(int reason, char* msg) +int __ma_cb_error(int reason, char* msg, int notify) { ma_state_e state; if (0 != ma_client_get_client_state(g_ma, &state)) { @@ -763,10 +763,12 @@ int __ma_cb_error(int reason, char* msg) __ma_notify_state_changed((void*)g_ma); } - MA_SLOGE("[ERROR] Error reason(%d), msg(%s)", reason, msg); //LCOV_EXCL_LINE + MA_SLOGE("[ERROR] Error reason(%d), msg(%s), notify(%d)", reason, msg, notify); //LCOV_EXCL_LINE ma_client_set_error(g_ma, reason); - __ma_notify_error((void*)g_ma); + if (notify) { + __ma_notify_error((void*)g_ma); + } if (MA_ERROR_SERVICE_RESET == reason) { if (0 != ma_prepare()) { diff --git a/client/ma_dbus.c b/client/ma_dbus.c index dd62350..eaa6ac8 100644 --- a/client/ma_dbus.c +++ b/client/ma_dbus.c @@ -30,8 +30,9 @@ static DBusConnection* g_conn_sender = NULL; static DBusConnection* g_conn_listener = NULL; static bool g_streaming_requested = false; +static bool g_restart_notification_received = false; -extern int __ma_cb_error(int reason, char* msg); +extern int __ma_cb_error(int reason, char* msg, int notify); extern int __ma_cb_audio_streaming(int event, char* buffer, int len); extern int __ma_cb_active_state_changed(int state, const char* wakeup_word, const unsigned char* extra_data, int extra_data_length, const char* extra_data_desc); @@ -475,11 +476,16 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle //LCOV_EXCL_STOP } else { MA_SLOGD("@@ multi-assistant Get Error message : reason(%d), msg(%s)", reason, err_msg); //LCOV_EXCL_LINE - __ma_cb_error(reason, err_msg); + __ma_cb_error(reason, err_msg, TRUE); } } /* MAS_METHOD_ERROR */ + else if (dbus_message_is_signal(msg, if_name, MAS_METHOD_RESTART_NOTIFICATION)) { + MA_SLOGE("RESTART NOTIFICATION RECEIVED"); + g_restart_notification_received = true; + } /* MAS_METHOD_RESTART_NOTIFICATION */ + else if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) { //LCOV_EXCL_START MA_SLOGD("[DEBUG] Owner Changed"); //LCOV_EXCL_LINE @@ -496,7 +502,8 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler* fd_handle dbus_error_free(&err); } - __ma_cb_error(MA_ERROR_SERVICE_RESET, "Daemon Reset"); + __ma_cb_error(MA_ERROR_SERVICE_RESET, "Daemon Reset", g_restart_notification_received ? FALSE : TRUE); + g_restart_notification_received = false; //LCOV_EXCL_STOP } /* NameOwnerChanged */ diff --git a/common/ma_defs.h b/common/ma_defs.h index 049d98b..a889374 100644 --- a/common/ma_defs.h +++ b/common/ma_defs.h @@ -95,6 +95,7 @@ extern "C" #define MAS_METHOD_STREAMING_AUDIO_DATA "mas_method_streaming_audio_data" #define MAS_METHOD_WAKEUP_ENGINE_COMMAND "mas_method_wakeup_engine_command" #define MAS_METHOD_ERROR "mas_method_error" +#define MAS_METHOD_RESTART_NOTIFICATION "mas_method_restart_notification" #define MAS_METHOD_SEND_PREPROCESSING_INFORMATION "mas_method_send_preprocessing_information" #define MAS_METHOD_AUDIO_STREAMING_DATA_SECTION "mas_method_audio_streaming_data_section" #define MAS_METHOD_SEND_PREPROCESSING_RESULT "mas_method_send_preprocessing_result"