Set engine id from vconf value when default config is set 14/282914/4
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 13 Oct 2022 07:45:49 +0000 (16:45 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 13 Oct 2022 09:25:43 +0000 (18:25 +0900)
- Issue:
When default configuration is loaded, invalid engine id can be set.

- Solution:
Default configuration stores fixed engine id, so the engine id can be
not installed in the image. Thus, this patch changes the logic for
loading default configuration. Through this patch, vconf value is used
default engine id when default configuration is loaded.

Change-Id: Ifa37d1eceb5df126b69ac7455aea0dc0e12005fa
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
common/tts_config_parser.c
tts-config.xml

index a0ba63e..6e33df2 100644 (file)
@@ -443,6 +443,21 @@ int tts_parser_load_config(void)
 
        while (cur != NULL) {
                if (0 == xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_CONFIG_ENGINE_ID)) {
+                       if (is_default_open) {
+                               char* engine_id = vconf_get_str(TTS_ENGINE_DB_DEFAULT);
+                               if (engine_id) {
+                                       SLOG(LOG_DEBUG, TAG_TTSCONFIG, "Set default engine id(%s)", engine_id);
+                                       strncpy(temp->engine_id, engine_id, sizeof(engine_id) - 1);
+                                       xmlNodeSetContent(cur, (const xmlChar *)engine_id);
+
+                                       free(engine_id);
+                                       engine_id = NULL;
+
+                                       cur = cur->next;
+                                       continue;
+                               }
+                       }
+
                        key = xmlNodeGetContent(cur);
                        if (NULL != key) {
                                strncpy(temp->engine_id, (char*)key, sizeof(g_engine_id) - 1);
@@ -1139,6 +1154,11 @@ int tts_parser_reset()
                return -1;
        }
 
+       char* engine_id = vconf_get_str(TTS_ENGINE_DB_DEFAULT);
+       if (engine_id) {
+               __set_value_into_configuration(TTS_TAG_CONFIG_ENGINE_ID, engine_id);
+               free(engine_id);
+       }
        __save_configuration(g_config_doc);
 
        return 0;
index cb77be7..9d2696f 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <tts-config>
-        <engine>27F277E9-BBC4-4dca-B553-D9884A3CDAA0</engine>
+        <engine>org.tizen.tts-engine-default</engine>
         <engine-setting/>
         <auto>on</auto>
         <language>en_US</language>