replace sprintf with snprintf for secure-coding
[platform/core/api/system-settings.git] / src / system_setting_platform.c
index 42dd8a7..135c2b1 100644 (file)
@@ -19,6 +19,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <time.h>
+#include <dlfcn.h>
 
 #include <string.h>
 #include <sys/types.h>
 
 #include <fontconfig/fontconfig.h>
 
-/*#include <pkgmgr-info.h> */
-
-#include <Elementary.h>
-#include <Evas.h>
-#include <Ecore_Evas.h>
+#include <alarm.h>
 
 #include <pkgmgr-info.h>
 
 #include <efl_assist.h>
 #endif
 
-#ifdef TIZEN_WEARABLE
-#define SMALL_FONT_DPI                      (-90)
-#endif
-#ifdef TIZEN_MOBILE
-#define SMALL_FONT_DPI                      (-80)
-#endif
-#define MIDDLE_FONT_DPI                     (-100)
-#ifdef TIZEN_WEARABLE
-#define LARGE_FONT_DPI                      (-110)
-#endif
-#ifdef TIZEN_MOBILE
-#define LARGE_FONT_DPI                      (-150)
-#endif
-#define HUGE_FONT_DPI                       (-190)
-#define GIANT_FONT_DPI                      (-250)
-
-#define SETTING_FONT_PRELOAD_FONT_PATH _TZ_SYS_RO_SHARE"/fonts"
-#define SETTING_FONT_DOWNLOADED_FONT_PATH _TZ_SYS_RO_SHARE"/fonts"
-
 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
 
-#define SETTING_STR_LEN  256
-
-#define SETTING_TIME_ZONEINFO_PATH             "/usr/share/zoneinfo/"
-#define SETTING_TIME_SHARE_LOCAL_PATH  "/usr/share/locale"
+#define SETTING_TIME_ZONEINFO_PATH             "/usr/share/zoneinfo/"
+#define SETTING_TIME_SHARE_LOCAL_PATH  "/usr/share/locale"
 #define SETTING_TZONE_SYMLINK_PATH             "/etc/localtime"
 
 
-static char *_get_cur_font();
-static void __font_size_set();
-static int __font_size_get();
-static char *_get_default_font();
-
-static bool font_config_set(char *font_name);
-static void font_config_set_notification();
 int _is_file_accessible(const char *path);
-int __is_available_font(char *font_name);
+
+bool dl_is_supported_image_type_load(char *path);
+bool dl_font_config_set(char *font_name);
+char *dl_get_font_info(char *str);
+int dl_is_available_font(char *str);
+void dl_font_size_set();
+void dl_font_config_set_notification();
+
 
 /**
  * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
  * @return the ringtone file path specified by user in normal case
- *         if it's not accessable, return the default ringtone path
+ *                if it's not accessable, return the default ringtone path
  */
 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
