Register fd handler when the client only sets the lang_cb 66/291166/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Tue, 11 Apr 2023 04:40:32 +0000 (13:40 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Tue, 11 Apr 2023 05:19:43 +0000 (14:19 +0900)
- Issue:
Language changes callback is not invoked except by the setting client.

- Solution:
Previous code does not register inotify fd handler when the clients only
set langauge changed callback. The callback needs fd handler
registeration because the callback is called by fd handler. So this
patch adds code to register the fd handler. Through this patch, the
language changd callback will be invoked even if the client is not the
setting client.

Change-Id: I503a5097f7727721292974bd1dc2919401e17593
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
common/vc_config_mgr.cpp

index d45d930..1b98486 100644 (file)
@@ -1094,6 +1094,13 @@ int vc_config_mgr_set_lang_cb(unsigned int uid, vc_config_lang_changed_cb lang_c
        }
 
        g_VoiceControlClients->setLanguageChangedCallback(uid, lang_cb);
+
+       if (VC_CONFIG_ERROR_NONE != register_language_config_changed_event()) {
+               SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register config event");
+               ecore_thread_main_loop_end();
+               return VC_CONFIG_ERROR_OPERATION_FAILED;
+       }
+
        ecore_thread_main_loop_end();
        return VC_CONFIG_ERROR_NONE;
 }
@@ -1108,6 +1115,9 @@ int vc_config_mgr_unset_lang_cb(unsigned int uid)
        }
 
        g_VoiceControlClients->setLanguageChangedCallback(uid, nullptr);
+
+       unregister_language_config_event();
+
        ecore_thread_main_loop_end();
        return VC_CONFIG_ERROR_NONE;
 }