From: Youngjae Cho Date: Wed, 31 Jan 2024 06:29:11 +0000 (+0900) Subject: sound: Intialize theme id by default value only when it hasn't been initialized X-Git-Tag: accepted/tizen/8.0/unified/20240401.145044~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ebcbd227fd6f432632a77c8a6e64b59dd1e0d2c;p=platform%2Fcore%2Fsystem%2Flibsvi.git sound: Intialize theme id by default value only when it hasn't been initialized It is necessary to keep the previous theme id if it once has been initialized to the valid value. Otherwise, it will always be reset to the default theme id, overwriting the previous valid theme id. Change-Id: Ie5ba57820f31e5718bb4951ba918781ebd6fa263 Signed-off-by: Youngjae Cho (cherry picked from commit 2e04e2179422dc46823c358c02d3c65eaecf66e3) --- diff --git a/src/sound.c b/src/sound.c index daf3369..7095bba 100644 --- a/src/sound.c +++ b/src/sound.c @@ -45,11 +45,15 @@ #define VCONFKEY_SETAPPL_BUTTON_SOUNDS_BOOL "db/setting/sound/button_sounds" #endif +#define SOUND_THEME_ID_UNINITIALIZED 0 + static int sndstatus; static int touch_sndstatus; static int keytone_sndstatus; static unsigned int current_theme_id = 0; +static int sound_set_theme_id(unsigned int id_of_theme); + static const char *get_data(feedback_pattern_e pattern) { const char *data; @@ -148,12 +152,22 @@ static void feedback_sound_theme_changed_cb(keynode_t *key, void* data) } //LCOV_EXCL_STOP +static void sound_theme_id_init(void) +{ + int ret; + unsigned int theme_id = SOUND_THEME_ID_UNINITIALIZED; + + ret = vconf_get_int(VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME, (int *) &theme_id); + if (ret < 0 || theme_id == SOUND_THEME_ID_UNINITIALIZED) + sound_thememan_get_default_sound_theme_id(&theme_id); + + sound_set_theme_id(theme_id); +} + static void sound_init(void) { int ret = 0; - current_theme_id = 0; - ret = sound_thememan_init(); if (ret < 0) { _E("Failed to initialize sound theme manager(%d)", ret); @@ -167,8 +181,7 @@ static void sound_init(void) sound_parser_exit(); } - sound_thememan_get_default_sound_theme_id(¤t_theme_id); - ret = vconf_set_int(VCONFKEY_SETAPPL_ACCESSIBILITY_SOUND_FEEDBACK_THEME, current_theme_id); + sound_theme_id_init(); /* check sound status */ if (vconf_get_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &touch_sndstatus) < 0)