Save configuratio change before auto language setting 97/280597/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 1 Sep 2022 05:02:14 +0000 (14:02 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 1 Sep 2022 05:02:14 +0000 (14:02 +0900)
- Issue:
Setting API did not save the change of auto voice enabling
configuration.

- Solution:
The configuration is stored in memory by tts_parser_set_config_info() and
stored in configuration file by other functions from tts_parser module.
However, in current logic for change auto voice configuration,
tts_config_mgr_set_auto_voice() function tries to store configuration
file without storing memory when the auto voice is true. This may cause
the situation that the memory and file are not matched.
So this patch makes the function store the configuration in memory
first.

Change-Id: I9602bcc9cbc3aad0e56fad068e159b144b0d1ab9
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
common/tts_config_mgr.c

index f244d78..4d50896 100644 (file)
@@ -1796,7 +1796,12 @@ int tts_config_mgr_set_auto_voice(bool value)
                } else {
                        SLOG(LOG_INFO, TAG_TTSCONFIG, "Client type is default. Skip saving configuration file.");
                }
+
                config_info.auto_voice = value;
+               if (0 != tts_parser_set_config_info(&config_info)) {
+                       SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
+                       return TTS_CONFIG_ERROR_OPERATION_FAILED;
+               }
 
                if (true == config_info.auto_voice) {
                        __tts_config_set_auto_language();
@@ -1813,11 +1818,6 @@ int tts_config_mgr_set_auto_voice(bool value)
                }
        }
 
-       if (0 != tts_parser_set_config_info(&config_info)){
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to set configure information");
-               return TTS_CONFIG_ERROR_OPERATION_FAILED;
-       }
-
        return TTS_CONFIG_ERROR_NONE;
 }