change the way of getting engine_id when updating personal voice 93/315193/7
authordyamy-lee <dyamy.lee@samsung.com>
Fri, 26 Jul 2024 08:56:52 +0000 (17:56 +0900)
committerDaYe Lee <dyamy.lee@samsung.com>
Thu, 12 Sep 2024 10:25:21 +0000 (10:25 +0000)
When calling ttsd_config_update_personal_voice(), it gets engine_id by checking current engine from app_id.
So, tts_config_mgr_update_personal_voice() API uses this input parameter. Not use default engine id.

Change-Id: If04861cc4c5faf69f5146c6d64bd862d67e48a1d

common/tts_config_mgr.c
server/ttsd_config.c

index 65ebd96b144d5680b6fd9b7a779f82a7e3385179..fbe5dc0799c3dfb26dff61ba066a05715e51522e 100644 (file)
@@ -2431,18 +2431,8 @@ int tts_config_mgr_set_instant_reprepare_client(const unsigned int uid)
 
 int tts_config_mgr_update_personal_voice(const char* engine_id, const char* language, const char* unique_id, const char* display_name, const char* device_name)
 {
-       char* default_engine = get_default_engine_app_id();
-       // tts_engine_info_s *engine_info = __get_engine_info(default_engine);
-       // free(default_engine);
-       // if (NULL == engine_info) {
-       //      SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] engine info is NULL");
-       //      return TTS_CONFIG_ERROR_ENGINE_NOT_FOUND;
-       // }
-
-       engine_id = strdup(default_engine);
+       SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] engine_id(%s) language(%s), unique_id(%s), display_name(%s), device_name(%s)", engine_id, language, unique_id, display_name, device_name);
 
-       SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] engine id = %s", engine_id);
-       SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] language(%s), unique_id(%s), display_name(%s), device_name(%s)", language, unique_id, display_name, device_name);
        if (NULL == engine_id || NULL == language || NULL == unique_id || NULL == display_name || NULL == device_name) {
                SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Input Parameter is null");
                return TTS_CONFIG_ERROR_INVALID_PARAMETER;
index 67352bb8e6905e76a7d8d895b4d3dc8ed69e33e0..13cbbbc76444f55df8dbd752d184171f57927bc8 100644 (file)
@@ -14,6 +14,7 @@
 
 /* For multi-user support */
 #include <tzplatform_config.h>
+#include <aul.h>
 
 #include "tts_config_mgr.h"
 #include "ttsd_config.h"
@@ -265,13 +266,14 @@ int ttsd_config_set_instant_reprepare_client(const unsigned int uid)
 
 int ttsd_config_update_personal_voice(const char* language, const char* unique_id, const char* display_name, const char* device_name, void* user_data)
 {
-       char* engine_id = NULL;
-       // if (0 != tts_config_mgr_get_engine(&engine_id)) {
-       //      SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Fail to get engine id");
-       //      return TTSD_ERROR_OPERATION_FAILED;
-       // }
+       char current_engine[1024] = {'\0', };
+       if (0 != aul_app_get_appid_bypid(getpid(), current_engine, sizeof(current_engine) - 1)) {
+               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get callee appid by pid");
+       }
+
+       SLOG(LOG_DEBUG, tts_tag(), "[Server] TTS Current Engine(%s)", current_engine);
 
-       int ret = tts_config_mgr_update_personal_voice(engine_id, language, unique_id, display_name, device_name);
+       int ret = tts_config_mgr_update_personal_voice(current_engine, language, unique_id, display_name, device_name);
        if (0 != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[Config ERROR] Fail to update personal voice to xml");
                return TTSD_ERROR_OPERATION_FAILED;