@@ -184,7 +160,7 @@ int system_setting_get_font_size(system_settings_key_e key, system_setting_data_
 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
        SETTING_TRACE_BEGIN;
-       char *font_name = _get_default_font();
+       char *font_name = dl_get_font_info("default");
        if (font_name) {
                *value = (void *)font_name;
                return SYSTEM_SETTINGS_ERROR_NONE;
@@ -197,7 +173,7 @@ int system_setting_get_default_font_type(system_settings_key_e key, system_setti
 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
        SETTING_TRACE_BEGIN;
-       char *font_name = _get_cur_font();
+       char *font_name = dl_get_font_info("cur");
        *value = (void *)font_name;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
@@ -326,48 +302,161 @@ int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_se
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
+bool dl_is_supported_image_type_load(char *path)
+{
+       void *handle = NULL;
+       char *error;
+       bool ret = false;
+       bool (*image_type_check)(char *path);
+
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return false;
+       }
+
+       image_type_check = dlsym(handle, "__is_supported_image_type_load");
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
+               if (handle)
+                       dlclose(handle);
+               return false;
+       }
+       ret = image_type_check(path);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
 
-bool __is_supported_image_type_load(char *path)
+int dl_is_available_font(char *str)
 {
-       SETTING_TRACE_BEGIN;
-       /*evas_init(); */
-       ecore_evas_init();
-       Ecore_Evas  *ee;
-       Evas        *evas;
+       void *handle = NULL;
+       char *error;
+       int ret = false;
+       int (*check_available_font)(char *font_name);
+
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return false;
+       }
 
-       ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
-       evas = ecore_evas_get(ee);
+       check_available_font = dlsym(handle, "__is_available_font");
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
+               if (handle)
+                       dlclose(handle);
+               return false;
+       }
+       ret = check_available_font(str);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
 
-       Evas_Object *img = evas_object_image_add(evas);
-       evas_object_image_file_set(img, path, NULL);
-       Evas_Load_Error ret = evas_object_image_load_error_get(img);
+void dl_font_size_set()
+{
+       void *handle = NULL;
+       char *error;
+       void (*set_font_size)();
 
-       bool result = false;
-       if (ret == EVAS_LOAD_ERROR_NONE) {
-               SETTING_TRACE("%s - OK", path);
-               result = true;
-       } else {
-               SETTING_TRACE("%s - NO", path);
-               result = false;
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return;
+       }
+
+       set_font_size = dlsym(handle, "__font_size_set");
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
+               if (handle)
+                       dlclose(handle);
+               return;
        }
-       ecore_evas_free(ee);
-       evas_shutdown();
-       return result;
+       set_font_size();
+       if (handle)
+               dlclose(handle);
+       return;
 }
 
-bool __is_supported_image_type(char *path)
+void dl_font_config_set_notification()
 {
-       SETTING_TRACE_BEGIN;
+       void *handle = NULL;
+       char *error;
+       void (*set_font_nodification)();
+
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return;
+       }
+
+       set_font_nodification = dlsym(handle, "font_config_set_notification");
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
+               if (handle)
+                       dlclose(handle);
+               return;
+       }
+       set_font_nodification();
+       if (handle)
+               dlclose(handle);
+       return;
+}
+
+bool dl_font_config_set(char *font_name)
+{
+       void *handle = NULL;
+       char *error;
        bool ret = false;
+       bool (*check_font_type)(char *font_name);
 
-       evas_init();
-       if (evas_object_image_extension_can_load_get(path))
-               ret = true;
-       else
-               ret = false;
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return false;
+       }
+
+       check_font_type = dlsym(handle, "font_config_set");
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
+               if (handle)
+                       dlclose(handle);
+               return false;
+       }
+       ret = check_font_type(font_name);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
+
+char *dl_get_font_info(char *str)
+{
+       void *handle = NULL;
+       char *error;
+       char *ret = NULL;
+       char *(*get_font_info)();
 
-       evas_shutdown();
+       handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
+       if (!handle) {
+               SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+               return false;
+       }
+
+       if (strcmp(str, "cur") == 0)
+               get_font_info = dlsym(handle, "_get_cur_font");
+       else
+               get_font_info = dlsym(handle, "_get_default_font");
 
+       if ((error = dlerror()) != NULL) {
+               SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
+               if (handle)
+                       dlclose(handle);
+               return false;
+       }
+       ret = get_font_info();
+       if (handle)
+               dlclose(handle);
        return ret;
 }
 
@@ -521,7 +610,7 @@ int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_s
        char *vconf_value;
        vconf_value = (char *)value;
 
-       bool isok  = __is_supported_image_type_load(vconf_value);
+       bool isok  = dl_is_supported_image_type_load(vconf_value);
        if (!isok) {
                /* not supported */
                SETTING_TRACE("path : %s is not supported file format", vconf_value);
@@ -575,11 +664,11 @@ int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_s
 
                /* Numbering rule: Gear is odd number */
                max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
-                               : max_image_num + 2;
+                                                       : max_image_num + 2;
 
                char file_name_buffer[512];
                snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
-                        _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
+                                       _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
 
                /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
                if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
@@ -601,7 +690,7 @@ int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_s
                }
 
                if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
