Add an exception handling 37/176937/5
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 24 Apr 2018 08:38:55 +0000 (17:38 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 24 Apr 2018 08:48:52 +0000 (17:48 +0900)
- Verify current language before getting cached information

Change-Id: I0a41e9f2a8e468b7310ab7034a88442ac005c7fe
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/aul_rsc_mgr.c

index a43675c..b09c1f0 100755 (executable)
@@ -720,6 +720,12 @@ static int __close(resource_manager_t *handle)
 
 static void __vconf_cb(keynode_t *key, void *data)
 {
+       char *val;
+
+       val = vconf_keynode_get_str(key);
+       if (val && cur_language && !strcmp(val, cur_language))
+               return;
+
        __invalidate_cache();
 }
 
@@ -1051,6 +1057,24 @@ API int aul_resource_manager_get_path_list(GHashTable **list)
        return AUL_RESOURCE_ERROR_NONE;
 }
 
+static bool __verify_current_language(void)
+{
+       char *lang;
+
+       lang = vconf_get_str(VCONFKEY_LANGSET);
+       if (!lang)
+               return false;
+
+       if (cur_language && !strcmp(lang, cur_language)) {
+               free(lang);
+               return true;
+       }
+
+       free(lang);
+
+       return false;
+}
+
 API int aul_resource_manager_get(aul_resource_e type, const char *id, char **path)
 {
        int retval = AUL_RESOURCE_ERROR_NONE;
@@ -1081,11 +1105,15 @@ API int aul_resource_manager_get(aul_resource_e type, const char *id, char **pat
                                return retval;
                }
 
-               /* To get fname from cache */
-               cached_path = __get_cache(type, id);
-               if (cached_path != NULL) {
-                       *path = strdup(cached_path);
-                       return AUL_RESOURCE_ERROR_NONE;
+               if (__verify_current_language()) {
+                       /* To get fname from cache */
+                       cached_path = __get_cache(type, id);
+                       if (cached_path != NULL) {
+                               *path = strdup(cached_path);
+                               return AUL_RESOURCE_ERROR_NONE;
+                       }
+               } else {
+                       __invalidate_cache();
                }
        }