-                                                      VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
+                                                                                                       VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                }
        } else {
@@ -620,7 +709,7 @@ int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_s
        char *vconf_value;
        vconf_value = (char *)value;
 
-       bool isok  = __is_supported_image_type_load(vconf_value);
+       bool isok  = dl_is_supported_image_type_load(vconf_value);
        if (!isok) {
                /* not supported */
                SETTING_TRACE("path : %s is not supported file format", vconf_value);
@@ -653,7 +742,7 @@ int system_setting_set_font_size(system_settings_key_e key, system_setting_data_
        if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       __font_size_set();
+       dl_font_size_set();
        SETTING_TRACE_END;
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
@@ -687,7 +776,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name)
 
        cur = cur->xmlChildrenNode;
 
-       Eina_Bool is_changed = EINA_FALSE;
+       bool is_changed = false;
        while (cur != NULL) {
                if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
                        cur2 = cur->xmlChildrenNode;
@@ -710,7 +799,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name)
                                                        key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
                                                        xmlFree(key);
                                                        key = NULL;
-                                                       is_changed = EINA_TRUE;
+                                                       is_changed = true;
                                                }
                                                cur3 = cur3->next;
                                        }
@@ -725,7 +814,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name)
                                        key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
                                        xmlFree(key);
                                        key = NULL;
-                                       is_changed = EINA_TRUE;
+                                       is_changed = true;
                                } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
                                        cur3 = cur2->xmlChildrenNode;
                                        while (cur3 != NULL) {
@@ -734,7 +823,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name)
                                                        key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
                                                        xmlFree(key);
                                                        key = NULL;
-                                                       is_changed = EINA_TRUE;
+                                                       is_changed = true;
                                                        cur3 = cur3->next;
                                                        return doc;
                                                }
@@ -763,7 +852,7 @@ int system_setting_set_font_type(system_settings_key_e key, system_setting_data_
        font_name = (char *)value;
 
        /* get current font list */
-       int is_found = __is_available_font(font_name);
+       int is_found = dl_is_available_font(font_name);
 
        if (is_found) {
                SETTING_TRACE("found font : %s ", font_name);
@@ -772,7 +861,7 @@ int system_setting_set_font_type(system_settings_key_e key, system_setting_data_
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       bool bsave = font_config_set(font_name);
+       bool bsave = dl_font_config_set(font_name);
 
        if (!bsave) {
                SETTING_TRACE(" font type save error by font_config_set() ");
@@ -788,7 +877,7 @@ int system_setting_set_font_type(system_settings_key_e key, system_setting_data_
                doc = NULL;
        }
 
-       font_config_set_notification();
+       dl_font_config_set_notification();
 
        char *vconf_value;
        vconf_value = (char *)value;
@@ -1026,416 +1115,6 @@ int system_setting_unset_changed_callback_motion_activation(system_settings_key_
        return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
 }
 
-static char *_get_cur_font()
-{
-       SETTING_TRACE_BEGIN;
-       xmlDocPtr doc = NULL;
-       xmlNodePtr cur = NULL;
-       xmlNodePtr cur2 = NULL;
-       xmlNodePtr cur3 = NULL;
-       xmlChar *key = NULL;
-
-       char *font_name = NULL;
-
-       doc = xmlParseFile(SETTING_FONT_CONF_FILE);
-
-       cur = xmlDocGetRootElement(doc);
-
-       if (cur == NULL) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       cur = cur->xmlChildrenNode;
-
-       while (cur != NULL) {
-               if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
-                       cur2 = cur->xmlChildrenNode;
-                       while (cur2 != NULL) {
-                               if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
-                                       cur3 = cur2->xmlChildrenNode;
-                                       while (cur3 != NULL) {
-                                               if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
-                                                       key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-
-                                                       font_name = g_strdup((char *)key);
-                                                       xmlFree(key);
-                                                       key = NULL;
-                                                       xmlFreeDoc(doc);
-                                                       doc = NULL;
-                                                       return font_name;
-                                               }
-                                               cur3 = cur3->next;
-                                       }
-                               }
-                               cur2 = cur2->next;
-                       }
-               }
-               cur = cur->next;
-       }
-
-       xmlFreeDoc(doc);
-       doc = NULL;
-       return NULL;
-}
-
-static void font_config_set_notification()
-{
-       SETTING_TRACE_BEGIN;
-#if 0
-       /* notification */
-       Ecore_X_Window ecore_win = ecore_x_window_root_first_get();
-       Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
-       ecore_x_window_prop_string_set(ecore_win, atom, "tizen");
-#endif
-}
-
-int __is_available_font(char *font_name)
-{
-       SETTING_TRACE_BEGIN;
-       FcObjectSet *os = NULL;
-       FcFontSet *fs = NULL;
-       FcPattern *pat = NULL;
-       FcConfig *font_config = NULL;
-
-       int ret = 0;
-
-       if (font_name == NULL)
-               return -1;
-
-       font_config = FcInitLoadConfigAndFonts();
-
-       /*setting_retvm_if(font_config == NULL, NULL, "Failed: FcInitLoadConfigAndFonts"); */
-
-       char *locale = setlocale(0, NULL);
-
-       pat = FcPatternCreate();
-
-       os = FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char *) 0);
-
-       if (os) {
-               fs = FcFontList(font_config, pat, os);
-               FcObjectSetDestroy(os);
-               os = NULL;
-       }
-
-       if (pat) {
-               FcPatternDestroy(pat);
-               pat = NULL;
-       }
-
-       if (fs) {
-               int j;
-               SETTING_TRACE("fs->nfont = %d", fs->nfont);
-
-               for (j = 0; j < fs->nfont; j++) {
-                       FcChar8 *family = NULL;
-                       FcChar8 *file = NULL;
-
-                       if (FcPatternGetString(fs->fonts[j], FC_FILE, 0, &file) == FcResultMatch) {
-                               int preload_path_len = strlen(SETTING_FONT_PRELOAD_FONT_PATH);
-                               int download_path_len = strlen(SETTING_FONT_DOWNLOADED_FONT_PATH);
-
-                               if (file && (!strncmp((const char *)file, SETTING_FONT_PRELOAD_FONT_PATH, preload_path_len)
-                                            || !strncmp((const char *)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) {
-                                       char *family_result = NULL;
-                                       FcChar8 *lang = NULL;
-                                       int id = 0;
-                                       if (FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
-                                               break;
-                                       }
-                                       if (FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
-                                               break;
-                                       }
-                                       family_result = (char *)family;
-
-                                       /* Find proper family name for current locale. */
-                                       while (locale && family && lang) {
-                                               if (!strncmp(locale, (char *)lang, strlen((char *)lang))) {
-                                                       family_result = (char *)family;
-                                                       break;
-                                               }
-
-                                               /* I will set english as default family language. */
-                                               /* If there is no proper family language for current locale, */
-                                               /* we have to show the english family name. */
-                                               if (!strcmp((char *)lang, "en")) {
-                                                       family_result = (char *)family;
-                                               }
-                                               id++;
-                                               if (FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) {
-                                                       break;
-                                               }
-                                               if (FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) {
-                                                       break;
-                                               }
-                                       }
-
-                                       if (family_result) {
-                                               SETTING_TRACE("-------- FONT - family_result = %s", (char *)family_result);
-                                               if (strcmp(family_result, font_name) == 0) {
-                                                       ret = 1;
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-               }
-               FcFontSetDestroy(fs);
-               fs = NULL;
-       }
-       FcConfigDestroy(font_config);
-       font_config = NULL;
-       return ret;
-}
-
-
-static char *_get_default_font()
-{
-       SETTING_TRACE_BEGIN;
-       xmlDocPtr doc = NULL;
-       xmlNodePtr cur = NULL;
-       xmlNodePtr cur2 = NULL;
-       xmlNodePtr cur3 = NULL;
-       xmlChar *key = NULL;
-       struct _xmlAttr *properties = NULL;
-       char *default_font_name = NULL;
-
-       doc = xmlParseFile(SETTING_DEFAULT_FONT_CONF_FILE);
-
-       cur = xmlDocGetRootElement(doc);
-
-       if (cur == NULL) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       cur = cur->xmlChildrenNode;
-
-       while (cur != NULL) {
-               if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
-                       cur2 = cur->xmlChildrenNode;
-                       while (cur2 != NULL) {
-                               if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
-                                       properties = cur2->properties;
-                                       /*find the "name" property*/
-                                       while (NULL != properties) {
-                                               if (!xmlStrcmp(properties->name, (const xmlChar *)"name")) {
-                                                       break;
-                                               }
-                                               properties = properties->next;
-                                       }
-
-                                       /*If the value of "name" property is "family", then get the child node string,
-                                       it shall be the default font type*/
-                                       if (NULL != properties && !xmlStrcmp(properties->children->content, (const xmlChar *)"family")) {
-                                               cur3 = cur2->xmlChildrenNode;
-                                               while (cur3 != NULL) {
-                                                       if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
-                                                               key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-                                                               default_font_name = g_strdup((char *)key);
-                                                               xmlFree(key);
-                                                               key = NULL;
-                                                               xmlFreeDoc(doc);
-                                                               doc = NULL;
-                                                               return default_font_name;
-                                                       }
-                                                       cur3 = cur3->next;
-                                               }
-                                       }
-                               }
-                               cur2 = cur2->next;
-                       }
-               }
-               cur = cur->next;
-       }
-
-       xmlFreeDoc(doc);
-       doc = NULL;
-       return NULL;
-}
-
-static bool font_config_set(char *font_name)
-{
-       SETTING_TRACE_BEGIN;
-       Eina_List *text_classes = NULL;
-       Elm_Text_Class *etc = NULL;
-       const Eina_List *l = NULL;
-       Eina_List *fo_list = NULL;
-       Elm_Font_Overlay *efo = NULL;
-
-       int font_size = __font_size_get();
-       int size = 0;
-
-       text_classes = elm_config_text_classes_list_get();
-
-       fo_list = (Eina_List *)elm_config_font_overlay_list_get();
-
-       Eina_List *ll = NULL;
-       Eina_List *l_next = NULL;
-
-       Eina_Bool slp_medium_exist = EINA_FALSE;
-       Eina_Bool slp_roman_exist = EINA_FALSE;
-       Eina_Bool slp_bold_exist = EINA_FALSE;
-       Eina_Bool slp_regular_exist = EINA_FALSE;
-
-       /* Tizen */
-       Eina_Bool tizen_exist = EINA_FALSE;
-
-       EINA_LIST_FOREACH_SAFE(fo_list, ll, l_next, efo) {
-               if (!strcmp(efo->text_class, "tizen_medium")) {
-                       elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
-                       slp_medium_exist = EINA_TRUE;
-               } else if (!strcmp(efo->text_class, "tizen_roman")) {
-                       elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
-                       slp_roman_exist = EINA_TRUE;
-               } else if (!strcmp(efo->text_class, "tizen_bold")) {
-                       elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
-                       slp_bold_exist = EINA_TRUE;
-               } else if (!strcmp(efo->text_class, "tizen_regular")) {
-                       elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
-                       slp_regular_exist = EINA_TRUE;
-               }
-
-               /* Tizen */
-               if (!strcmp(efo->text_class, "tizen")) {
-                       elm_config_font_overlay_set(efo->text_class, (const char *)font_name, efo->size);
-                       tizen_exist = EINA_TRUE;
-               }
-
-       }
-
-       /* if slp_XX do not exist, need to set them, font size is -100(100%) */
-       if (slp_medium_exist == EINA_FALSE) {
-               elm_config_font_overlay_set("tizen_medium", (const char *)font_name,  MIDDLE_FONT_DPI);
-       }
-       if (slp_roman_exist == EINA_FALSE) {
-               elm_config_font_overlay_set("tizen_roman", (const char *)font_name,  MIDDLE_FONT_DPI);
-       }
-       if (slp_bold_exist == EINA_FALSE) {
-               elm_config_font_overlay_set("tizen_bold", (const char *)font_name,  MIDDLE_FONT_DPI);
-       }
-       if (slp_regular_exist == EINA_FALSE) {
-               elm_config_font_overlay_set("tizen_regular", (const char *)font_name,  MIDDLE_FONT_DPI);
-       }
-
-       /* Tizen */
-       if (tizen_exist == EINA_FALSE) {
-               elm_config_font_overlay_set("tizen", (const char *)font_name,  MIDDLE_FONT_DPI);
-       }
-
-       elm_config_font_overlay_set("tizen", (const char *)font_name,  MIDDLE_FONT_DPI);
-
-       /* Tizen */
-       elm_config_font_overlay_set("tizen", (const char *)font_name,  MIDDLE_FONT_DPI);
-
-       EINA_LIST_FOREACH(text_classes, l, etc) {
-               ll = NULL;
-
-               size = font_size;
-               EINA_LIST_FOREACH(fo_list, ll, efo) {
-                       if (!strcmp(etc->name, efo->text_class)) {
-                               size = efo->size;
-                       }
-               }
-               elm_config_font_overlay_set(etc->name, (const char *)font_name, size);
-       }
-       elm_config_text_classes_list_free(text_classes);
-       text_classes = NULL;
-
-       /* add new function */
-#ifdef USE_EFL_ASSIST
-       ea_theme_system_font_set(font_name, font_size);
-       ea_theme_system_fonts_apply();
-#endif
-
-       elm_config_font_overlay_apply();
-       elm_config_all_flush();
-       elm_config_save();
-       return 1;
-}
-
-static void __font_size_set()
-{
-       SETTING_TRACE_BEGIN;
-       Eina_List *text_classes = NULL;
-       Elm_Text_Class *etc = NULL;
-       const Eina_List *l = NULL;
-       int font_size = __font_size_get();
-       char *font_name = _get_cur_font();
-
-       if (font_size == -1) {
-               return;
-       }
-
-       text_classes = elm_config_text_classes_list_get();
-
-       EINA_LIST_FOREACH(text_classes, l, etc) {
-               elm_config_font_overlay_set(etc->name, font_name, font_size);
-       }
-
-       elm_config_text_classes_list_free(text_classes);
-
-#ifdef USE_EFL_ASSIST
-       ea_theme_system_font_set(font_name, font_size);
-       ea_theme_system_fonts_apply();
-#endif
-
-       elm_config_font_overlay_apply();
-       elm_config_all_flush();
-       elm_config_save();
-
-       text_classes = NULL;
-       g_free(font_name);
-}
-
-static int __font_size_get()
-{
-       SETTING_TRACE_BEGIN;
-       int font_size = -1;
-
-       int vconf_value = -1;
-       if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
-               return -1;
-       }
-
-       switch (vconf_value) {
-       case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
-               font_size = SMALL_FONT_DPI;
-               break;
-       case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
-               font_size = MIDDLE_FONT_DPI;
-               break;
-       case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
-               font_size = LARGE_FONT_DPI;
-               break;
-       case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
-               font_size = HUGE_FONT_DPI;
-               break;
-       case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
-               font_size = GIANT_FONT_DPI;
-               break;
-       default:
-               font_size = MIDDLE_FONT_DPI;
-               break;
-       }
-       return font_size;
-}
-
 /*//////////////////////////////////////////////////////////////////////////////////////// */
 /*--------------------------------------- */
 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
@@ -1596,24 +1275,43 @@ int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settin
 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
 {
        SETTING_TRACE_BEGIN;
-#if 0
-       char tzpath[256];
-       ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
-       if (len != -1) {
-               tzpath[len] = '\0';
-       } else {
-               SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-       /* "/usr/share/zoneinfo/Asia/Seoul" */
-       SETTING_TRACE("tzpath : %s ", &tzpath[20]);
-       *value = strdup(&tzpath[20]);
-#else
        *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
-#endif
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
+int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+       SETTING_TRACE_BEGIN;
+       char *vconf_value = NULL;
+       vconf_value = (char *)value;
+
+       char tz_path[1024];
+       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", vconf_value);
+
+       int is_load = _is_file_accessible(tz_path);
+       if (is_load == 0) {
+               alarmmgr_set_timezone(tz_path);
+
+               if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+               return SYSTEM_SETTINGS_ERROR_NONE;
+       }
+       return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+}
+
+
+
+int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+       return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
+}
+
+int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
+{
+       return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
+}
+
 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
 {
        SETTING_TRACE_BEGIN;