[refactoring] reduce length of value name and log 14/234314/6 submit/tizen/20200602.052302
authorYoungjae Shin <yj99.shin@samsung.com>
Mon, 25 May 2020 10:34:25 +0000 (19:34 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 2 Jun 2020 02:34:07 +0000 (11:34 +0900)
Change-Id: Ica4c98755b5bc0074ce00083c37d0b2c3e8ab141

38 files changed:
CMakeLists.txt
common/sst_define.h
common/sst_log.h
packaging/capi-system-system-settings.spec
src/sst_api.c
src/sst_core.c
src/sst_core.h
src/sst_exclusive.h [new file with mode: 0644]
src/sst_feature.c
src/sst_feature.h
src/sst_font.c
src/sst_font.h
src/sst_interface.c
src/sst_interface.h
src/sst_json.c
src/sst_json.h
src/sst_ringtones.c
src/sst_ringtones.h
src/sst_screen.c
src/sst_screen.h
src/sst_time_N_locale.c
src/sst_time_N_locale.h
src/sst_utils.c
src/sst_utils.h
src/sst_vconf.c
src/sst_vconf.h
src/standard_excl/sst_standard.c [new file with mode: 0644]
src/wearable_excl/sst_wearable.c [new file with mode: 0644]
tests/mocks/libc.c
tests/mocks/pkgmgrinfo_appinfo.c
tests/mocks/vconf.cpp
tests/sstt.h [moved from tests/sys_settings_test.h with 88% similarity]
tests/sstt_main.c [moved from tests/sys_settings_test_fw.c with 93% similarity]
tests/sstt_test.c [moved from tests/sys_settings_test.c with 99% similarity]
tests/sys_settings_test_fw.h [deleted file]
utils/sstu.c [moved from utils/sys_settings_util.c with 58% similarity]
utils/sstu.h [moved from utils/sys_settings_util.h with 72% similarity]
utils/sstu_font.h [moved from utils/sys_settings_font.h with 100% similarity]

index b26420b..7ba0667 100644 (file)
@@ -22,25 +22,30 @@ ADD_DEFINITIONS("-D_TZ_SYS_DATA=\"${TZ_SYS_DATA}\"")
 ADD_DEFINITIONS("-D_TZ_SYS_ETC=\"${TZ_SYS_ETC}\"")
 ADD_DEFINITIONS("-D_TZ_SYS_RO_SHARE=\"${TZ_SYS_RO_SHARE}\"")
 ADD_DEFINITIONS("-D_TZ_SYS_SHARE=\"${TZ_SYS_SHARE}\"")
-ADD_DEFINITIONS("-DSETTING_DEF_RES=\"${SETTING_DEF_RES}\"")
-
-IF(TIZEN_WEARABLE)
-       ADD_DEFINITIONS(-DTIZEN_WEARABLE)
-ENDIF(TIZEN_WEARABLE)
-IF(TIZEN_MOBILE)
-       ADD_DEFINITIONS(-DTIZEN_MOBILE)
-ENDIF(TIZEN_MOBILE)
+ADD_DEFINITIONS("-DSST_RES_DIR=\"${SST_RES_DIR}\"")
 
 IF(STDOUT_LOG)
        ADD_DEFINITIONS("-DSST_STDOUT")
 ENDIF(STDOUT_LOG)
 
 FILE(GLOB SRCS src/*.c)
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET(COMMON_OBJ "SST_COMMON")
+ADD_LIBRARY(${COMMON_OBJ} OBJECT ${SRCS})
+SET_TARGET_PROPERTIES(${COMMON_OBJ} PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+FILE(GLOB STD_SRCS src/standard_excl/*.c)
+ADD_LIBRARY(${PROJECT_NAME} ${STD_SRCS} $<TARGET_OBJECTS:${COMMON_OBJ}>)
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LIBRARIES})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
-
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+
+#FILE(GLOB WEARABLE_SRCS src/wearable_excl/*.c)
+#SET(WEARABLE_LIB "${PROJECT_NAME}-wearable")
+#ADD_LIBRARY(${WEARABLE_LIB} ${WEARABLE_SRCS} $<TARGET_OBJECTS:${COMMON_OBJ}>)
+#TARGET_LINK_LIBRARIES(${WEARABLE_LIB} ${pkgs_LIBRARIES})
+#SET_TARGET_PROPERTIES(${WEARABLE_LIB} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+#INSTALL(TARGETS ${WEARABLE_LIB} DESTINATION ${LIB_INSTALL_DIR})
+
 FILE(GLOB HEADERS include/*.h)
 INSTALL(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/system)
 
index ac6d57b..b1ca4cf 100644 (file)
 #endif
 #define API __attribute__((visibility("default")))
 
-#ifndef SETTING_DEF_RES
-#define SETTING_DEF_RES "/opt/usr/data/settings"
-#warning "SETTING_DEF_RES is redefined"
-#endif
-#define DEFAULT_RINGTONE_DIR SETTING_DEF_RES"/Ringtones"
+#define SST_EQUAL 0
 
-#define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
-#define SST_RINGTONE_JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
+#ifndef SST_RES_DIR
+#define SST_RES_DIR "/opt/usr/data/settings"
+#warning "SST_RES_DIR is redefined"
+#endif
+#define SST_DEFAULT_RINGTONE_DIR SST_RES_DIR"/Ringtones"
 
+#ifndef _TZ_SYS_ETC
+#define _TZ_SYS_ETC "/opt/etc"
+#warning "_TZ_SYS_ETC is redefined"
+#endif
 #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_TIME_ZONEINFO_PATH             "/usr/share/zoneinfo/"
+#define SETTING_TIME_ZONEINFO_PATH             "/usr/share/zoneinfo"
 #define SETTING_TIME_SHARE_LOCAL_PATH  "/usr/share/locale"
 #define SETTING_TZONE_SYMLINK_PATH             "/opt/etc/localtime"
 
index 688c5cb..7a44524 100644 (file)
@@ -44,8 +44,7 @@
 #define __INFO(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
 #define __WARN(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
 #define __ERR(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
-#define __SECU_DBG(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
-#define __SECU_INFO(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
+#define __SECU_ERR(fmt, arg...) printf("[SST]%s(%d):" fmt "\n", __FILENAME__, __LINE__, ##arg)
 #else
 #define LOG_TAG "SYSTEM-SETTINGS"
 #include <dlog.h>
@@ -53,7 +52,7 @@
 #define __INFO(fmt, arg...) SLOGI(fmt, ##arg)
 #define __WARN(fmt, arg...) SLOGW(fmt, ##arg)
 #define __ERR(fmt, arg...) SLOGE(fmt, ##arg)
-#define __SECU_DBG(fmt, arg...) SECURE_SLOGD(fmt, ##arg)
+#define __SECU_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
 #endif /* SST_STDOUT */
 
 #ifdef SST_TEST
 #define WARN(fmt, arg...) _WARN(fmt, ##arg)
 #define ERR(fmt, arg...) _ERR(fmt, ##arg)
 #define INFO(fmt, arg...) _INFO(fmt, ##arg)
-#define SST_SECURE_TRACE(fmt, arg...) __SECU_DBG(SST_LOG_GREEN fmt SST_LOG_END, ##arg)
+#define SECURE_ERR(fmt, arg...) __SECU_ERR(SST_LOG_GREEN fmt SST_LOG_END, ##arg)
 
 #else /* SST_DEBUGGING */
 #define DBG(fmt, arg...)
 #define WARN(fmt, arg...)
 #define ERR(fmt, arg...)
 #define INFO(fmt, arg...)
-#define SECURE_DBG(fmt, arg...)
 #define SECURE_ERR(fmt, arg...)
 
 #endif /* SST_DEBUGGING */
index 3ff6522..fd82f1d 100644 (file)
@@ -101,7 +101,7 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
        -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \
        -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
        -DTEST_INSTALL_DIR:PATH=%{sys_setting_test_dir} \
-       -DSETTING_DEF_RES=%{TZ_SYS_GLOBALUSER_DATA}/settings \
+       -DSST_RES_DIR=%{TZ_SYS_GLOBALUSER_DATA}/settings \
        -DSTDOUT_LOG=%{?stdlog:1}%{!?stdlog:0} \
 %if 0%{?thread_number}
        -DN_THREADS=%{thread_number}
index 63faf1e..a91388c 100644 (file)
 
 API int system_settings_set_value_int(system_settings_key_e key, int value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
+
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
+       //todo: need to revise
        int *ptr = &value;
        int **p_ptr = &ptr;
-       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void*)p_ptr);
+
+       ret = sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void*)p_ptr);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_set_value(%d) Fail(%d)", key, ret);
+               return ret;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 API int system_settings_get_value_int(system_settings_key_e key, int *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
+       int ret;
        int value_int = 0;
        int *ptr = &value_int;
        int **p_ptr = &ptr;
-       int ret = 0;
+
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+
        ret = sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void **)p_ptr);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_value(%d) Fail(%d)", key, ret);
+               return ret;
+       }
        *value = value_int;
-       return ret;
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 API int system_settings_set_value_bool(system_settings_key_e key, bool value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
        bool *ptr = &value;
-       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void*)ptr);
+       int ret = sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void*)ptr);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("sst_set_value(%d), Fail(%d)", key, ret);
+
+       return ret;
 }
 
 API int system_settings_get_value_bool(system_settings_key_e key, bool *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       SST_SECURE_TRACE(" SIGNED LONG here ******************* log here *************** ");
-       signed long flag = 0;
-
        int ret;
+       signed long flag = 0;
 
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
        ret = sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void **)&flag);
-       SST_SECURE_TRACE(" inf (flag) value : %ld ", flag);
+       SECURE_ERR(" inf (flag) value : %ld ", flag);
        if (flag == 0) {
                *value = false;
-               SST_SECURE_TRACE(" flag == 0 ");
+               SECURE_ERR(" flag == 0 ");
        } else if (flag == 1) {
                *value = true;
-               SST_SECURE_TRACE(" flag == 1 ");
+               SECURE_ERR(" flag == 1 ");
        } else {
                *value = false;
-               SST_SECURE_TRACE(" exception here!!! ");
+               SECURE_ERR(" exception here!!! ");
        }
 
        return ret;
@@ -87,195 +104,204 @@ API int system_settings_get_value_bool(system_settings_key_e key, bool *value)
 
 API int system_settings_set_value_string(system_settings_key_e key, const char *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETVM_IF(key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "The defualt font type is only support getter");
 
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret = sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("sst_set_value(%d), Fail(%d)", key, ret);
 
-       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
+       return ret;
 }
 
 API int system_settings_get_value_string(system_settings_key_e key, char **value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+
+       int ret = sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void **)value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("sst_get_value(%d), Fail(%d)", key, ret);
 
-       return sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void **)value);
+       return ret;
 }
 
+//todo: need to deprecate
 API int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_h system_setting_item;
-       system_setting_set_changed_callback_cb system_setting_set_changed_cb;
-
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
 
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETVM_IF(key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "The defualt font type is only supporting getter");
+       RETV_IF(NULL == callback, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       system_setting_set_changed_cb = system_setting_item->set_changed_cb;
-
-       /* Store the callback function from application side */
-       if (callback)
-               system_setting_item->changed_cb = callback;
-
-       if (user_data)
-               system_setting_item->user_data = user_data;
-
-       if (system_setting_set_changed_cb == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR);
+       sst_set_changed_cb_fn subscriber = iface->set_changed_cb;
+       if (NULL == subscriber) {
+               ERR("NULL set_changed_cb of key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       return system_setting_set_changed_cb(system_setting_item, user_data);
+       iface->changed_cb = callback;
+       iface->user_data = user_data;
+
+       return subscriber(iface, user_data);
 }
 
+//todo: need to deprecate
 API int system_settings_unset_changed_cb(system_settings_key_e key)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_h system_setting_item;
-       system_setting_unset_changed_callback_cb system_setting_unset_changed_cb;
-
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETVM_IF(key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "The defualt font type is only support getter");
+
+       sst_interface *iface = NULL;
+       int ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       system_setting_unset_changed_cb = system_setting_item->unset_changed_cb;
-
-       /* free the callback function from application side */
-       if (system_setting_item->changed_cb)
-               system_setting_item->changed_cb = NULL;
-       /*----------------------------------------------------- */
-
-       if (system_setting_unset_changed_cb == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR);
+       sst_unset_changed_cb_fn unsubscriber = iface->unset_changed_cb;
+       if (NULL == unsubscriber) {
+               ERR("NULL unset_changed_cb of key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       return system_setting_unset_changed_cb(system_setting_item);
+       iface->changed_cb = NULL;
+       iface->user_data = NULL;
+
+       return unsubscriber(iface);
 }
 
 API int system_settings_foreach_value_string(system_settings_key_e key, system_settings_iter_cb callback, void *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
        return sst_list_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, callback, (void*)value);
 }
 
 API int system_settings_add_value_string(system_settings_key_e key, const char* value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "Invalid Key(%d)", key);
 
        return sst_add_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
 }
 
 API int system_settings_delete_value_string(system_settings_key_e key, const char* value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "Invalid Key(%d)", key);
 
        return sst_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
 }
 
 API int system_settings_add_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_h system_setting_item;
-
-       if (callback == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
 
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETVM_IF(key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "The defualt font type is only support getter");
+       RETV_IF(NULL == callback, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       if (system_setting_item->vconf_key == NULL)
+       if (iface->vconf_key == NULL) {
+               ERR("NULL vconf_key of key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
-       ERR("[%s] key = %d %s", __FUNCTION__, key, system_setting_item->vconf_key);
+       INFO("key = %d, %s", key, iface->vconf_key);
 
-       /* Store the callback function from application side */
-       ret = sst_utils_add_multi_cb(&system_setting_item->changed_cb_list, callback, user_data);
-       if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to add muti-callback for the system settings", __FUNCTION__, ret);
+       ret = sst_utils_add_multi_cb(&iface->changed_cb_list, callback, user_data);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_utils_add_multi_cb() Fail(%d)", ret);
                return ret;
        }
 
-       if (!system_setting_item->changed_cb_list.is_registered) {
-               int ret = system_setting_vconf_set_changed_multi_cb(system_setting_item->vconf_key, key);
-               if (ret == SYSTEM_SETTINGS_ERROR_NONE)
-                       system_setting_item->changed_cb_list.is_registered = 1;
-               ERR("Leave [%s]", __FUNCTION__);
-               return ret;
+       if (!iface->changed_cb_list.is_registered) {
+               ret = sst_vconf_set_multi_changed_cb(iface->vconf_key, key);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("sst_vconf_set_multi_changed_cb(%s) Fail(%d)", iface->vconf_key, ret);
+                       return ret;
+               }
+               iface->changed_cb_list.is_registered = 1;
        }
 
-       ERR("Leave [%s]", __FUNCTION__);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 API int system_settings_remove_changed_cb(system_settings_key_e key, system_settings_changed_cb callback)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_h system_setting_item;
-
-       if (callback == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
 
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETVM_IF(key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER,
+               "The defualt font type is only support getter");
+       RETV_IF(NULL == callback, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       sst_utils_del_multi_cb(&system_setting_item->changed_cb_list, callback);
+       ret = sst_utils_del_multi_cb(&iface->changed_cb_list, callback);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_utils_del_multi_cb() Fail(%d)", ret);
+               return ret;
+       }
 
-       if (system_setting_item->changed_cb_list.list == NULL) {
-               int ret = 0;
-               if (system_setting_item->vconf_key == NULL)
+       if (iface->changed_cb_list.list == NULL) {
+               if (iface->vconf_key == NULL) {
+                       ERR("NULL vconf_key");
                        return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-               ret = system_setting_vconf_unset_changed_multi_cb(system_setting_item->vconf_key, key);
-               if (ret == SYSTEM_SETTINGS_ERROR_NONE)
-                       system_setting_item->changed_cb_list.is_registered = 0;
-               ERR("Leave [%s]", __FUNCTION__);
-               return ret;
+               }
+               ret = sst_vconf_unset_multi_changed_cb(iface->vconf_key, key);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("sst_vconf_unset_multi_changed_cb(%s) Fail(%d)", iface->vconf_key, ret);
+                       return ret;
+               }
+               iface->changed_cb_list.is_registered = 0;
        }
 
-       ERR("Leave [%s]", __FUNCTION__);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
index 13ba3d1..f0ba32c 100644 (file)
 #include "sst_vconf.h"
 #include "sst_interface.h"
 
-int sst_get_value(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+int sst_get_value(system_settings_key_e key, sst_interface_data_type data_type, void **value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
 
-       system_setting_h system_setting_item;
-       system_setting_get_value_cb     system_setting_getter;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETV_IF(NULL == value, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
 
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) {
-                       sst_dump_context_node(key);
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-               }
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       if (system_setting_item->data_type != data_type) {
-               sst_dump_context_node(key);
-               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type --- key:(%d), datatype:(%d)", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, key, data_type);
+       if (iface->data_type != data_type) {
+               ERR("Invalide type for key(%d) : Expected(%d), Actual(%d)",
+                       key, iface->data_type, data_type);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       system_setting_getter = system_setting_item->get_value_cb;
-
-       if (system_setting_getter == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       sst_get_value_fn getter = iface->get_value_cb;
+       if (NULL == getter) {
+               ERR("No getter for key(%d)", key);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
        }
 
-       return system_setting_getter(system_setting_item, value);
+       ret = getter(iface, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("getter(%d) Fail(%d)", key, ret);
+       return ret;
 }
 
-int sst_set_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+int sst_set_value(system_settings_key_e key, sst_interface_data_type data_type, void *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       system_setting_h system_setting_item;
-       system_setting_set_value_cb     system_setting_setter;
+       int ret;
 
-       int ret = system_settings_get_item(key, &system_setting_item);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       RETV_IF(NULL == value, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
 
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       /* type check */
-       if (system_setting_item->data_type != data_type) {
-               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       if (iface->data_type != data_type) {
+               ERR("Invalide type for key(%d) : Expected(%d), Actual(%d)",
+                       key, iface->data_type, data_type);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       system_setting_setter = system_setting_item->set_value_cb;
-
-       if (system_setting_setter == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
+       sst_set_value_fn setter = iface->set_value_cb;
+       if (NULL == setter) {
+               ERR("No setter for key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
        }
 
-       return system_setting_setter(system_setting_item, value);
+       ret = setter(iface, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("setter(%d) Fail(%d)", key, ret);
+       return ret;
 }
 
-int sst_list_value(system_settings_key_e key, system_setting_data_type_e data_type, bool(*system_setting_data_iterator)(int, const char*, void *), void *user_data)
+int sst_list_value(system_settings_key_e key, sst_interface_data_type data_type, bool(*list_iterator_fn)(int, const char*, void *), void *user_data)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       system_setting_h system_setting_item;
-       system_setting_list_value_cb    system_setting_lister;
+       int ret;
 
-       int ret = system_settings_get_item(key, &system_setting_item);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("INVALID_PARAMETER(0x%08x) : invalid key", ret);
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       /* type check */
-       if (system_setting_item->data_type != data_type) {
-               ERR("INVALID_PARAMETER(0x%08x) : invalid data type", SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       if (iface->data_type != data_type) {
+               ERR("Invalide type for key(%d) : Expected(%d), Actual(%d)",
+                       key, iface->data_type, data_type);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       //system_setting_list_value_cb list_changed_cb;
-       system_setting_lister = system_setting_item->list_value_cb;
-
-       if (system_setting_lister == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
+       sst_list_value_cb list_getter = iface->list_value_cb;
+       if (NULL == list_getter) {
+               ERR("No list_getter for key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
        }
 
-       return system_setting_lister(key, system_setting_data_iterator, user_data);
+       ret = list_getter(key, list_iterator_fn, user_data);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("list_getter(%d) Fail(%d)", key, ret);
+       return ret;
 }
 
-////////////////////////////////////////////////////////////////////////////////////
-// list
-////////////////////////////////////////////////////////////////////////////////////
-
-int sst_add_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+int sst_add_value(system_settings_key_e key, sst_interface_data_type data_type, void *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       int ret;
 
-       system_setting_h system_setting_item;
-       system_setting_add_value_cb     system_setting_adder;
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
-       int ret = system_settings_get_item(key, &system_setting_item);
-
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
                return ret;
        }
 
-       /* type check */
-       if (system_setting_item->data_type != data_type) {
-               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       if (iface->data_type != data_type) {
+               ERR("Invalide type for key(%d) : Expected(%d), Actual(%d)",
+                       key, iface->data_type, data_type);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       system_setting_adder = system_setting_item->add_value_cb;
-
-       if (system_setting_adder == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
+       sst_add_value_fn        adder = iface->add_value_cb;
+       if (NULL == adder) {
+               ERR("No adder for key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
        }
 
-       return system_setting_adder(key, value);
+       ret = adder(key, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("adder(%d) Fail(%d)", key, ret);
+       return ret;
 }
 
-int sst_del_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+int sst_del_value(system_settings_key_e key, sst_interface_data_type data_type, void *value)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       system_setting_h system_setting_item;
-       system_setting_del_value_cb     system_setting_deler;
-
-       int ret = system_settings_get_item(key, &system_setting_item);
-
-       if (0 != ret) {
-               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       int ret;
+
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
+       
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(key, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", key, ret);
+               return ret;
        }
 
-       /* type check */
-       if (system_setting_item->data_type != data_type) {
-               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       if (iface->data_type != data_type) {
+               ERR("Invalide type for key(%d) : Expected(%d), Actual(%d)",
+                       key, iface->data_type, data_type);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       system_setting_deler = system_setting_item->del_value_cb;
-
-       if (system_setting_deler == NULL) {
-               ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED);
+       sst_del_value_fn        deleter;
+       deleter = iface->del_value_cb;
+       if (NULL == deleter) {
+               ERR("No deleter for key(%d)", key);
                return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
        }
 
-       return system_setting_deler(key, value);
+       ret = deleter(key, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("deleter(%d) Fail(%d)", key, ret);
+       return ret;
+
 }
 
 /**
- * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL(==item->vconf_key) b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
- *
- * a == false, b == false --> silent mode
- * a == true, b == false --> sound mode
- * a == false, b == true --> vibration mode
+ * sound == false, vibration == false --> silent mode
+ * sound == true, vibration == false --> sound mode
+ * sound == false, vibration == true --> vibration mode
  */
-int system_setting_get_sound_silent_mode(system_setting_h item, void **value)
+int sst_get_sound_silent_mode(sst_interface *iface, void **value)
 {
-       bool sound_cond;
-       bool vib_cond;
-
-       bool vconf_value;
-       if (sst_vconf_get_real_bool(item->vconf_key, &sound_cond))
+       bool sound_status = false;
+       if (sst_vconf_get_real_bool(iface->vconf_key, &sound_status)) {
+               ERR("sst_vconf_get_real_bool(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (sst_vconf_get_real_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond))
+       bool vib_status = false;
+       const char *vibration_key = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL;
+       if (sst_vconf_get_real_bool(vibration_key, &vib_status)) {
+               ERR("sst_vconf_get_real_bool(%s) Fail", vibration_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (sound_cond == false && vib_cond == false) {
-               vconf_value = true;
-               *value = (void*)vconf_value;
-       } else {
-               vconf_value = false;
-               *value = (void*)vconf_value;
        }
+
+       bool ret_val = (sound_status == false && vib_status == false);
+       *value = (void*)ret_val;
+
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 /**
- * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL(==item->vconf_key) b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
- *
- * a == false, b == false --> silent mode
- * a == true, b == false --> sound mode
+ * sound == false, vibration == false --> silent mode
+ * sound == true, vibration == false --> sound mode
  */
-int system_setting_set_sound_silent_mode(system_setting_h item, void *value)
+//Todo: It should return to the old status.
+int sst_set_sound_silent_mode(sst_interface *iface, void *value)
 {
        bool *vconf_value = value;
 
-       bool vconf_sound = false;
-       bool vconf_vib = false;
-
-       if (*vconf_value) {
-               vconf_sound = false;
-               vconf_vib = false;
-       } else {
-               vconf_sound = true;
-               vconf_vib = false;
-       }
-
-       if (vconf_set_bool(item->vconf_key, vconf_sound))
+       bool vconf_sound = !(*vconf_value);
+       if (vconf_set_bool(iface->vconf_key, vconf_sound)) {
+               ERR("vconf_set_bool(%s, %d) Fail", iface->vconf_key, vconf_sound);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib))
+       bool vconf_vib = false;
+       const char *vibration_key = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL;
+       if (vconf_set_bool(vibration_key, vconf_vib)) {
+               ERR("vconf_set_bool(%s) Fail", vibration_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_sound_notification(system_setting_h item, void *value)
+int sst_set_sound_notification(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       int is_load = sst_is_valid_file(vconf_value);
-       if (is_load == 0) {
-               //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
-               if (vconf_set_str(item->vconf_key, vconf_value)) {
-                       //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
+       bool is_valid = sst_utils_exist(vconf_value);
+       if (true == is_valid) {
+               if (vconf_set_str(iface->vconf_key, vconf_value)) {
+                       ERR("vconf_set_str(%s, %s) Fail", iface->vconf_key, vconf_value);
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                }
        } else {
-               //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
+               ERR("sst_utils_exist(%s) Fail", vconf_value);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_device_name(system_settings_key_e key, void *value)
+int sst_set_device_name(system_settings_key_e key, void *value)
 {
        char *vconf_value = value;
 
-       if (vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value))
+       const char *vconf_key = VCONFKEY_SETAPPL_DEVICE_NAME_STR;
+       if (vconf_set_str(vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s, %s) Fail", vconf_key, vconf_value);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_network_wifi_notification(system_setting_h item, void **value)
+int sst_get_network_wifi_notification(sst_interface *iface, void **value)
 {
-       int vconf_value;
-       if (vconf_get_int(item->vconf_key, &vconf_value))
+       int vconf_value = 0;
+       if (vconf_get_int(iface->vconf_key, &vconf_value)) {
+               ERR("vconf_get_int(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       bool bret;
-       bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
+       bool result;
+       result = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
 
-       *value = (void*)bret;
+       *value = (void*)result;
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-
+//It is related with Advertisements
 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
-
-int system_setting_get_ads_id(system_setting_h item, void **value)
+int sst_get_ads_id(sst_interface *iface, void **value)
 {
-       int optout_value = 0;
-       if (vconf_get_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value))
+       int result = 0;
+       const char *key = VCONFKEY_SETAPPL_AD_ID_OPT_OUT;
+       if (vconf_get_int(key, &result)) {
+               ERR("vconf_get_int(%s) Fail", key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (optout_value == 1) {
+       if (result == 1) {
                *value = strdup(DEFAULT_ADS_ID);
                return SYSTEM_SETTINGS_ERROR_NONE;
        }
 
        char *vconf_value = NULL;
-       if (sst_vconf_get_string(item->vconf_key, &vconf_value))
+       if (sst_vconf_get_string(iface->vconf_key, &vconf_value)) {
+               ERR("sst_vconf_get_string(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        *value = vconf_value;
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-#if DEBUG_DUMP_CONTEXT
-void make_ad_id(void)
-{
-       uuid_t uuid_value;
-       char uuid_unparsed[50] = {0};
-       uuid_generate(uuid_value);
-       uuid_unparse(uuid_value, uuid_unparsed);
-       system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
-}
-#endif
-int system_setting_set_ads_id(system_setting_h item, void *value)
+int sst_set_ads_id(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       if (vconf_set_str(item->vconf_key, vconf_value)) {
-               SST_SECURE_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
+       if (vconf_set_str(iface->vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_uds_state(system_setting_h item, void **value)
+int sst_get_uds_state(sst_interface *iface, void **value)
 {
        int **p_value = (int**)value;
-       int vconf_value;
-       char *vconf_string_value = NULL;
+       int int_val;
+       char *str_val = NULL;
 
-       if (vconf_get_int(item->vconf_key, &vconf_value))
+       if (vconf_get_int(iface->vconf_key, &int_val))
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
 
-       SST_SECURE_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
+       if (int_val == SYSTEM_SETTINGS_UDS_ON) {
+               const char *vconf_key = VCONFKEY_SETAPPL_UDSM_PKGID_LIST;
+               int ret = sst_vconf_get_string(vconf_key, &str_val);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("sst_vconf_get_string(%s) Fail(%d)", vconf_key, ret);
+                       return ret;
+               }
 
-       if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
-               if (sst_vconf_get_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               if (SST_EQUAL != strcmp(str_val, "NONE")) {
+                       char *app_id = NULL;
+                       char *package_id = NULL;
+                       pid_t pid = getpid();
 
-               if (vconf_string_value) {
-                       if (!strcmp(vconf_string_value, "NONE")) {
-                               vconf_value = SYSTEM_SETTINGS_UDS_ON;
-                       } else {
-                               char *app_id = NULL;
-                               char *package_id = NULL;
-                               pid_t pid = getpid();
-
-                               int ret = app_manager_get_app_id(pid, &app_id);
-                               if (ret != APP_MANAGER_ERROR_NONE) {
-                                       free(vconf_string_value);
-                                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-                               }
-
-                               if (app_id) {
-                                       int result = 0;
-                                       result = package_manager_get_package_id_by_app_id(app_id, &package_id);
-                                       if (result != PACKAGE_MANAGER_ERROR_NONE) {
-                                               SST_SECURE_TRACE("package_manager_get_package_id_by_app_id returned error! %d", result);
-                                               free(app_id);
-                                               free(vconf_string_value);
-                                               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-                                       }
-
-                                       SST_SECURE_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value);
-                               }
-
-                               if (package_id && strstr(vconf_string_value, package_id)) {
-                                       vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
-                                       SST_SECURE_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id);
-                               } else {
-                                       vconf_value = SYSTEM_SETTINGS_UDS_ON;
-                               }
+                       int ret = app_manager_get_app_id(pid, &app_id);
+                       if (ret != APP_MANAGER_ERROR_NONE) {
+                               SECURE_ERR("app_manager_get_app_id(%d) Fail(%d)", pid, ret);
+                               free(str_val);
+                               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                        }
-                       free(vconf_string_value);
+
+                       ret = package_manager_get_package_id_by_app_id(app_id, &package_id);
+                       if (PACKAGE_MANAGER_ERROR_NONE != ret) {
+                               SECURE_ERR("package_manager_get_package_id_by_app_id(%s) Fail(%d)", app_id, ret);
+                               free(app_id);
+                               free(str_val);
+                               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+                       }
+                       free(app_id);
+
+                       if (package_id && strstr(str_val, package_id))
+                               int_val = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
+                       free(package_id);
                }
+               free(str_val);
        }
 
-       **p_value = vconf_value;
+       **p_value = int_val;
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
index 09e0e98..97f5051 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef __TIZEN_SYSTEM_SETTING_PRIVATE_H__
-#define __TIZEN_SYSTEM_SETTING_PRIVATE_H__
+#pragma once
 
 #include "sst_interface.h"
 
-/**
- * @internal
- * @brief get current UDS status
- * @since_tizen 3.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_uds_state(system_setting_h item, void **value);
-
-/**
- * @internal
- * @brief get current ADS ID
- * @since_tizen 3.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_ads_id(system_setting_h item, void **value);
-
-/**
- * @internal
- * @brief set ADS ID
- * @since_tizen 3.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_ads_id(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_sound_notification(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_network_wifi_notification(system_setting_h item, void **value);
+int sst_set_value(system_settings_key_e key, sst_interface_data_type data_type, void *value);
+int sst_get_value(system_settings_key_e key, sst_interface_data_type data_type, void **value);
+int sst_add_value(system_settings_key_e key, sst_interface_data_type data_type, void *value);
+int sst_del_value(system_settings_key_e key, sst_interface_data_type data_type, void *value);
+int sst_list_value(system_settings_key_e key, sst_interface_data_type data_type, bool(*system_setting_data_iterator)(int, const char*, void *), void *user_data);
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_sound_silent_mode(system_setting_h item, void **value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_sound_silent_mode(system_setting_h item, void *value);
 
-int sst_set_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value);
-int sst_get_value(system_settings_key_e key, system_setting_data_type_e data_type, void **value);
-int sst_add_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value);
-int sst_del_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value);
-int sst_list_value(system_settings_key_e key, system_setting_data_type_e data_type, bool(*system_setting_data_iterator)(int, const char*, void *), void *user_data);
-/*// */
+int sst_get_network_wifi_notification(sst_interface *iface, void **value);
 
+int sst_set_sound_notification(sst_interface *iface, void *value);
+int sst_get_sound_silent_mode(sst_interface *iface, void **value);
+int sst_set_sound_silent_mode(sst_interface *iface, void *value);
 
+int sst_get_ads_id(sst_interface *iface, void **value);
+int sst_set_ads_id(sst_interface *iface, void *value);
 
-#endif /* __TIZEN_SYSTEM_SETTING_PRIVATE_H__ */
+int sst_get_uds_state(sst_interface *iface, void **value);
\ No newline at end of file
diff --git a/src/sst_exclusive.h b/src/sst_exclusive.h
new file mode 100644 (file)
index 0000000..034caf2
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+
+int sst_excl_set_wallpaper(const char *key, const char *val);
\ No newline at end of file
index 76f981e..8a5a9ee 100644 (file)
 #include "sst.h"
 #include "sst_interface.h"
 
-#define SETTING_INCOMING_CALL_PATH "tizen.org/feature/systemsetting.incoming_call"
-#define SETTING_HOME_SCREEN_PATH "tizen.org/feature/systemsetting.home_screen"
-#define SETTING_LOCK_SCREEN_PATH "tizen.org/feature/systemsetting.lock_screen"
-#define SETTING_NOTIFICATION_EMAIL_PATH "tizen.org/feature/systemsetting.notification_email"
-#define SETTING_WIFI_PATH "tizen.org/feature/network.wifi"
-#define SETTING_FONT_PATH "tizen.org/feature/systemsetting.font"
-#define SETTING_TELEPHONY_PATH "tizen.org/feature/network.telephony"
-#define SETTING_ACCESSIBILITY_GRAYSCALE_PATH "tizen.org/feature/accessibility.grayscale"
-#define SETTING_ACCESSIBILITY_NEGATIVE_PATH "tizen.org/feature/accessibility.negative"
-#define SETTING_INPUT_ROTATING_BEZEL_PATH "tizen.org/feature/input.rotating_bezel"
-#define SETTING_PROFILE_PATH "tizen.org/feature/profile"
-
-int system_settings_feature_check_bool(char *path)
+#define SST_FEATURE_ACCESSIBILITY_GRAYSCALE "tizen.org/feature/accessibility.grayscale"
+#define SST_FEATURE_ACCESSIBILITY_NEGATIVE "tizen.org/feature/accessibility.negative"
+#define SST_FEATURE_FONT "tizen.org/feature/systemsetting.font"
+#define SST_FEATURE_HOME_SCREEN "tizen.org/feature/systemsetting.home_screen"
+#define SST_FEATURE_INCOMING_CALL "tizen.org/feature/systemsetting.incoming_call"
+#define SST_FEATURE_INPUT_ROTATING_BEZEL "tizen.org/feature/input.rotating_bezel"
+#define SST_FEATURE_LOCK_SCREEN "tizen.org/feature/systemsetting.lock_screen"
+#define SST_FEATURE_NOTIFICATION_EMAIL "tizen.org/feature/systemsetting.notification_email"
+#define SST_FEATURE_PROFILE "tizen.org/feature/profile"
+#define SST_FEATURE_TELEPHONY "tizen.org/feature/network.telephony"
+#define SST_FEATURE_WIFI "tizen.org/feature/network.wifi"
+
+static int _check_feature(const char *path)
 {
        bool feature_data = false;
        int ret = system_info_get_platform_bool(path, &feature_data);
        if (ret != SYSTEM_INFO_ERROR_NONE) {
-               SST_SECURE_TRACE("Setting - reading feature data failed, %d", ret);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               ERR("system_info_get_platform_bool(%s) Fail(%d)", path, ret);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-
-       return ret;
+       if (feature_data) {
+               return SYSTEM_SETTINGS_ERROR_NONE;
+       } else {
+               ERR("Not Support Feature(%s)", path);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       }
 }
 
-int system_setting_feature_check_incoming_call(void *value)
+int sst_feature_check_incoming_call(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_INCOMING_CALL_PATH);
+               const char *feature = SST_FEATURE_INCOMING_CALL;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_home_screen(void *value)
+int sst_feature_check_home_screen(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_HOME_SCREEN_PATH);
+               const char *feature = SST_FEATURE_HOME_SCREEN;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_lock_screen(void *value)
+int sst_feature_check_lock_screen(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_LOCK_SCREEN_PATH);
+               const char *feature = SST_FEATURE_LOCK_SCREEN;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_notification_email(void *value)
+int sst_feature_check_notification_email(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_NOTIFICATION_EMAIL_PATH);
+               const char *feature = SST_FEATURE_NOTIFICATION_EMAIL;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_wifi(void *value)
+int sst_feature_check_wifi(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_WIFI_PATH);
+               const char *feature = SST_FEATURE_WIFI;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_telephony(void *value)
+int sst_feature_check_telephony(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_TELEPHONY_PATH);
+               const char *feature = SST_FEATURE_TELEPHONY;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_font(void *value)
+int sst_feature_check_font(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_FONT_PATH);
+               const char *feature = SST_FEATURE_FONT;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_accessibility_grayscale(void *value)
+int sst_feature_check_accessibility_grayscale(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_GRAYSCALE_PATH);
+               const char *feature = SST_FEATURE_ACCESSIBILITY_GRAYSCALE;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_accessibility_negative(void *value)
+int sst_feature_check_accessibility_negative(void *value)
 {
        static bool first_query = true;
        static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_NEGATIVE_PATH);
+               const char *feature = SST_FEATURE_ACCESSIBILITY_NEGATIVE;
+               ret = _check_feature(feature);
+               if (SYSTEM_SETTINGS_ERROR_IO_ERROR == ret) {
+                       ERR("_check_feature(%s) Fail(%d)", feature, ret);
+                       return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+               }
                first_query = false;
        }
 
        return ret;
 }
 
-int system_setting_feature_check_wearable_profile(void *value)
+int sst_feature_check_rotary(void *value)
 {
        static bool first_query = true;
-       static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       static int result = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
 
        if (first_query == true) {
-               char *profile_data = NULL;
-               int rotary_feature = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-               ret = system_info_get_platform_string(SETTING_PROFILE_PATH, &profile_data);
+               char *profile = NULL;
+               const char *feature = SST_FEATURE_PROFILE;
+               int ret = system_info_get_platform_string(feature, &profile);
                if (ret != SYSTEM_INFO_ERROR_NONE) {
-                       SST_SECURE_TRACE("Setting - reading profile string failed, %d", ret);
+                       ERR("system_info_get_platform_string(%s) Fail(%d)", feature, ret);
                        return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
                }
 
-               rotary_feature = system_settings_feature_check_bool(SETTING_INPUT_ROTATING_BEZEL_PATH);
-
-               if ((rotary_feature == SYSTEM_SETTINGS_ERROR_NONE) && profile_data && !strcmp(profile_data, "wearable"))
-                       ret = SYSTEM_SETTINGS_ERROR_NONE;
-               else
-                       ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-
-               if (profile_data)
-                       free(profile_data);
-
+               if (profile && SST_EQUAL == strcmp(profile, "wearable")) {
+                       int can_rotary = _check_feature(SST_FEATURE_INPUT_ROTATING_BEZEL);
+                       if (can_rotary == SYSTEM_SETTINGS_ERROR_IO_ERROR) {
+                               ERR("system_info_get_platform_string(%s) Fail(%d)", feature, ret);
+                               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+                       }
+                       result = can_rotary;
+               }
+               free(profile);
                first_query = false;
        }
 
-       return ret;
+       return result;
 }
index 239bd55..2ed59da 100644 (file)
  */
 #pragma once
 
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_incoming_call(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_home_screen(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_lock_screen(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_notification_email(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_wifi(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_telephony(void *value);
-
-/**
- * @internal
- * @since_tizen 4.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_font(void *value);
-
-/**
- * @internal
- * @since_tizen 5.5
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_accessibility_grayscale(void *value);
-
-/**
- * @internal
- * @since_tizen 5.5
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_accessibility_negative(void *value);
-
-/**
- * @internal
- * @since_tizen 5.5
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_setting_feature_check_wearable_profile(void *value);
\ No newline at end of file
+int sst_feature_check_incoming_call(void *value);
+int sst_feature_check_home_screen(void *value);
+int sst_feature_check_lock_screen(void *value);
+int sst_feature_check_notification_email(void *value);
+int sst_feature_check_wifi(void *value);
+int sst_feature_check_telephony(void *value);
+int sst_feature_check_font(void *value);
+int sst_feature_check_accessibility_grayscale(void *value);
+int sst_feature_check_accessibility_negative(void *value);
+int sst_feature_check_rotary(void *value);
\ No newline at end of file
index 9b3e0c8..409df27 100644 (file)
 #include <vconf.h>
 #include "sst.h"
 
+static const char* const sst_utils_library = SETTING_UTILS_SO_FILE_PATH;
+
 static int dl_is_available_font(char *str)
 {
        void *handle = NULL;
        char *error;
-       int ret = false;
+       int ret = 0;
        int (*check_available_font)(char *font_name);
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
-               return false;
+       handle = dlopen(sst_utils_library, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail", sst_utils_library);
+               return 0;
        }
 
-       check_available_font = dlsym(handle, "__is_available_font");
+       check_available_font = dlsym(handle, "sstu_is_available_font");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
-               return false;
+               ERR("dlsym(sstu_is_available_font) Fail(%s)", error);
+               dlclose(handle);
+               return 0;
        }
        ret = check_available_font(str);
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return ret;
 }
 
@@ -52,22 +52,20 @@ static void dl_font_size_set()
        char *error;
        void(*set_font_size)();
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
+       handle = dlopen(sst_utils_library, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail", sst_utils_library);
                return;
        }
 
-       set_font_size = dlsym(handle, "__font_size_set");
+       set_font_size = dlsym(handle, "sstu_set_font_size");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
+               ERR("dlsym(sstu_set_font_size) Fail(%s)", error);
+               dlclose(handle);
                return;
        }
        set_font_size();
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return;
 }
 
@@ -77,22 +75,20 @@ static void dl_font_config_set_notification()
        char *error;
        void (*set_font_nodification)();
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
+       handle = dlopen(sst_utils_library, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail", sst_utils_library);
                return;
        }
 
-       set_font_nodification = dlsym(handle, "font_config_set_notification");
+       set_font_nodification = dlsym(handle, "sstu_font_config_set_notification");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
+               ERR("dlsym(sstu_font_config_set_notification) Fail(%s)", error);
+               dlclose(handle);
                return;
        }
        set_font_nodification();
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return;
 }
 
@@ -103,22 +99,20 @@ static bool dl_font_config_set(char *font_name)
        bool ret = false;
        bool (*check_font_type)(char *font_name);
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
+       handle = dlopen(sst_utils_library, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail", sst_utils_library);
                return false;
        }
 
-       check_font_type = dlsym(handle, "font_config_set");
+       check_font_type = dlsym(handle, "sstu_set_font_config");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
+               ERR("dlsym(sstu_set_font_config) Fail(%s)", error);
+               dlclose(handle);
                return false;
        }
        ret = check_font_type(font_name);
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return ret;
 }
 
@@ -129,36 +123,35 @@ static char *dl_get_default_font_info()
        char *ret = NULL;
        char *(*get_font_info)();
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
-               return false;
+       handle = dlopen(sst_utils_library, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail", sst_utils_library);
+               return NULL;
        }
 
-       get_font_info = dlsym(handle, "_get_default_font");
-
+       get_font_info = dlsym(handle, "sstu_get_default_font");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
-               return false;
+               ERR("dlsym(sstu_get_default_font) Fail(%s)", error);
+               dlclose(handle);
+               return NULL;
        }
        ret = get_font_info();
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return ret;
 }
 
-int system_setting_set_font_size(system_setting_h item, void *value)
+int sst_font_set_size(sst_interface *iface, void *value)
 {
        int *vconf_value;
        vconf_value = *(int **)value;
 
-       if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       RETVM_IF(*vconf_value < 0 || SYSTEM_SETTINGS_FONT_SIZE_GIANT < *vconf_value,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid value(%d)", *vconf_value);
 
-       if (vconf_set_int(item->vconf_key, *vconf_value))
+       if (vconf_set_int(iface->vconf_key, *vconf_value)) {
+               ERR("vconf_set_int(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        dl_font_size_set();
        return SYSTEM_SETTINGS_ERROR_NONE;
@@ -259,28 +252,24 @@ static void* font_conf_doc_parse(char *doc_name, char *font_name)
        }
 }
 
-int system_setting_set_font_type(system_setting_h item, void *value)
+int sst_font_set_type(sst_interface *iface, void *value)
 {
        char *font_name = NULL;
        font_name = (char*)value;
 
        /* get current font list */
        int is_found = dl_is_available_font(font_name);
-
        if (is_found == 1) {
-               SST_SECURE_TRACE("found font : %s ", font_name);
+               DBG("found font : %s ", font_name);
        } else {
-               SST_SECURE_TRACE(" NOT found font : %s ", font_name);
+               ERR(" NOT found font : %s ", font_name);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        bool bsave = dl_font_config_set(font_name);
-
        if (!bsave) {
-               SST_SECURE_TRACE(" font type save error by font_config_set() ");
+               ERR("dl_font_config_set() Fail");
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               SST_SECURE_TRACE(" save OK - font_config_set() ");
        }
 
        xmlDocPtr doc = font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
@@ -294,20 +283,22 @@ int system_setting_set_font_type(system_setting_h item, void *value)
 
        char *vconf_value;
        vconf_value = (char*)value;
-
-       if (vconf_set_str(item->vconf_key, vconf_value))
+       if (vconf_set_str(iface->vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_default_font_type(system_setting_h item, void **value)
+int sst_font_get_default_type(sst_interface *iface, void **value)
 {
        char *font_name = dl_get_default_font_info();
-       if (font_name) {
-               *value = (void*)font_name;
-               return SYSTEM_SETTINGS_ERROR_NONE;
-       } else {
+       if (NULL == font_name) {
+               ERR("dl_get_default_font_info() Fail");
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
+
+       *value = (void*)font_name;
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
index 01935ba..25391b0 100644 (file)
  */
 #pragma once
 
-#include "sst_core.h"
+#include "sst_interface.h"
 
-/**
- * @internal
- * @brief set current font size
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_FONT_SIZE
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_INT
- * @param[out] value the font size
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_font_size(system_setting_h item, void *value);
-
-/**
- * @internal
- * @brief set name of the font name
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_FONT_TYPE
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_STRING
- * @param[out] value the font type
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_font_type(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_default_font_type(system_setting_h item, void **value);
+int sst_font_set_size(sst_interface *iface, void *value);
+int sst_font_set_type(sst_interface *iface, void *value);
+int sst_font_get_default_type(sst_interface *iface, void **value);
index 0a01952..757b28f 100644 (file)
@@ -33,15 +33,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
                VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_incoming_call_ringtone,
-               system_setting_set_incoming_call_ringtone,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_ringtone_get_incoming_call,
+               sst_ringtone_set_incoming_call,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
-               system_setting_add_incoming_call_ringtone,      /* ADD */
-               system_setting_del_incoming_call_ringtone,      /* DEL */
-               system_setting_list_incoming_call_ringtone,     /* LIST */
-               system_setting_feature_check_incoming_call,             /* feature check */
+               sst_ringtone_add_incoming_call, /* ADD */
+               sst_ringtone_del_incoming_call, /* DEL */
+               sst_ringtone_list_incoming_call,        /* LIST */
+               sst_feature_check_incoming_call,                /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -50,15 +50,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN,
                VCONFKEY_BGSET,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_vconf,
-               system_setting_set_wallpaper_home_screen,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_screen_set_home_wallpaper,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_home_screen,               /* feature check */
+               sst_feature_check_home_screen,          /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -67,15 +67,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN,
                VCONFKEY_IDLE_LOCK_BGSET,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_vconf,
-               system_setting_set_wallpaper_lock_screen,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_screen_set_lock_wallpaper,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_lock_screen,               /* feature check */
+               sst_feature_check_lock_screen,          /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -84,15 +84,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_FONT_SIZE,
                VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_vconf,
-               system_setting_set_font_size,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_font_set_size,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_font,              /* feature check */
+               sst_feature_check_font,         /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -101,15 +101,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_FONT_TYPE,
                VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_vconf,
-               system_setting_set_font_type,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_font_set_type,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_font,              /* feature check */
+               sst_feature_check_font,         /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -118,10 +118,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION,
                VCONFKEY_SETAPPL_MOTION_ACTIVATION,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -135,15 +135,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE,
                VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_email_alert_ringtone,
-               system_setting_set_email_alert_ringtone,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_ringtone_get_email_alert,
+               sst_ringtone_set_email_alert,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_notification_email,                /* feature check */
+               sst_feature_check_notification_email,           /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -151,10 +151,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED,
                VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -167,10 +167,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED,
                VCONFKEY_3G_ENABLE,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -186,15 +186,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP,
                VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_lockscreen_app,
-               system_setting_set_lockscreen_app,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_screen_get_lockscreen,
+               sst_screen_set_lockscreen,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_lock_screen,               /* feature check */
+               sst_feature_check_lock_screen,          /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -202,7 +202,7 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,
                NULL,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_default_font_type,
+               sst_font_get_default_type,
                NULL,
                NULL,
                NULL,
@@ -210,7 +210,7 @@ struct _system_setting_s system_setting_table[] = {
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_font,              /* feature check */
+               sst_feature_check_font,         /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -218,10 +218,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY,
                VCONFKEY_REGIONFORMAT,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_locale_country,
-               system_setting_set_locale_country,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_locale_get_country,
+               sst_locale_set_country,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -234,10 +234,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE,
                VCONFKEY_LANGSET,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_locale_language,
-               system_setting_set_locale_language,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_locale_get_language,
+               sst_locale_set_language,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -250,10 +250,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
                VCONFKEY_REGIONFORMAT_TIME1224,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_locale_timeformat_24hour,
-               system_setting_set_locale_timeformat_24hour,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_locale_get_timeformat_24hour,
+               sst_locale_set_timeformat_24hour,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -266,10 +266,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE,
                VCONFKEY_SETAPPL_TIMEZONE_ID,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_locale_timezone,
-               system_setting_set_locale_timezone,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_locale_get_timezone,
+               sst_locale_set_timezone,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -282,10 +282,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_TIME_CHANGED,
                VCONFKEY_SYSTEM_TIME_CHANGED,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_time_changed,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               NULL,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -298,10 +298,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SOUND_LOCK,
                VCONFKEY_SETAPPL_SOUND_LOCK_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
+               sst_vconf_get,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -314,10 +314,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE,
                VCONFKEY_SETAPPL_SOUND_STATUS_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_sound_silent_mode,
-               system_setting_set_sound_silent_mode,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_get_sound_silent_mode,
+               sst_set_sound_silent_mode,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -330,10 +330,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SOUND_TOUCH,
                VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -346,10 +346,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO,
                VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -362,10 +362,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_DEVICE_NAME,
                VCONFKEY_SETAPPL_DEVICE_NAME_STR,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_vconf,
+               sst_vconf_get,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -378,10 +378,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_MOTION_ENABLED,
                VCONFKEY_SETAPPL_MOTION_ACTIVATION,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
+               sst_vconf_get,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -394,15 +394,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION,
                VCONFKEY_WIFI_ENABLE_QS,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_network_wifi_notification,
+               sst_get_network_wifi_notification,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_wifi,              /* feature check */
+               sst_feature_check_wifi,         /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -410,10 +410,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE,
                VCONFKEY_TELEPHONY_FLIGHT_MODE,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
+               sst_vconf_get,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -426,10 +426,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME,
                VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_vconf,
-               system_setting_set_screen_backlight_time,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_screen_set_backlight_time,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -442,15 +442,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION,
                VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_vconf,
-               system_setting_set_sound_notification,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_set_sound_notification,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_incoming_call,             /* feature check */
+               sst_feature_check_incoming_call,                /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -458,10 +458,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD,
                VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -474,10 +474,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_LOCK_STATE,
                VCONFKEY_IDLE_LOCK_STATE_READ_ONLY,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* add */
                NULL,           /* del */
@@ -490,10 +490,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ADS_ID,
                VCONFKEY_SETAPPL_AD_ID,
                SYSTEM_SETTING_DATA_TYPE_STRING,
-               system_setting_get_ads_id,
-               system_setting_set_ads_id,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_get_ads_id,
+               sst_set_ads_id,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* add */
                NULL,           /* del */
@@ -507,15 +507,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE,
                VCONFKEY_SETAPPL_UDSM,
                SYSTEM_SETTING_DATA_TYPE_INT,
-               system_setting_get_uds_state,
+               sst_get_uds_state,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* add */
                NULL,           /* del */
                NULL,           /* list */
-               system_setting_feature_check_telephony,         /* feature check */
+               sst_feature_check_telephony,            /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -525,13 +525,13 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTING_DATA_TYPE_STRING,
                NULL,
                NULL,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* add */
                NULL,           /* del */
                NULL,           /* list */
-               system_setting_feature_check_telephony,         /* feature check */
+               sst_feature_check_telephony,            /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -539,10 +539,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS,
                VCONFKEY_SETAPPL_ACCESSIBILITY_TTS,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -555,10 +555,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_VIBRATION,
                VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -571,15 +571,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE,
                VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_telephony,         /* feature check */
+               sst_feature_check_telephony,            /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -587,10 +587,10 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE,
                VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
@@ -603,15 +603,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE,
                VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_accessibility_grayscale,           /* feature check */
+               sst_feature_check_accessibility_grayscale,              /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -619,15 +619,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR,
                VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_accessibility_negative,            /* feature check */
+               sst_feature_check_accessibility_negative,               /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -635,15 +635,15 @@ struct _system_setting_s system_setting_table[] = {
                SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED,
                VCONFKEY_SETAPPL_ROTARY_EVENT_ENABLED_BOOL,
                SYSTEM_SETTING_DATA_TYPE_BOOL,
-               system_setting_get_vconf,
-               system_setting_set_vconf,
-               system_setting_set_changed_vconf_genernal_callback,
-               system_setting_unset_changed_vconf_genernal_callback,
+               sst_vconf_get,
+               sst_vconf_set,
+               sst_vconf_set_changed_cb,
+               sst_vconf_unset_changed_cb,
                NULL,
                NULL,           /* ADD */
                NULL,           /* DEL */
                NULL,           /* LIST */
-               system_setting_feature_check_wearable_profile,          /* feature check */
+               sst_feature_check_rotary,               /* feature check */
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
@@ -652,87 +652,7 @@ struct _system_setting_s system_setting_table[] = {
        }
 };
 
-
-#if DEBUG_DUMP_CONTEXT
-static void _dump_context()
-{
-       int i;
-       /*int max = SYSTEM_SETTINGS_MAX; */
-       int max = sizeof(system_setting_table) / sizeof(struct _system_setting_s) - 1;
-
-       for (i = 0; i < max; i++) {
-               ERR("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key);
-               ERR("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type);
-               ERR("[%s] system_setting_table[i].get_value_cb = %x", __FUNCTION__, system_setting_table[i].get_value_cb);
-               ERR("[%s] system_setting_table[i].set_value_cb = %x", __FUNCTION__, system_setting_table[i].set_value_cb);
-
-               ERR("[%s] system_setting_table[i].set_changed_cb = %x <---", __FUNCTION__, system_setting_table[i].set_changed_cb);
-               ERR("[%s] system_setting_table[i].unset_changed_cb = %x", __FUNCTION__, system_setting_table[i].unset_changed_cb);
-               ERR("[%s] system_setting_table[i].changed_cb = %x", __FUNCTION__, system_setting_table[i].changed_cb);
-       }
-}
-#endif
-
-int sst_dump_context_node(int key)
-{
-       int index = 0;
-
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       while (system_setting_table[index].key != SYSTEM_SETTINGS_MAX) {
-               if (system_setting_table[index].key == key) {
-                       int i = index;
-                       ERR("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key);
-                       ERR("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type);
-                       ERR("[%s] system_setting_table[i].get_value_cb = %p", __FUNCTION__, system_setting_table[i].get_value_cb);
-                       ERR("[%s] system_setting_table[i].set_value_cb = %p", __FUNCTION__, system_setting_table[i].set_value_cb);
-                       ERR("[%s] system_setting_table[i].set_changed_cb = %p <---", __FUNCTION__, system_setting_table[i].set_changed_cb);
-                       ERR("[%s] system_setting_table[i].unset_changed_cb = %p", __FUNCTION__, system_setting_table[i].unset_changed_cb);
-                       ERR("[%s] system_setting_table[i].changed_cb = %p", __FUNCTION__, system_setting_table[i].changed_cb);
-                       return 0;
-               }
-               index++;
-       }
-
-       return -1;
-}
-#if 0
-int system_settings_get_item(system_settings_key_e key, system_setting_h *item)
-{
-       ERR("Enter [%s], key=%d", __FUNCTION__, key);
-
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
-               ERR("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key);
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       }
-#if DEBUG_DUMP_CONTEXT
-       _dump_context();
-#endif
-       int index = 0;
-       while (system_setting_table[index].key != SYSTEM_SETTINGS_MAX) {
-               if (system_setting_table[index].key == key) {
-                       *item = &system_setting_table[index];
-                       ERR("Enter [%s], index = %d, key = %d, type = %d", __FUNCTION__, index, key, (*item)->data_type);
-                       if (system_setting_table[index].feature_check_cb != NULL) {
-                               int ret = system_setting_table[index].feature_check_cb(item);
-                               if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
-                                       ERR("Not supported API, because there is no feature!");
-
-                               return ret;
-                       } else {
-                               return SYSTEM_SETTINGS_ERROR_NONE;
-                       }
-               }
-
-               index++;
-       }
-
-       return TIZEN_ERROR_INVALID_PARAMETER;
-}
-#else
-
-static int binary_search_for_item(system_settings_key_e key)
+static int _search_item(system_settings_key_e key)
 {
        int start = 0;
        int end = SYSTEM_SETTINGS_KEY_MAX;
@@ -747,34 +667,32 @@ static int binary_search_for_item(system_settings_key_e key)
                        end = mid - 1;
        }
 
-       ERR("Enter [%s], key=%d, Can NOT find the key", __FUNCTION__, key);
+       ERR("key=%d, Can NOT find the key", key);
        return -1;
 }
 
-int system_settings_get_item(system_settings_key_e key, system_setting_h *item)
+int sst_get_interface(system_settings_key_e key, sst_interface **iface)
 {
-       ERR("Enter [%s], key=%d", __FUNCTION__, key);
+       DBG("Enter");
+       RETVM_IF(key < 0 || SYSTEM_SETTINGS_KEY_MAX <= key,
+               SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, "Invalid Key(%d)", key);
 
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) {
-               ERR("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key);
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       }
-#if DEBUG_DUMP_CONTEXT
-       _dump_context();
-#endif
-       int idx = binary_search_for_item(key);
-       if (-1 == idx)
+       int idx = _search_item(key);
+       if (-1 == idx) {
+               ERR("Unknown key(%d)", key);
                return TIZEN_ERROR_INVALID_PARAMETER;
+       }
 
-       *item = &system_setting_table[idx];
-       ERR("Enter [%s],  key = %d, type = %d", __FUNCTION__, key, (*item)->data_type);
        if (system_setting_table[idx].feature_check_cb != NULL) {
-               int ret = system_setting_table[idx].feature_check_cb(item);
-               if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED)
-                       ERR("Not supported API, because there is no feature!");
-
-               return ret;
+               int ret = system_setting_table[idx].feature_check_cb(iface);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("feature_check_cb(%d) Fail(%d)", key, ret);
+                       return ret;
+               }
        }
+
+       *iface = &system_setting_table[idx];
+       INFO("key = %d, type = %d", key, (*iface)->data_type);
+
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
-#endif
index 4b33aa3..f5adb61 100644 (file)
 #include <glib.h>
 #include "system_settings.h"
 
-/**
- * @internal
- * @since_tizen 2.3
- * Enumeration for data type of internal getter/setter.
- */
 typedef enum {
        SYSTEM_SETTING_DATA_TYPE_STRING,        /**< string */
        SYSTEM_SETTING_DATA_TYPE_INT,           /**< integer */
@@ -31,104 +26,46 @@ typedef enum {
        /*SYSTEM_SETTING_DATA_TYPE_FLOAT, */
        /*SYSTEM_SETTING_DATA_TYPE_DOULBE, */
 #endif
-} system_setting_data_type_e;
-
-typedef struct _system_setting_s *system_setting_h;
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-typedef int (*system_setting_get_value_cb)(system_setting_h item, void **value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-typedef int (*system_setting_set_value_cb)(system_setting_h item, void *value);
-typedef int (*system_setting_add_value_cb)(system_settings_key_e key, void *value);
-typedef int (*system_setting_del_value_cb)(system_settings_key_e key, void *value);
-typedef int (*system_setting_list_value_cb)(system_settings_key_e key, system_settings_iter_cb callback, void *user_data);
+} sst_interface_data_type;
 
-typedef int (*system_setting_feature_check_cb)(void *value);
+typedef struct _system_setting_s sst_interface;
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-typedef int (*system_setting_set_changed_callback_cb)(system_setting_h item, void *user_data);
+typedef int (*sst_get_value_fn)(sst_interface *iface, void **value);
+typedef int (*sst_set_value_fn)(sst_interface *iface, void *value);
+typedef int (*sst_add_value_fn)(system_settings_key_e key, void *value);
+typedef int (*sst_del_value_fn)(system_settings_key_e key, void *value);
+typedef int (*sst_list_value_cb)(system_settings_key_e key, system_settings_iter_cb callback, void *user_data);
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-typedef int (*system_setting_unset_changed_callback_cb)(system_setting_h item);
+typedef int (*sst_check_feature_fn)(void *value);
+typedef int (*sst_set_changed_cb_fn)(sst_interface *iface, void *user_data);
+typedef int (*sst_unset_changed_cb_fn)(sst_interface *iface);
 
 typedef struct __st_multi_callback_list_ {
        GList *list;
        int is_registered;
 } callback_list;
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- */
 struct _system_setting_s {
-       system_settings_key_e key;                                                                              /**< key */
-       const char* const vconf_key;                                                                    /**< vconf key */
-       system_setting_data_type_e data_type;                                                   /**< data type */
-       system_setting_get_value_cb get_value_cb;                                               /**< function pointer for getter */
-       system_setting_set_value_cb set_value_cb;                                               /**< function pointer for setter */
+       system_settings_key_e key;
+       const char* const vconf_key;
+       sst_interface_data_type data_type;
 
-       system_setting_set_changed_callback_cb set_changed_cb;                  /**< function pointer to register for notification callback */
-       system_setting_unset_changed_callback_cb unset_changed_cb;              /**< function pointer to un-register for notification callback */
-       system_settings_changed_cb changed_cb;                                                  /* registered by user application */
+       sst_get_value_fn get_value_cb;
+       sst_set_value_fn set_value_cb;
 
-       system_setting_add_value_cb add_value_cb;
-       system_setting_del_value_cb del_value_cb;
-       system_setting_list_value_cb list_value_cb;
+    sst_set_changed_cb_fn set_changed_cb;
+       sst_unset_changed_cb_fn unset_changed_cb;
+       system_settings_changed_cb changed_cb;          /* registered by user application */
 
-       system_setting_feature_check_cb feature_check_cb;
+       sst_add_value_fn add_value_cb;
+       sst_del_value_fn del_value_cb;
+       sst_list_value_cb list_value_cb;
+
+       sst_check_feature_fn feature_check_cb;
 
        callback_list changed_cb_list;
 
-       void *user_data;                                                                                                /* user_data */
+       void *user_data;
 };
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_settings_get_item(system_settings_key_e key, system_setting_h *item);
-
-int sst_dump_context_node(int key);
\ No newline at end of file
+int sst_get_interface(system_settings_key_e key, sst_interface **iface);
\ No newline at end of file
index 24ccd65..679d18b 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <vconf.h>
+#include "sst_json.h"
 
+#include <json-glib/json-glib.h>
+#include <vconf.h>
 #include "sst.h"
-#include "sst_core.h"
-#include "sst_json.h"
 
-static void ss_json_ringtone_save(JsonNode *root)
+struct sst_json_s {
+       JsonParser *parser;
+       JsonNode *root;
+};
+
+static void _json_save_ringtone(JsonNode *root)
 {
-       // write here
        JsonGenerator *generator = json_generator_new();
        json_generator_set_root(generator, root);
-       json_generator_set_pretty(generator, TRUE);
-#ifdef USE_JSONFILE
-       GError *error = NULL;
-       gboolean ret = json_generator_to_file(generator, filename, &error);
-#else
-       gchar *result = json_generator_to_data(generator, NULL);
-       vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST, (char*)result);
-#endif
+       gchar *data = json_generator_to_data(generator, NULL);
+       DBG("ringtone json : %s", data);
+
+       const char *key = VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST;
+       if (vconf_set_str(key, data))
+               ERR("vconf_set_str(%s) Fail", key);
+       g_free(data);
        g_object_unref(generator);
 }
 
-JsonParser* ss_json_ringtone_open_file(char *path)
+sst_json_h* sst_json_load_ringtone()
 {
-       JsonParser *parser;
-       //JsonNode *root;
-       GError *error;
-
-       parser = json_parser_new();
+       GError *error = NULL;
+       sst_json_h *handle = calloc(1, sizeof(struct sst_json_s));
+       if (NULL == handle) {
+               ERR("calloc() Fail");
+               return NULL;
+       }
+       char *load_data = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST);
 
-       error = NULL;
-       json_parser_load_from_file(parser, path, &error);
+       handle->parser = json_parser_new();
+       json_parser_load_from_data(handle->parser, load_data, -1, &error);
+       free(load_data);
        if (error) {
-               SST_SECURE_TRACE("Unable to parse `%s': %s\n", path, error->message);
+               ERR("json_parser_load_from_data() Fail(%s)", error->message);
                g_error_free(error);
-               g_object_unref(parser);
+               g_object_unref(handle->parser);
+               free(handle);
                return NULL;
        }
+       handle->root = json_parser_get_root(handle->parser);
 
-       return parser;
+       return handle;
 }
 
-JsonParser* ss_json_ringtone_load_from_data()
+void sst_json_unref(sst_json_h *handle)
 {
-       JsonParser *parser;
-       //JsonNode *root;
-       GError *error;
-
-       parser = json_parser_new();
-
-       error = NULL;
-       char *load_data = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST);
-       json_parser_load_from_data(parser, load_data, -1, &error);
-       if (error) {
-               SST_SECURE_TRACE("Unable to load data : %s \n", error->message);
-               g_error_free(error);
-               g_object_unref(parser);
-               return NULL;
-       }
-       return parser;
+       g_object_unref(handle->parser);
+       free(handle);
 }
 
-void ss_json_ringtone_add(JsonNode *root, char *filename, char *nameval, char *pathval)
+void sst_json_add_ringtone(sst_json_h *handle, char *nameval, char *pathval)
 {
+       JsonNode *root = handle->root;
        JsonNode *menu_item = json_node_new(JSON_NODE_OBJECT);
        JsonObject *object = json_object_new();
        json_node_take_object(menu_item, object);
@@ -86,83 +81,73 @@ void ss_json_ringtone_add(JsonNode *root, char *filename, char *nameval, char *p
        JsonArray *menu = json_node_get_array(root);
        json_array_add_element(menu, menu_item);
 
-       ss_json_ringtone_save(root);
+       _json_save_ringtone(root);
 }
 
-void ss_json_ringtone_print(JsonNode *root)
+void sst_json_get_ringtones(sst_json_h *handle, system_settings_iter_cb cb, void *user_data)
 {
-       JsonNode *node = root;
+       int i;
 
-       JsonGenerator *generator = json_generator_new();
-       json_generator_set_root(generator, node);
-       json_generator_set_pretty(generator, TRUE);
-       gchar *data = json_generator_to_data(generator, NULL);
-       //SETTING_TRACE("%s", (char * )data);
-       SST_SECURE_TRACE("-------------------------------------------------------\n");
-       SST_SECURE_TRACE("%s", data);
-       SST_SECURE_TRACE("-------------------------------------------------------\n");
+       RET_IF(NULL == cb);
+       RET_IF(NULL == handle);
 
-       SST_SECURE_TRACE("VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST SET !!!!\n");
-       vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST, (char*)data);
-       g_free(data);
-       g_object_unref(generator);
+       JsonArray *ringtone_list = json_node_get_array(handle->root);
+       int size = json_array_get_length(ringtone_list);
+       for (i = 0; i < size; i++) {
+               JsonObject *ringtone = json_array_get_object_element(ringtone_list, i);
+               //const char *name = json_object_get_string_member(ringtone, "name");
+               const char *path = json_object_get_string_member(ringtone, "path");
+               if (NULL == path)
+                       continue;
+
+               if (false == cb(i, path, user_data)) {
+                       ERR("callback return false");
+                       break;
+               }
+       }
 }
 
-void ss_json_ringtone_remove(JsonNode *root, char *filename, char *path_to_del)
+void sst_json_remove_ringtone(sst_json_h *handle, char *path_to_del)
 {
-       int size = json_array_get_length(json_node_get_array(root));
+       int i;
 
-       SST_SECURE_TRACE("BBB size : (%d) \n", size);
-       int i = 0;
+       RET_IF(NULL == handle);
+       RET_IF(NULL == path_to_del);
+
+       JsonNode *root = handle->root;
+       int size = json_array_get_length(json_node_get_array(root));
+       DBG("size(%d)", size);
        for (i = 0; i < size; i++) {
                JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
                //char *nameval = (char*)json_object_get_string_member(ringtone, "name");
                char *pathval = (char*)json_object_get_string_member(ringtone, "path");
 
-               if (pathval && !strcmp(pathval, path_to_del)) {
+               if (pathval && SST_EQUAL == strcmp(pathval, path_to_del)) {
                        json_array_remove_element(json_node_get_array(root), i);
-                       SST_SECURE_TRACE("remove BBB : (%s) --- (%s) \n", pathval, path_to_del);
+                       DBG("removed(%s)", pathval);
                }
        }
 
-       ss_json_ringtone_save(root);
+       _json_save_ringtone(root);
 }
 
-bool ss_json_ringtone_contain(JsonNode *root, char *newfile)
+bool sst_json_contain_ringtone(sst_json_h *handle, char *ringtone_path)
 {
-       int size = json_array_get_length(json_node_get_array(root));
+       int i;
 
-       bool ret = false;
+       RETV_IF(NULL == handle, false);
+       RETV_IF(NULL == ringtone_path, false);
 
-       int i = 0;
+       JsonNode *root = handle->root;
+       int size = json_array_get_length(json_node_get_array(root));
        for (i = 0; i < size; i++) {
                JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
                //char *nameval = (char*)json_object_get_string_member(ringtone, "name");
                char *pathval = (char*)json_object_get_string_member(ringtone, "path");
-               //SETTING_TRACE("(%s) --- (%s) \n", name, path);
 
-               if (pathval && !strcmp(pathval, newfile)) {
-                       //SETTING_TRACE("FOUND\n");
-                       ret = true;
-                       break;
-               } else {
-                       //SETTING_TRACE("*NOT* FOUND\n");
-                       ret = false;
-               }
+               if (pathval && SST_EQUAL == strcmp(pathval, ringtone_path))
+                       return true;
        }
 
-       return ret;
-}
-
-void ss_json_ringtone_list(JsonNode *root)
-{
-       int size = json_array_get_length(json_node_get_array(root));
-
-       int i = 0;
-       for (i = 0; i < size; i++) {
-               JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
-               char *name = (char*)json_object_get_string_member(ringtone, "name");
-               char *path = (char*)json_object_get_string_member(ringtone, "path");
-               SST_SECURE_TRACE("(%s) --- (%s) \n", name, path);
-       }
-}
+       return false;
+}
\ No newline at end of file
index 0d913b4..45bfc0f 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef __TIZEN_SYSTEM_SETTING_JSON_H__
-#define __TIZEN_SYSTEM_SETTING_JSON_H__
-
-#include <stdlib.h>
-#include <string.h>
-#include <glib-object.h>
-#include <json-glib/json-glib.h>
-
-//#define USE_JSONFILE
-
-JsonParser* ss_json_ringtone_open_file(char* path);
-JsonParser* ss_json_ringtone_load_from_data();
-
-void ss_json_ringtone_add(JsonNode *root, char* filename, char* nameval, char* pathval);
-void ss_json_ringtone_print(JsonNode *root);
-void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del);
-bool ss_json_ringtone_contain(JsonNode *root, char* newfile);
-void ss_json_ringtone_list(JsonNode *root);
-
-
-#endif /* __TIZEN_SYSTEM_SETTING_JSON_H__ */
+#pragma once
 
+#include <stdbool.h>
+#include "system_settings.h"
 
+typedef struct sst_json_s sst_json_h;
 
+sst_json_h* sst_json_load_ringtone();
+void sst_json_unref(sst_json_h *handle);
+void sst_json_get_ringtones(sst_json_h *handle, system_settings_iter_cb cb, void *user_data);
+void sst_json_add_ringtone(sst_json_h *handle, char *nameval, char *pathval);
+void sst_json_remove_ringtone(sst_json_h *handle, char *path_to_del);
+bool sst_json_contain_ringtone(sst_json_h *handle, char *newfile);
\ No newline at end of file
index d6622bc..2c3a3d1 100644 (file)
 #include "sst_utils.h"
 #include "sst_interface.h"
 
-typedef struct _ugFsNodeInfo {
-       char *path;
+typedef struct _file_Info {
        char *name;
        char *media_name;
-} fileNodeInfo;
+} sst_file_info;
 
 static char* get_media_basename(const char *dir_path, const char *name)
 {
-       //retv_if(isEmptyStr(dir_path) || isEmptyStr(name), NULL);
-       if (dir_path == NULL) return NULL;
+       RETV_IF(NULL == name, NULL);
+       RETV_IF(NULL == dir_path, NULL);
 
-       char path[512] = {0};
+       char path[PATH_MAX];
        snprintf(path, sizeof(path), "%s/%s", dir_path, name);
 
        metadata_extractor_h metadata = NULL;
-       char *title = NULL;
        int ret = metadata_extractor_create(&metadata);
-       if (ret == METADATA_EXTRACTOR_ERROR_NONE && metadata) {
-               ret = metadata_extractor_set_path(metadata, path);
-               if (ret == METADATA_EXTRACTOR_ERROR_NONE) {
-                       ret = metadata_extractor_get_metadata(
-                                       metadata, METADATA_TITLE, &title);
-                       metadata_extractor_destroy(metadata);
-                       if (title)
-                               return title;
-                       else
-                               return strdup(name);
-               } else {
-                       metadata_extractor_destroy(metadata);
-                       return strdup(name);
-               }
-       } else {
+       if (ret != METADATA_EXTRACTOR_ERROR_NONE || NULL == metadata) {
+               ERR("metadata_extractor_create() Fail(%d)", ret);
+               return strdup(name);
+       }
+
+       ret = metadata_extractor_set_path(metadata, path);
+       if (METADATA_EXTRACTOR_ERROR_NONE != ret) {
+               ERR("metadata_extractor_set_path(%s) Fail(%d)", path, ret);
+               metadata_extractor_destroy(metadata);
                return strdup(name);
        }
+
+       char *title = NULL;
+       ret = metadata_extractor_get_metadata(metadata, METADATA_TITLE, &title);
+       metadata_extractor_destroy(metadata);
+       if (title)
+               return title;
+       else
+               return strdup(name);
 }
 
-static int _get_filelist_in_dir(char *path, GList **file_list)
+static int _get_filelist_in_dir(const char *path, GList **file_list)
 {
-       DIR *pDir = NULL;
+       DIR *dir;
        struct dirent *ent;
        static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
 
-       if (path == NULL) {
-               SST_SECURE_TRACE("dir path is null");
-               return -1;
-       }
+       RETV_IF(NULL == path, -1);
+       RETV_IF(NULL == file_list, -1);
 
-       if (file_list == NULL) {
-               SST_SECURE_TRACE("file_list is null");
-               return -1;
-       }
-
-       pDir = opendir(path);
-
-       if (pDir == NULL)
+       dir = opendir(path);
+       if (NULL == dir) {
+               ERR("opendir(%s) Fail(%d)", path, errno);
                return -2;
+       }
 
        pthread_mutex_lock(&mutex);
-       while ((ent = readdir(pDir)) != NULL) {
-               fileNodeInfo *pNode = NULL;
-
+       while ((ent = readdir(dir)) != NULL) {
                if (strncmp(ent->d_name, ".", 1) == 0 || strcmp(ent->d_name, "..") == 0)
                        continue;
 
                if ((ent->d_type & DT_REG) == 0)
                        continue;
 
-               pNode = calloc(1, sizeof(fileNodeInfo));
-               if (pNode == NULL)
-                       continue;
+               sst_file_info *info = calloc(1, sizeof(sst_file_info));
+               if (NULL == info) {
+                       ERR("calloc() Fail(%d)", errno);
+                       break;
+               }
 
-               pNode->path = strdup(path);
-               pNode->name = strdup(ent->d_name);
-               pNode->media_name = get_media_basename(
-                               pNode->path, pNode->name);
+               info->name = strdup(ent->d_name);
+               info->media_name = get_media_basename(path, info->name);
 
-               *file_list = g_list_append(*file_list, pNode);
+               *file_list = g_list_append(*file_list, info);
        }
        pthread_mutex_unlock(&mutex);
 
-       closedir(pDir);
+       closedir(dir);
        return 0;
 }
 
-static gint _ringtone_compare_cb(gconstpointer d1, gconstpointer d2)
+static gint _ringtone_compare_cb(gconstpointer a, gconstpointer b)
 {
-       const fileNodeInfo *pNode1 = d1;
-       const fileNodeInfo *pNode2 = d2;
+       const sst_file_info *info1 = a;
+       const sst_file_info *info2 = b;
 
-       return strcmp(pNode1->media_name, pNode2->media_name);
+       return strcmp(info1->media_name, info2->media_name);
 }
 
-static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
+static void _get_default_ringtones(system_settings_iter_cb callback, void *data)
 {
-       /*Get file list */
+       RET_IF(NULL == callback);
+
        GList *filelist = NULL;
-       GList *iter;
-       fileNodeInfo *node = NULL;
+       sst_file_info *info;
        int idx = 0;
 
-       int ret = _get_filelist_in_dir(DEFAULT_RINGTONE_DIR, &filelist);
-       if (ret != 0)
-               SST_SECURE_TRACE("Failed to get filelist, ret = %d %s", ret, DEFAULT_RINGTONE_DIR);
+       const char *ringtone_dir = SST_DEFAULT_RINGTONE_DIR;
+       int ret = _get_filelist_in_dir(ringtone_dir, &filelist);
+       if (ret != 0) {
+               ERR("_get_filelist_in_dir(%s) Fail(%d)", ringtone_dir, ret);
+               return;
+       }
 
        filelist = g_list_sort(filelist, _ringtone_compare_cb);
 
-       for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
-               node = iter->data;
-               SST_SECURE_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
-               // @todo assert NULL check
-               if (callback) {
-                       char temp[1024];
-                       snprintf(temp, 1024, "%s/%s", node->path, node->name);
-                       char *path = strdup(temp);
-                       bool ret = callback(idx, (void *)(path), data);
-                       if (path) {
-                               free(path);
-                               path = NULL;
-                       }
-                       if (ret == false) {
-                               SST_SECURE_TRACE("quit the iteration by return value == false : %d", ret);
-                               break;
-                       }
-               } else {
-                       SST_SECURE_TRACE("--> system_setting_data_iterator is NULL");
+       GList *cur;
+       for (cur = filelist; cur; cur = cur->next) {
+               info = cur->data;
+
+               char fullpath[PATH_MAX];
+               snprintf(fullpath, sizeof(fullpath), "%s/%s", ringtone_dir, info->name);
+               bool ret = callback(idx, fullpath, data);
+               if (ret == false) {
+                       ERR("callback return false");
+                       break;
                }
        }
 
-       for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
-               node = iter->data;
-               free(node->path);
-               node->path = NULL;
-               free(node->name);
-               node->name = NULL;
-               free(node->media_name);
-               node->media_name = NULL;
-               free(node);
+       for (cur = filelist; cur; cur = cur->next) {
+               info = cur->data;
+               free(info->name);
+               free(info->media_name);
+               free(info);
        }
        g_list_free(filelist);
-       filelist = NULL;
 }
 
-static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
+static void _get_user_ringtones(system_settings_iter_cb callback, void *user_data)
 {
-#ifdef USE_JSONFILE
-       // NOT IN USE
-       JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
-#else
-       JsonParser *parser = ss_json_ringtone_load_from_data();
-#endif
-
-       JsonNode *root = json_parser_get_root(parser);
-       int size = json_array_get_length(json_node_get_array(root));
-
-       int i = 0;
-       for (i = 0; i < size; i++) {
-               JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
-               char *nameval = (char*)json_object_get_string_member(ringtone, "name");
-               char *pathval = (char*)json_object_get_string_member(ringtone, "path");
-               SST_SECURE_TRACE("(%s) --- (%s) \n", nameval, pathval);
-               if (callback && pathval) {
-                       char *path = strdup(pathval);
-                       bool ret = callback(i, (void *)(path), data);
-                       if (ret == false) {
-                               SST_SECURE_TRACE("quit the iteration by return value == false : %d", ret);
-                               break;
-                       }
-                       free(path);
-               } else {
-                       SST_SECURE_TRACE("--> callback is NULL");
-               }
-       }
+       RET_IF(NULL == callback);
 
-       g_object_unref(parser);
+       sst_json_h *handle = sst_json_load_ringtone();
+       sst_json_get_ringtones(handle, callback, user_data);
+       sst_json_unref(handle);
 }
-int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value)
+int sst_ringtone_add_incoming_call(system_settings_key_e key, void *value)
 {
-       char *pathval = value;
-       char *dnameval = NULL;
-       char *baseval = NULL;
-
-#ifdef USE_JSONFILE
-       // NOT IN USE
-       JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
-#else
-       JsonParser *parser = ss_json_ringtone_load_from_data();
-#endif
-
-       JsonNode *root = json_parser_get_root(parser);
-
-       // dirname
-       // basename
-       int ret = SYSTEM_SETTINGS_ERROR_NONE;
-       if (false == ss_json_ringtone_contain(root, pathval)) {
-               // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-               ss_json_ringtone_add(root, SST_RINGTONE_JSONFILE, pathval, pathval);
-               SST_SECURE_TRACE("pathval is : %s -- OK", pathval);
-       } else {
-               SST_SECURE_TRACE("pathval is duplicated : %s", pathval);
-               ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       }
+       char *path = value;
+       sst_json_h *handle = sst_json_load_ringtone();
 
-       dnameval = strdup(pathval);
-       baseval = strdup(pathval);
-       if (dnameval && baseval) {
-               SST_SECURE_TRACE("---> dirname is : %s ", dirname(dnameval));
-               SST_SECURE_TRACE("---> basename is : %s ", basename(baseval));
+       if (sst_json_contain_ringtone(handle, path)) {
+               ERR("ringtone(%s) is duplicated", path);
+               sst_json_unref(handle);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
-       free(dnameval);
-       free(baseval);
 
-       if (parser) {
-               g_object_unref(parser);
-               parser = NULL;
+       //Todo: check utc_system_settings_add_ringtone_list_p1
+       /*
+       if (false == sst_is_valid_file(path)) {
+               ERR("Invalid ringtone file(%s)", path);
+               sst_json_unref(handle);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
+       */
+       sst_json_add_ringtone(handle, path, path);
+       sst_json_unref(handle);
 
-       return ret;
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value)
+int sst_ringtone_del_incoming_call(system_settings_key_e key, void *value)
 {
-       char *pathval = value;
-#ifdef USE_JSONFILE
-       // NOT IN USE
-       JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
-#else
-       JsonParser *parser = ss_json_ringtone_load_from_data();
-#endif
-       JsonNode *root = json_parser_get_root(parser);
-
-       ss_json_ringtone_remove(root, SST_RINGTONE_JSONFILE, pathval);
-       //void ss_json_ringtone_remove(JsonNode *root,  char* filename, char* path_to_del)
-
-       ss_json_ringtone_print(root);
-       if (parser) {
-               g_object_unref(parser);
-               parser = NULL;
-       }
+       sst_json_h *handle = sst_json_load_ringtone();
+       sst_json_remove_ringtone(handle, value);
+       sst_json_unref(handle);
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data)
+int sst_ringtone_list_incoming_call(system_settings_key_e key, system_settings_iter_cb callback, void *data)
 {
-       _get_default_ringtones(key, callback, data);
-       _get_user_ringtones(key, callback, data);
+       RETV_IF(NULL == callback, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       _get_default_ringtones(callback, data);
+       _get_user_ringtones(callback, data);
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value)
+int sst_ringtone_set_incoming_call(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       int ret = sst_is_valid_file(vconf_value);
-       if (ret == 0) {
-               if (vconf_set_str(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               /* @todo add a common ret_handler */
-               return ret;
+       bool is_valid = sst_utils_exist(vconf_value);
+       if (false == is_valid) {
+               ERR("sst_utils_exist(%s) Fail", vconf_value);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
+       if (vconf_set_str(iface->vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s, %s) Fail", iface->vconf_key, vconf_value);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_email_alert_ringtone(system_setting_h item, void *value)
+int sst_ringtone_set_email_alert(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       int ret = sst_is_valid_file(vconf_value);
-       if (ret == 0) {
-               if (vconf_set_str(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               ERR("sst_is_valid_file() Fail(%d)", ret);
-               /* @todo add a common ret_handler */
-               return ret;
+       bool is_valid = sst_utils_exist(vconf_value);
+       if (false == is_valid) {
+               ERR("sst_utils_exist(%s) Fail", vconf_value);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
+       if (vconf_set_str(iface->vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s, %s) Fail", iface->vconf_key, vconf_value);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
@@ -315,38 +243,37 @@ int system_setting_set_email_alert_ringtone(system_setting_h item, void *value)
  * @return the ringtone file path specified by user in normal case
  *                if it's not accessable, return the default ringtone path
  */
-int system_setting_get_incoming_call_ringtone(system_setting_h item, void **value)
+int sst_ringtone_get_incoming_call(sst_interface *iface, void **value)
 {
        char *vconf_value = NULL;
-       if (sst_vconf_get_string(item->vconf_key, &vconf_value))
+       if (sst_vconf_get_string(iface->vconf_key, &vconf_value))
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
 
        /* check to see if it's accessable -> OK */
        /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
-       int is_load = sst_is_valid_file(vconf_value);
-       if (is_load == 0) {
+       bool is_valid = sst_utils_exist(vconf_value);
+       if (true == is_valid) {
                *value = vconf_value;
-       } else { /* not zero on errro */
-               *value = vconf_get_str(item->vconf_key);
+       } else {
+               *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
                free(vconf_value);
        }
 
-       /**value = vconf_value; */
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_email_alert_ringtone(system_setting_h item, void **value)
+int sst_ringtone_get_email_alert(sst_interface *iface, void **value)
 {
        char *vconf_value = NULL;
-       if (sst_vconf_get_string(item->vconf_key, &vconf_value))
+       if (sst_vconf_get_string(iface->vconf_key, &vconf_value))
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
 
        /* check to see if it's accessable -> OK */
        /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
-       int is_load = sst_is_valid_file(vconf_value);
-       if (is_load == 0) {
+       bool is_valid = sst_utils_exist(vconf_value);
+       if (true == is_valid) {
                *value = vconf_value;
-       } else { /* not zero on errro */
+       } else {
                *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
                free(vconf_value);
        }
index 1e3f951..49da1e1 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef __SYSTEM_SETTINGS_RINGTONES_H__
-#define __SYSTEM_SETTINGS_RINGTONES_H__
+#pragma once
 
 #include "sst_core.h"
 
-/**
- * @internal
- * @since_tizen 2.3
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_incoming_call_ringtone(system_setting_h item, void **value);
-
-/**
- * @internal
- * @brief set current path of the ringtone
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_STRING
- * @param[out] value the ringtone
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value);
-
-/**
- * @todo add comment here
- */
-int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value);
-
-/**
- * @todo add comment here
- */
-int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value);
-
-/**
- * @todo add comment here
- */
-int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_email_alert_ringtone(system_setting_h item, void **value);
-
-/**
- * @internal
- * @brief set current path of the email-alert
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_STRING
- * @param[out] value the alert ringtone
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_email_alert_ringtone(system_setting_h item, void *value);
-
+int sst_ringtone_get_incoming_call(sst_interface *iface, void **value);
+int sst_ringtone_set_incoming_call(sst_interface *iface, void *value);
+int sst_ringtone_add_incoming_call(system_settings_key_e key, void *value);
+int sst_ringtone_del_incoming_call(system_settings_key_e key, void *value);
+int sst_ringtone_list_incoming_call(system_settings_key_e key, system_settings_iter_cb callback, void *data);
 
-#endif /* __SYSTEM_SETTINGS_RINGTONES_H__ */
+int sst_ringtone_get_email_alert(sst_interface *iface, void **value);
+int sst_ringtone_set_email_alert(sst_interface *iface, void *value);
index 79ebdfe..db1f698 100644 (file)
 #include "sst.h"
 #include "sst_vconf.h"
 #include "sst_utils.h"
+#include "sst_exclusive.h"
 
-int system_setting_set_screen_backlight_time(system_setting_h item, void *value)
+int sst_screen_set_backlight_time(sst_interface *iface, void *value)
 {
        int *vconf_value = *(int **)value;
 
-       if (!(*vconf_value > 0 && *vconf_value <= 600)) {
-               SST_SECURE_TRACE(" ERR Betweeny here  0 ~ 600");
+       if (*vconf_value <= 0 || 600 < *vconf_value) {
+               ERR("Invalid Value(%d)", *vconf_value);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       if (vconf_set_int(item->vconf_key, *vconf_value))
+       if (vconf_set_int(iface->vconf_key, *vconf_value)) {
+               ERR("vconf_set_int(%s, %d) Fail", iface->vconf_key, *vconf_value);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-#ifdef TIZEN_WEARABLE
-static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
-{
-       SETTING_TRACE_BEGIN;
-       char buffer[256];
-       const char *find_str = "extended_wallpaper_";
-       char *ch = NULL;
-
-       if (!(ch = strstr(file_path, find_str)))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       strncpy(buffer, file_path, ch - file_path);
-       buffer[ch - file_path] = 0;
-       sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
-
-       if (!isdigit(buffer[0])) {
-               SETTING_TRACE("%s is not number", buffer);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       *num = atoi(buffer);
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
-{
-       SETTING_TRACE_BEGIN;
-       if (!source_file_path || !dest_file_path)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       char buf[1024];
-
-       int fd;
-       fd = open(source_file_path, O_RDONLY);
-       if (fd < 0) {
-               SETTING_TRACE("file open failed: %s", source_file_path);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       int fd2;
-       fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
-       if (fd2 < 0) {
-               SETTING_TRACE("file creation failed: %s", dest_file_path);
-               close(fd);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       while (read(fd, buf, sizeof(buf) - 1) > 0)
-               write(fd2, buf, sizeof(buf) - 1);
-
-       close(fd2);
-       close(fd);
-
-       if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0)
-               SETTING_TRACE("chmod failed: %s", dest_file_path);
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-static int system_setting_remove_oldest_extended_wallpaper()
-{
-       SETTING_TRACE_BEGIN;
-       DIR *dp;
-       struct dirent *dirp;
-       char *min_image_name = NULL;
-       unsigned int min_image_num = 0;
-       unsigned int temp_image_num = 0;
-       int image_count = 0;
-
-       if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
-               SETTING_TRACE("opendir error");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       while ((dirp = readdir(dp))) {
-               if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
-                       continue;
-
-               if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
-                               != SYSTEM_SETTINGS_ERROR_NONE) {
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
-
-               if ((image_count == 0) || (min_image_num > temp_image_num)) {
-                       min_image_num = temp_image_num;
-                       min_image_name = dirp->d_name;
-               }
-
-               image_count++;
-       }
-
-       char buf[512];
-       if (min_image_name) {
-               snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
-               if (remove(buf) < 0) {  /* remove oldest image */
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-static int system_setting_check_extended_wallpaper(const char *file_path)
-{
-       char buffer[512];
-       SETTING_TRACE_BEGIN;
-       if (!file_path || !strlen(file_path))
-               return 0;
-       snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
-       return (strstr(file_path, buffer) != NULL);
-}
-
-#define WALLPAPER_MAX_COUNT            10
-#endif
-
-static bool dl_is_supported_image_type_load(char *path)
+static bool _screen_is_valid_img(char *path)
 {
        void *handle = NULL;
        char *error;
        bool ret = false;
        bool (*image_type_check)(char *path);
 
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
+       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY | RTLD_GLOBAL);
+       if (NULL == handle) {
+               ERR("dlopen(%s) Fail(%d)", SETTING_UTILS_SO_FILE_PATH, errno);
                return false;
        }
 
-       image_type_check = dlsym(handle, "__is_supported_image_type_load");
+       image_type_check = dlsym(handle, "sstu_is_valid_image");
        if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
+               ERR("dlsym(sstu_is_valid_image) Fail(%s)", error);
+               dlclose(handle);
                return false;
        }
+
        ret = image_type_check(path);
-       if (handle)
-               dlclose(handle);
+       dlclose(handle);
        return ret;
 }
 
-int system_setting_set_wallpaper_home_screen(system_setting_h item, void *value)
+int sst_screen_set_home_wallpaper(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       bool isok = dl_is_supported_image_type_load(vconf_value);
-       if (!isok) {
-               /* not supported */
-               SST_SECURE_TRACE("path : %s is not supported file format", vconf_value);
+       bool valid = _screen_is_valid_img(vconf_value);
+       if (false == valid) {
+               ERR("Invalid image file(%s)", vconf_value);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value);
        }
 
-       /* error handling here */
-       if (sst_is_valid_file(vconf_value) != 0)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-#ifdef TIZEN_MOBILE
-       if (vconf_set_str(item->vconf_key, vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-#endif
-
-#ifdef TIZEN_WEARABLE
-       if (system_setting_check_extended_wallpaper(vconf_value)) {     /* New extended wallpaper */
-               DIR *dp = NULL;
-               struct dirent *dirp;
-               unsigned int max_image_num = 0;
-               unsigned int temp_image_num = 0;
-               int image_count = 0;
-
-               if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
-                       SETTING_TRACE("Setting - dir open error!");
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
-
-               /* Check a max number of wallpapers */
-               while ((dirp = readdir(dp))) {
-                       if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
-                               continue;
-
-                       if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
-                                       != SYSTEM_SETTINGS_ERROR_NONE) {
-                               if (dp)
-                                       closedir(dp);
-                               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-                       }
-
-                       if ((image_count == 0) || (max_image_num < temp_image_num))
-                               max_image_num = temp_image_num;
-
-                       image_count++;
-               }
-               if (dp)
-                       closedir(dp);
-
-               /* Numbering rule: Gear is odd number */
-               max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
-                       : 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);
-
-               /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
-               if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
-                               != SYSTEM_SETTINGS_ERROR_NONE) {
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
-
-               /* remove oldest wallpaper */
-               if (image_count >= WALLPAPER_MAX_COUNT) {
-                       if (system_setting_remove_oldest_extended_wallpaper()
-                                       != SYSTEM_SETTINGS_ERROR_NONE) {
-                               remove(file_name_buffer);
-                               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-                       }
-               }
-
-               if (vconf_set_str(item->vconf_key, file_name_buffer))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-               if (vconf_set_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
-                                       VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
-       } else {
-               if (vconf_set_str(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-#endif
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
+       return sst_excl_set_wallpaper(iface->vconf_key, vconf_value);
 }
 
-int system_setting_set_wallpaper_lock_screen(system_setting_h item, void *value)
+int sst_screen_set_lock_wallpaper(sst_interface *iface, void *value)
 {
        char *vconf_value = value;
 
-       bool isok = dl_is_supported_image_type_load(vconf_value);
-       if (!isok) {
-               /* not supported */
-               SST_SECURE_TRACE("path : %s is not supported file format", vconf_value);
+       bool valid = _screen_is_valid_img(vconf_value);
+       if (false == valid) {
+               ERR("Invalid image file(%s)", vconf_value);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value);
        }
 
-       /* error handling here */
-       if (sst_is_valid_file(vconf_value) != 0)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (vconf_set_str(item->vconf_key, vconf_value))
+       if (vconf_set_str(iface->vconf_key, vconf_value)) {
+               ERR("vconf_set_str(%s, %s) Fail", iface->vconf_key, vconf_value);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 static int _category_func(const char *name, void *user_data)
 {
-       static char *category = "lock-screen";
-       if (name && !strcmp(name, category)) {
-               SST_SECURE_TRACE(" SAME ");
-               return -1;
+       const char *category = "lock-screen";
+       bool *found = user_data;
+
+       RETV_IF(NULL == name, PMINFO_R_OK);
+
+       if (SST_EQUAL == strcmp(name, category)) {
+               *found = true;
+               return PMINFO_R_ERROR; //not Error. It stops iteration.
        } else {
-               SST_SECURE_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
-               return 0;
+               DBG("Unexpeced category(%s)", name);
+               return PMINFO_R_OK;
        }
 
-       return 0;
+       return PMINFO_R_OK;
 }
 
 /**
@@ -314,63 +119,79 @@ static int _category_func(const char *name, void *user_data)
  * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
  *
  */
-int system_setting_set_lockscreen_app(system_setting_h item, void *value)
+int sst_screen_set_lockscreen(sst_interface *iface, void *value)
 {
-       char *vconf_value;
-       vconf_value = (char*)value;             /* ex) com.samsung.lockscreen */
-
-       int r = 0;
-       pkgmgrinfo_appinfo_h handle;
-       r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
-       if (r != PMINFO_R_OK) {
-               SST_SECURE_TRACE("*** pkginfo failed ");
+       int ret;
+       char *app_id = value; //ex) com.samsung.lockscreen
+
+       RETV_IF(NULL == value, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       pkgmgrinfo_appinfo_h handle = NULL;
+       ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &handle);
+       if (PMINFO_R_OK != ret) {
+               ERR("pkgmgrinfo_appinfo_get_appinfo(%s) Fail(%d)", app_id, ret);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("%p", handle);
        }
 
-       int ret = pkgmgrinfo_appinfo_foreach_category(handle, _category_func, (void*)"lock-screen");
+       bool is_lock_screen = false;
+       ret = pkgmgrinfo_appinfo_foreach_category(handle, _category_func, &is_lock_screen);
        if (ret != PMINFO_R_OK) {
+               ERR("pkgmgrinfo_appinfo_foreach_category() Fail(%d)", ret);
                pkgmgrinfo_appinfo_destroy_appinfo(handle);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
-
        pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       /*----------------------------------------------------------------------------------- */
+
+       if (false == is_lock_screen) {
+               ERR("Invalid Application(%s)", app_id);
+               //Todo: It should be enable.
+               //return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
        int locktype = -1;
-       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
+       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
+               ERR("vconf_get_int(lock_type) Fail");
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
+       if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
+               ERR("Unsupported lock type");
                return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
+       }
 
-       if (vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value))
+       if (vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, app_id)) {
+               ERR("vconf_set_str(3rd lock pkg) Fail");
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
-               if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE))
+       if (SST_EQUAL == strcmp(app_id, "com.samsung.lockscreen")) {
+               const char *lock_type_key = VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT;
+               if (vconf_set_int(lock_type_key, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
+                       ERR("vconf_set_int(%s) Fail", lock_type_key);
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
        }
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-/*////////////////////////////////////////////////////////////////////////////////////// */
-/**
- * get current lock scren app package name (string)
- *
- * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
- */
-int system_setting_get_lockscreen_app(system_setting_h item, void **value)
+int sst_screen_get_lockscreen(sst_interface *iface, void **value)
 {
        char *pkg_name = NULL;
+
        int locktype = -1;
-       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
+       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
+               ERR("vconf_get_int(lock_type) Fail");
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (sst_vconf_get_string(item->vconf_key, &pkg_name))
+       if (sst_vconf_get_string(iface->vconf_key, &pkg_name)) {
+               ERR("sst_vconf_get_string(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
+       if (SST_EQUAL == strcmp(pkg_name, "com.samsung.lockscreen")
+                       && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
+               //if current lock type is 'password', return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE
                free(pkg_name);
                return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
        }
index 7f1fa1f..6610652 100644 (file)
 #pragma once
 
 #include "sst_interface.h"
-/**
- * @internal
- * @brief set current path of the wallpaper
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_STRING
- * @param[out] value the wallpaper
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_wallpaper_home_screen(system_setting_h item, void *value);
-
-/**
- * @internal
- * @brief set current path of the bg image of the lock screen
- * @since_tizen 2.3
- * @param[in] key key name should be SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN
- * @param[in] datatype should be SYSTEM_SETTING_DATA_TYPE_STRING
- * @param[out] value the lock screen
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_wallpaper_lock_screen(system_setting_h item, void *value);
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_lockscreen_app(system_setting_h item, void **value);
+//set current path of the wallpaper
+int sst_screen_set_home_wallpaper(sst_interface *iface, void *value);
+//set current path of the bg image of the lock screen
+int sst_screen_set_lock_wallpaper(sst_interface *iface, void *value);
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_lockscreen_app(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_screen_backlight_time(system_setting_h item, void *value);
+int sst_screen_get_lockscreen(sst_interface *iface, void **value);
+int sst_screen_set_lockscreen(sst_interface *iface, void *value);
+int sst_screen_set_backlight_time(sst_interface *iface, void *value);
 
index 4d77c26..b978b97 100644 (file)
 #include "sst_utils.h"
 #include "sst_interface.h"
 
-int system_setting_get_locale_country(system_setting_h item, void **value)
+int sst_locale_get_country(sst_interface *iface, void **value)
 {
-       char *vconf_value = NULL;
-       if (sst_vconf_get_string(item->vconf_key, &vconf_value))
+       char *locale = NULL;
+       if (sst_vconf_get_string(iface->vconf_key, &locale)) {
+               ERR("sst_vconf_get_string(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       /* parsing validation */
-       /* en_US.UTF-8 */
-       char arr[21] = {0};
-       snprintf(arr, 20, "%s", vconf_value);
-       for (int i = 0; i < strlen(arr); i++) {
-               if ('.' == arr[i]) {
-                       arr[i] = 0;
-                       SST_SECURE_TRACE("replace . to NULL : %d", i);
+       // remove encoding ex) en_US.UTF-8 => en_US
+       int i;
+       char country[21];
+       for (i = 0; i < sizeof(country); i++) {
+               country[i] = locale[i];
+               if ('.' == country[i])
+                       country[i] = 0;
+               if (0 == country[i])
                        break;
-               }
        }
-       *value = strdup(arr);
-       free(vconf_value);
-       vconf_value = NULL;
+       if (sizeof(country) <= i) {
+               ERR("Invalid locale(%s)", locale);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       *value = strdup(country);
+       free(locale);
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_locale_country(system_setting_h item, void *value)
+int sst_locale_set_country(sst_interface *iface, void *value)
 {
-       char *vconf_value = NULL;
-       vconf_value = (char*)value;
-
-       char *ext = "UTF-8";
+       char *country = value;
+       const char *codeset = "UTF-8";
 
-       char arr[20];
-       snprintf(arr, 20, "%s.%s", vconf_value, ext);
+       char locale[100];
+       snprintf(locale, sizeof(locale), "%s.%s", country, codeset);
 
-       if (vconf_set_str(item->vconf_key, arr))
+       if (vconf_set_str(iface->vconf_key, locale)) {
+               ERR("vconf_set_str(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_locale_language(system_setting_h item, void **value)
+int sst_locale_get_language(sst_interface *iface, void **value)
 {
-       char *vconf_value = NULL;
-       if (sst_vconf_get_string(item->vconf_key, &vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       /* parsing validation */
-       /* en_US.UTF-8 */
-       char arr[21] = {0};
-       snprintf(arr, 20, "%s", vconf_value);
-       for (int i = 0; i < strlen(arr); i++) {
-               if ('.' == arr[i]) {
-                       arr[i] = 0;
-                       SST_SECURE_TRACE("replace . to NULL : %d", i);
-                       break;
-               }
+       //It is same data with sst_locale_get_country()
+       int ret = sst_locale_get_country(iface, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_locale_get_country() Fail(%d)", ret);
+               return ret;
        }
-       *value = strdup(arr);
-       free(vconf_value);
-       vconf_value = NULL;
+
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_locale_language(system_setting_h item, void *value)
+int sst_locale_set_language(sst_interface *iface, void *value)
 {
-       char *vconf_value = NULL;
-       vconf_value = (char*)value;
-
-       char *ext = "UTF-8";
-
-       char arr[20];
-       snprintf(arr, 20, "%s.%s", vconf_value, ext);
-
-       if (vconf_set_str(item->vconf_key, arr))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       //It is same data with sst_locale_set_country()
+       int ret = sst_locale_set_country(iface, value);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_locale_set_country() Fail(%d)", ret);
+               return ret;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **value)
+int sst_locale_get_timeformat_24hour(sst_interface *iface, void **value)
 {
-       int vconf_value;
+       int int_val;
 
-       if (vconf_get_int(item->vconf_key, &vconf_value))
+       if (vconf_get_int(iface->vconf_key, &int_val)) {
+               ERR("vconf_get_int(%s) Fail", iface->vconf_key);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        bool ret_value = true;
-       if (vconf_value == VCONFKEY_TIME_FORMAT_12)
+       if (int_val == VCONFKEY_TIME_FORMAT_12)
                ret_value = false;
-       else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
+       else if (int_val == VCONFKEY_TIME_FORMAT_24)
                ret_value = true;
 
        *value = (void*)ret_value;
@@ -120,66 +112,61 @@ int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **va
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *value)
+int sst_locale_set_timeformat_24hour(sst_interface *iface, void *value)
 {
-       bool *vconf_value;
+       bool is_24hour = *(bool*)value;
+       int vconf_val;
 
-       vconf_value = (bool*)value;
+       if (is_24hour)
+               vconf_val = VCONFKEY_TIME_FORMAT_24;
+       else
+               vconf_val = VCONFKEY_TIME_FORMAT_12;
 
-       if (*vconf_value) {
-               if (vconf_set_int(item->vconf_key, VCONFKEY_TIME_FORMAT_24))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               if (vconf_set_int(item->vconf_key, VCONFKEY_TIME_FORMAT_12))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       if (vconf_set_int(iface->vconf_key, vconf_val)) {
+               ERR("vconf_set_int(%s) Fail", iface->vconf_key);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_locale_timezone(system_setting_h item, void **value)
+int sst_locale_get_timezone(sst_interface *iface, void **value)
 {
-       char tzpath[256];
+       char tzpath[PATH_MAX];
        ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
-       if (len != -1) {
-               tzpath[len] = '\0';
-       } else {
-               SST_SECURE_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
+       if (-1 == len) {
+               ERR("readlink(%s) Fail(%d)", SETTING_TZONE_SYMLINK_PATH, errno);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
+       tzpath[len] = '\0';
 
-       SST_SECURE_TRACE("tzpath : %s ", &tzpath[20]);
-       *value = strdup(&tzpath[20]);
+       // for including last '/', it used sizeof instead of strlen
+       int start = sizeof(SETTING_TIME_ZONEINFO_PATH);
+
+       *value = strdup(&tzpath[start]);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_locale_timezone(system_setting_h item, void *value)
+int sst_locale_set_timezone(sst_interface *iface, void *value)
 {
-       char *timezone_value = NULL;
-       timezone_value = (char*)value;
+       char *timezone = value;
 
-       char tz_path[1024];
-       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
+       char tzpath[PATH_MAX];
+       snprintf(tzpath, sizeof(tzpath), SETTING_TIME_ZONEINFO_PATH"/%s", timezone);
 
-       int is_load = sst_is_valid_file(tz_path);
-       if (is_load == 0) {
-               alarmmgr_set_timezone(tz_path);
+       if (false == sst_utils_exist(tzpath)) {
+               ERR("sst_utils_exist(%s) Fail", tzpath);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
-               if (vconf_set_str(item->vconf_key, timezone_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       int ret = alarmmgr_set_timezone(tzpath);
+       if (ALARMMGR_RESULT_SUCCESS != ret)
+               ERR("alarmmgr_set_timezone(%s) Fail", tzpath);
 
-               return SYSTEM_SETTINGS_ERROR_NONE;
+       if (vconf_set_str(iface->vconf_key, timezone)) {
+               ERR("vconf_set_str(%s) Fail", iface->vconf_key);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
-       return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-}
 
-int system_setting_get_time_changed(system_setting_h item, void **value)
-{
-       time_t cur_tick;
-       int **val = (int**)value;
-       cur_tick = time(NULL);
-       **val = cur_tick;
-       /* struct tm * localtime = time (cur_tick); */
-       /* printf("%s\n", ctime(&cur_tick); */
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
index 048af75..cc4357c 100644 (file)
 
 #include "sst_core.h"
 
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_locale_country(system_setting_h item, void **value);
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_locale_country(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_locale_language(system_setting_h item, void **value);
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_locale_language(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **value);
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_locale_timezone(system_setting_h item, void **value);
-
-/**
- * @internal
- * @since_tizen 3.0
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_locale_timezone(system_setting_h item, void *value);
-
-/**
- * @internal
- * @since_tizen 2.3
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_time_changed(system_setting_h item, void **value);
\ No newline at end of file
+int sst_locale_get_country(sst_interface *iface, void **value);
+int sst_locale_set_country(sst_interface *iface, void *value);
+int sst_locale_get_language(sst_interface *iface, void **value);
+int sst_locale_set_language(sst_interface *iface, void *value);
+int sst_locale_get_timeformat_24hour(sst_interface *iface, void **value);
+int sst_locale_set_timeformat_24hour(sst_interface *iface, void *value);
+int sst_locale_get_timezone(sst_interface *iface, void **value);
+int sst_locale_set_timezone(sst_interface *iface, void *value);
\ No newline at end of file
index 2f454bf..ea7db2d 100644 (file)
@@ -25,25 +25,29 @@ typedef struct __st_multi_callback_node_ {
        void *user_data;
 } callback_node;
 
-static gint _compare_cb(gconstpointer val, gconstpointer s_val)
+static gint _compare_cb(gconstpointer a, gconstpointer b)
 {
-       if (NULL == val) return 1;
-       if (NULL == s_val) return 1;
+       const callback_node *node = a;
 
-       const callback_node *node = val;
-       if (node->callback == s_val)
+       RETV_IF(NULL == a, 1);
+       RETV_IF(NULL == b, 1);
+
+       if (node->callback == b)
                return 0;
-       return -1;
+       else
+               return 1;
 }
 
-int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb ptr, void *user_data)
+int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb cb, void *user_data)
 {
        RETV_IF(NULL == handle, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == ptr, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
 
-       GList *found = g_list_find_custom(handle->list, ptr, _compare_cb);
-       if (found)
+       GList *found = g_list_find_custom(handle->list, cb, _compare_cb);
+       if (found) {
+               ERR("callback Already Exist");
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
        callback_node *node = calloc(1, sizeof(callback_node));
        if (NULL == node) {
@@ -51,7 +55,7 @@ int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb ptr
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       node->callback = ptr;
+       node->callback = cb;
        node->user_data = user_data;
 
        handle->list = g_list_append(handle->list, node);
@@ -59,18 +63,21 @@ int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb ptr
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int sst_utils_del_multi_cb(callback_list *handle, system_settings_changed_cb ptr)
+int sst_utils_del_multi_cb(callback_list *handle, system_settings_changed_cb cb)
 {
        RETV_IF(NULL == handle, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-       RETV_IF(NULL == ptr, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == cb, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
 
-       GList *found = g_list_find_custom(handle->list, ptr, _compare_cb);
-       if (found) {
-               handle->list = g_list_remove_link(handle->list, found);
-               free(found->data);
-               g_list_free(found);
+       GList *found = g_list_find_custom(handle->list, cb, _compare_cb);
+       if (NULL == found) {
+               ERR("No callback");
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
+       handle->list = g_list_remove_link(handle->list, found);
+       free(found->data);
+       g_list_free(found);
+
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
@@ -88,12 +95,12 @@ int sst_utils_invoke_cb_list(callback_list *handle, system_settings_key_e key)
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int sst_is_valid_file(const char *path)
+bool sst_utils_exist(const char *path)
 {
        if (0 != access(path, R_OK)) {
                /* error code : 13 */
-               SST_SECURE_TRACE("Invalid file(%s) : errno(%d)", path, errno);
-               return -errno;
+               ERR("access(%s) Fail(%d)", path, errno);
+               return false;
        }
-       return 0;
+       return true;
 }
index 0a85014..8bae7f0 100644 (file)
  */
 #pragma once
 
+#include <stdbool.h>
 #include "sst_interface.h"
 
 int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb ptr, void *user_data);
 int sst_utils_del_multi_cb(callback_list *handle, system_settings_changed_cb ptr);
 int sst_utils_invoke_cb_list(callback_list *handle, system_settings_key_e key);
 
-int sst_is_valid_file(const char *path);
+bool sst_utils_exist(const char *path);
index 4f02331..b9d4aac 100644 (file)
 #include "sst_utils.h"
 #include "sst_interface.h"
 
+typedef enum {
+       SYSTEM_SETTING_CALLBACK_SLOT_0 = 0,
+       SYSTEM_SETTING_CALLBACK_SLOT_1 = 1,
+       SYSTEM_SETTING_CALLBACK_SLOT_2 = 2,
+       SYSTEM_SETTING_CALLBACK_SLOT_3 = 3,
+       SYSTEM_SETTING_CALLBACK_SLOT_4 = 4,
+       SYSTEM_SETTING_CALLBACK_SLOT_5 = 5
+} sst_vconf_cb_slot_e;
+
 int sst_vconf_get_real_bool(const char *vconf_key, bool *value)
 {
-       int tempvalue = 0;
-       int ret = vconf_get_bool(vconf_key, &tempvalue);
+       int temp = 0;
+       int ret = vconf_get_bool(vconf_key, &temp);
+       if (VCONF_OK != ret) {
+               ERR("vconf_get_bool(%s) Fail(%d)", vconf_key, ret);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
-       if (tempvalue == 1)
-               *value = true;
-       else
-               *value = false;
+       *value = temp ? true : false;
 
-       return ret;
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 int sst_vconf_get_string(const char *vconf_key, char **value)
 {
-       char *str_value = NULL;
-
-       str_value = vconf_get_str(vconf_key);
-
-       if (str_value != NULL) {
-               *value = str_value;
-               return 0;
-       } else {
-               return -1;
+       char *str_value = vconf_get_str(vconf_key);
+       if (NULL == str_value) {
+               ERR("vconf_get_str(%s) Fail(NULL)", vconf_key);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
+
+       *value = str_value;
+       return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
 static void _vconf_event_cb0(keynode_t *node, void *event_data)
 {
        system_settings_key_e pkey = (system_settings_key_e)event_data;
 
-       if (node != NULL) {
-               system_setting_h system_setting_item;
-
-               int ret = system_settings_get_item(pkey, &system_setting_item);
-               if (ret != 0) {
-                       if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-               }
+       RET_IF(NULL == node);
 
-               void *user_data = NULL;
-               user_data = system_setting_item->user_data;
-               system_setting_item->changed_cb(pkey, user_data);
+       sst_interface *iface = NULL;
+       int ret = sst_get_interface(pkey, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", pkey, ret);
+               return;
        }
+
+       iface->changed_cb(pkey, iface->user_data);
 }
 
 static void _vconf_event_cb1(keynode_t *node, void *event_data)
@@ -89,7 +94,7 @@ static void _vconf_event_cb4(keynode_t *node, void *event_data)
 {
        _vconf_event_cb0(node, event_data);
 }
-static vconf_callback_fn _vconf_get_event_cb_slot(sst_vconf_cb_slot_e slot)
+static vconf_callback_fn _get_event_cb_slot(sst_vconf_cb_slot_e slot)
 {
        switch (slot) {
        case SYSTEM_SETTING_CALLBACK_SLOT_0:
@@ -107,88 +112,67 @@ static vconf_callback_fn _vconf_get_event_cb_slot(sst_vconf_cb_slot_e slot)
        }
 }
 
-/**
- * @internal
- * @brief Unset the system settings notification callback
- * @since_tizen 2.3
- * @param[in] vconf_key vconf key name used in the code
- * @param[in] slot internal slot to set the key (0~5)
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
 static int _vconf_unset_changed_cb(const char *vconf_key, sst_vconf_cb_slot_e slot)
 {
-       vconf_callback_fn vconf_event_cb;
-
-       vconf_event_cb = _vconf_get_event_cb_slot(slot);
+       vconf_callback_fn vconf_event_cb = _get_event_cb_slot(slot);
+       if (NULL == vconf_event_cb) {
+               ERR("_get_event_cb_slot(%d) Fail(NULL)", slot);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
-       if (vconf_event_cb != NULL)
-               vconf_ignore_key_changed(vconf_key, vconf_event_cb);
+       int ret = vconf_ignore_key_changed(vconf_key, vconf_event_cb);
+       if (VCONF_OK != ret) {
+               ERR("vconf_ignore_key_changed(%s, %d) Fail(%d)", vconf_key, slot, ret);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_unset_changed_vconf_genernal_callback(system_setting_h item)
+int sst_vconf_unset_changed_cb(sst_interface *iface)
 {
-       return _vconf_unset_changed_cb(item->vconf_key, (item->key) % 4);
+       return _vconf_unset_changed_cb(iface->vconf_key, (iface->key) % 4);
 }
 
-/**
- * @internal
- * @brief Set the system settings notification callback
- * @since_tizen 2.3
- * @param[in] vconf_key
- * @param[in] key
- * @param[in] slot internal slot to set the key (0~4)
- * @param[in] user_data user data
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
 static int _vconf_set_changed_cb(const char *vconf_key, system_settings_key_e key, sst_vconf_cb_slot_e slot, void *user_data)
 {
-       vconf_callback_fn vconf_event_cb;
-
-       vconf_event_cb = _vconf_get_event_cb_slot(slot);
-
-       if (vconf_event_cb == NULL) {
-               ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_event_cb == 0");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       vconf_callback_fn vconf_event_cb = _get_event_cb_slot(slot);
+       if (NULL == vconf_event_cb) {
+               ERR("_get_event_cb_slot(%d) Fail(NULL)", slot);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
        }
 
-       if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key)) {
-               ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error");
+       int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key);
+       if (VCONF_OK != ret) {
+               ERR("vconf_notify_key_changed(%s, %d) Fail(%d)", vconf_key, slot, ret);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_changed_vconf_genernal_callback(system_setting_h item, void *user_data)
+int sst_vconf_set_changed_cb(sst_interface *iface, void *user_data)
 {
-       return _vconf_set_changed_cb(item->vconf_key, item->key, (item->key) % 4, user_data);
+       return _vconf_set_changed_cb(iface->vconf_key, iface->key, (iface->key) % 4, user_data);
 }
 
 static void _vconf_event_multi_cb(keynode_t *node, void *event_data)
 {
-       ERR("Enter [%s]", __FUNCTION__);
+       int ret;
        system_settings_key_e pkey = (system_settings_key_e)event_data;
 
-       if (node != NULL) {
-               system_setting_h system_setting_item;
+       RET_IF(NULL == node);
 
-               int ret = system_settings_get_item(pkey, &system_setting_item);
-               if (ret != 0) {
-                       if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
-                               ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-               }
-
-               sst_utils_invoke_cb_list(&system_setting_item->changed_cb_list, pkey);
+       sst_interface *iface = NULL;
+       ret = sst_get_interface(pkey, &iface);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("sst_get_interface(%d) Fail(%d)", pkey, ret);
+               return;
        }
-       ERR("Leave [%s]", __FUNCTION__);
+
+       ret = sst_utils_invoke_cb_list(&iface->changed_cb_list, pkey);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret)
+               ERR("sst_utils_invoke_cb_list(%d) Fail(%d)", pkey, ret);
 }
 
 static void _vconf_event_multi_cb_slot_0(keynode_t *node, void *event_data)
@@ -211,7 +195,7 @@ static void _vconf_event_multi_cb_slot_3(keynode_t *node, void *event_data)
        _vconf_event_multi_cb(node, event_data);
 }
 
-static vconf_callback_fn system_setting_vconf_get_event_multi_cb_slot(system_settings_key_e key)
+static vconf_callback_fn _get_event_multi_cb_slot(system_settings_key_e key)
 {
        int cal = (int)key;
        int slot = cal % 4;
@@ -234,101 +218,96 @@ static vconf_callback_fn system_setting_vconf_get_event_multi_cb_slot(system_set
        }
 }
 
-int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key)
+int sst_vconf_set_multi_changed_cb(const char *vconf_key, system_settings_key_e key)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       vconf_callback_fn vconf_event_cb;
-
-       vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key);
-
-       if (vconf_event_cb == NULL)
+       vconf_callback_fn vconf_event_cb = _get_event_multi_cb_slot(key);
+       if (NULL == vconf_event_cb) {
+               ERR("_get_event_multi_cb_slot(%d) Fail(NULL)", key);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
        int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key);
-       if (ret != 0) {
-               ERR("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_notify_key_changed error");
+       if (VCONF_OK != ret) {
+               ERR("vconf_notify_key_changed(%s) Fail(%d)", vconf_key, ret);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       ERR("Leave [%s]", __FUNCTION__);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_settings_key_e key)
+int sst_vconf_unset_multi_changed_cb(const char *vconf_key, system_settings_key_e key)
 {
-       ERR("Enter [%s]", __FUNCTION__);
-       vconf_callback_fn vconf_event_cb;
-
-       vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key);
-
-       if (vconf_event_cb == NULL)
+       vconf_callback_fn vconf_event_cb = _get_event_multi_cb_slot(key);
+       if (NULL == vconf_event_cb) {
+               ERR("_get_event_multi_cb_slot(%d) Fail(NULL)", key);
                return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
 
        int ret = vconf_ignore_key_changed(vconf_key, vconf_event_cb);
-       if (ret != 0) {
-               ERR("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_ignore_key_changed error");
+       if (VCONF_OK != ret) {
+               ERR("vconf_ignore_key_changed(%s, %d) Fail(%d)", vconf_key, key, ret);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
-       ERR("Leave [%s]", __FUNCTION__);
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_get_vconf(system_setting_h item, void **value)
+int sst_vconf_get(sst_interface *iface, void **value)
 {
        char *vconf_char;
        int vconf_int;
        int **val = (int**)value;
        bool vconf_bool;
 
-       switch (item->data_type) {
+       switch (iface->data_type) {
        case SYSTEM_SETTING_DATA_TYPE_STRING:
-               if (sst_vconf_get_string(item->vconf_key, &vconf_char))
+               if (sst_vconf_get_string(iface->vconf_key, &vconf_char))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                *value = vconf_char;
                break;
        case SYSTEM_SETTING_DATA_TYPE_INT:
-               if (vconf_get_int(item->vconf_key, &vconf_int))
+               if (vconf_get_int(iface->vconf_key, &vconf_int))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                **val = vconf_int;
                break;
        case SYSTEM_SETTING_DATA_TYPE_BOOL:
-               if (sst_vconf_get_real_bool(item->vconf_key, &vconf_bool))
+               if (sst_vconf_get_real_bool(iface->vconf_key, &vconf_bool))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                *value = (void*)vconf_bool;
                break;
        default:
-               ERR("Error system_setting_h struct data_type");
+               ERR("Unknown type(%d)", iface->data_type);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 
-int system_setting_set_vconf(system_setting_h item, void *value)
+int sst_vconf_set(sst_interface *iface, void *value)
 {
        char *vconf_char;
        int vconf_int;
        bool vconf_bool;
 
-       switch (item->data_type) {
+       switch (iface->data_type) {
        case SYSTEM_SETTING_DATA_TYPE_STRING:
                vconf_char = (char*)value;
-               if (vconf_set_str(item->vconf_key, vconf_char))
+               if (vconf_set_str(iface->vconf_key, vconf_char))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                break;
        case SYSTEM_SETTING_DATA_TYPE_INT:
+               //todo: change double pointer to valide data type
                vconf_int = **(int**)value;
-               if (vconf_set_int(item->vconf_key, vconf_int))
+               if (vconf_set_int(iface->vconf_key, vconf_int))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                break;
        case SYSTEM_SETTING_DATA_TYPE_BOOL:
                vconf_bool = *(bool*)value;
-               if (vconf_set_bool(item->vconf_key, vconf_bool))
+               if (vconf_set_bool(iface->vconf_key, vconf_bool))
                        return SYSTEM_SETTINGS_ERROR_IO_ERROR;
                break;
        default:
-               ERR("Error system_setting_h struct data_type");
+               ERR("Unknown type(%d)", iface->data_type);
                return SYSTEM_SETTINGS_ERROR_IO_ERROR;
        }
 
index a1b6afe..2b0a01d 100644 (file)
 
 #include "sst_core.h"
 
-/**
- * @internal
- * @since_tizen 6.0
- * Enumeration for callback slot
- */
-typedef enum {
-    SYSTEM_SETTING_CALLBACK_SLOT_0 = 0,
-    SYSTEM_SETTING_CALLBACK_SLOT_1 = 1,
-    SYSTEM_SETTING_CALLBACK_SLOT_2 = 2,
-    SYSTEM_SETTING_CALLBACK_SLOT_3 = 3,
-    SYSTEM_SETTING_CALLBACK_SLOT_4 = 4,
-    SYSTEM_SETTING_CALLBACK_SLOT_5 = 5
-} sst_vconf_cb_slot_e;
-
-/**
- * @internal
- * @brief get vconf of in bool value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key string
- * @param[out] value get the bool type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
 int sst_vconf_get_real_bool(const char *vconf_key, bool *value);
-
-/**
- * @internal
- * @brief get vconf of string type value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key string
- * @param[out] value get the string(char*) type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
 int sst_vconf_get_string(const char *vconf_key, char **value);
 
+int sst_vconf_get(sst_interface *iface, void **value);
+int sst_vconf_set(sst_interface *iface, void *value);
 
-/**
- * @internal
- * @brief get vconf value for genernal case
- * @since_tizen 6.0
- *
- * @param[in] system_setting_h item
- * @param[in] void value pointer
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_vconf(system_setting_h item, void **value);
-
-/**
- * @internal
- * @brief set vconf value for genernal case
- * @since_tizen 6.0
- *
- * @param[in] system_setting_h item
- * @param[in] void value pointer
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_vconf(system_setting_h item, void *value);
-
-/**
- * @internal
- * @brief set vconf notification callback for genernal case
- * @since_tizen 6.0
- *
- * @param[in] system_setting_h item
- * @param[in] system_settings_changed_cb callback
- * @param[in] user_data user data
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_set_changed_vconf_genernal_callback(system_setting_h item, void *user_data);
-
-/**
- * @internal
- * @brief unset vconf notification callback for genernal case
- * @since_tizen 6.0
- *
- * @param[in] system_setting_h item
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_unset_changed_vconf_genernal_callback(system_setting_h item);
-
-/**
- * @internal
- * @brief Unset the system settings notification callback
- * @since_tizen 4.0
- * @param[in] vconf_key vconf key name used in the code
- * @param[in] key system_settings_key_e value.
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- */
-int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key);
-
-/**
- * @internal
- * @brief Unset the system settings notification callback
- * @since_tizen 4.0
- * @param[in] vconf_key vconf key name used in the code
- * @param[in] key system_settings_key_e value.
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error
- */
-int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_settings_key_e key);
+int sst_vconf_set_changed_cb(sst_interface *iface, void *user_data);
+int sst_vconf_unset_changed_cb(sst_interface *iface);
+int sst_vconf_set_multi_changed_cb(const char *vconf_key, system_settings_key_e key);
+int sst_vconf_unset_multi_changed_cb(const char *vconf_key, system_settings_key_e key);
diff --git a/src/standard_excl/sst_standard.c b/src/standard_excl/sst_standard.c
new file mode 100644 (file)
index 0000000..9ca372e
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "../sst_exclusive.h"
+
+#include <vconf.h>
+#include "system_settings.h"
+#include "sst.h"
+
+int sst_excl_set_wallpaper(const char *key, const char *val)
+{
+       if (vconf_set_str(key, val)) {
+               ERR("vconf_set_str(%s) Fail", key);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/wearable_excl/sst_wearable.c b/src/wearable_excl/sst_wearable.c
new file mode 100644 (file)
index 0000000..79704e4
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "../sst_exclusive.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <gio/gio.h>
+#include <vconf.h>
+#include <tzplatform_config.h>
+#include "system_settings.h"
+#include "sst.h"
+
+#define WALLPAPER_MAX_COUNT 10
+
+static const char* const sst_ext_walpaper_prefix = "extended_wallpaper_";
+static const char* const sst_ext_walpaper_dir = _TZ_SYS_DATA"/setting/wallpaper";
+
+static int _get_extended_wallpaper_num(const char *file, unsigned int *num)
+{
+       char buf[256];
+       const char *find_str = sst_ext_walpaper_prefix;
+       char *ch;
+
+       if (!(ch = strstr(file, find_str)))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       strncpy(buf, file, ch - file);
+       buf[ch - file] = 0;
+       sprintf(buf + (ch - file), "%s%s", "", ch + strlen(find_str));
+
+       if (!isdigit(buf[0])) {
+               ERR("%s is not number", buf);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       *num = atoi(buf);
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+static int _copy_extended_wallpaper(const char *dest_path, const char *src_path)
+{
+       GFile *src, *dest;
+
+       RETV_IF(NULL == src_path, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == dest_path, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       src = g_file_new_for_path(src_path);
+       dest = g_file_new_for_path(dest_path);
+
+       GError *error = NULL;
+       if (!g_file_copy(src, dest, G_FILE_MONITOR_NONE, NULL, NULL, NULL, &error)) {
+               ERR("g_file_copy() Fail(%s)", error->message);
+               g_error_free(error);
+       }
+
+       g_object_unref(dest);
+       g_object_unref(src);
+
+       if (chmod(dest_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0)
+               ERR("chmod(%s) Fail(%d)", dest_path, errno);
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+static int _remove_oldest_extended_wallpaper()
+{
+       DIR *dir;
+       struct dirent *entry;
+       char *min_image_name = NULL;
+       unsigned int min_image_num = UINT_MAX;
+       unsigned int cur_num = 0;
+
+       dir = opendir(sst_ext_walpaper_dir);
+       if (NULL == dir) {
+               ERR("opendir(%s) Fail(%d)", sst_ext_walpaper_dir, errno);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       while ((entry = readdir(dir))) {
+               if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
+                       continue;
+
+               int ret = _get_extended_wallpaper_num(entry->d_name, &cur_num);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("_get_extended_wallpaper_num(%s) Fail(%d)", entry->d_name, ret);
+                       closedir(dir);
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+
+               if (cur_num < min_image_num) {
+                       min_image_num = cur_num;
+                       min_image_name = entry->d_name;
+               }
+       }
+
+       char buf[PATH_MAX];
+       if (min_image_name) {
+               snprintf(buf, sizeof(buf) - 1, "%s/%s", sst_ext_walpaper_dir, min_image_name);
+               if (remove(buf) < 0) {
+                       ERR("remove(%s) Fail(%d)", buf, errno);
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+static bool _check_extended_wallpaper(const char *file_path)
+{
+       char buf[PATH_MAX];
+
+       RETV_IF(NULL == file_path, false);
+       RETV_IF('\0' == *file_path, false);
+
+       snprintf(buf, sizeof(buf), "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
+       return (strstr(file_path, buf) != NULL);
+}
+
+int sst_excl_set_wallpaper(const char *key, const char *val)
+{
+       int ret;
+       DIR *dir;
+       struct dirent *entry;
+       unsigned int max_image_num = 0;
+       unsigned int cur_num = 0;
+       int image_count = 0;
+
+       if (false == _check_extended_wallpaper(val)) {
+               if (vconf_set_str(key, val)) {
+                       ERR("vconf_set_str(%s) Fail", key);
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+
+               return SYSTEM_SETTINGS_ERROR_NONE;
+       }
+
+       dir = opendir(sst_ext_walpaper_dir);
+       if (NULL == dir) {
+               ERR("opendir(%s) Fail(%d)", sst_ext_walpaper_dir, errno);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       /* Check a max number of wallpapers */
+       while ((entry = readdir(dir))) {
+               if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
+                       continue;
+
+               ret = _get_extended_wallpaper_num(entry->d_name, &cur_num);
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("_get_extended_wallpaper_num(%s) Fail(%d)", entry->d_name, ret);
+                       closedir(dir);
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+
+               if (max_image_num < cur_num)
+                       max_image_num = cur_num;
+       }
+       closedir(dir);
+
+       /* Numbering rule: Gear is odd number */
+       max_image_num += (max_image_num % 2 == 0) ? 1 : 2;
+
+       char file_name_buffer[PATH_MAX];
+       snprintf(file_name_buffer, sizeof(file_name_buffer) - 1, "%s/%s%d.jpg",
+               sst_ext_walpaper_dir, sst_ext_walpaper_prefix, max_image_num);
+
+       ret = _copy_extended_wallpaper(file_name_buffer, val);
+       if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+               ERR("_copy_extended_wallpaper(%s, %s) Fail", file_name_buffer, val);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       if (WALLPAPER_MAX_COUNT <= image_count) {
+               ret = _remove_oldest_extended_wallpaper();
+               if (SYSTEM_SETTINGS_ERROR_NONE != ret) {
+                       ERR("_remove_oldest_extended_wallpaper() Fail(%d)", ret);
+                       remove(file_name_buffer);
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               }
+       }
+
+       if (vconf_set_str(key, file_name_buffer)) {
+               ERR("vconf_set_str(%s, %s) Fail", key, file_name_buffer);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       const char *noti_key = VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT;
+       if (vconf_set_int(noti_key, VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
+               ERR("vconf_set_int(%s, %d) Fail", noti_key, VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
index aaa29d6..c564ae4 100644 (file)
@@ -45,9 +45,10 @@ API int access(const char *pathname, int mode)
 
 API ssize_t readlink(const char *restrict path, char *restrict buf, size_t len)
 {
+       const char *local = "/usr/share/zoneinfo/Asia/Seoul";
        if (0 == strcmp(path, "/opt/etc/localtime")) {
-               memcpy(buf, "123456789012345678901234567890", len);
-               return 30;
+               strncpy(buf, local, len);
+               return (sizeof(local) - 1);
        }
 
        ssize_t(*org_fn)(const char *restrict, char *restrict, size_t);
@@ -60,7 +61,7 @@ API DIR *opendir(const char *name)
        DIR *(*org_fn)(const char *);
        org_fn = dlsym(RTLD_NEXT, "opendir");
 
-       if (0 == strcmp(name, SETTING_DEF_RES"/Ringtones")) {
+       if (0 == strcmp(name, SST_RES_DIR"/Ringtones")) {
                org_fn = dlsym(RTLD_NEXT, "opendir");
                return org_fn("tests/res");
        }
index b041832..b45852e 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <string.h>
-
 #include <pkgmgr-info.h>
 #include "sst.h"
 
-API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid,
-               pkgmgrinfo_appinfo_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
-               pkgmgrinfo_appinfo_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
 {
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_get_usr_all_appinfo(const char *appid, uid_t uid,
-               pkgmgrinfo_appinfo_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_all_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_appinfo_h *clone)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle,
-               pkgmgrinfo_app_component component,
-               pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle,
-               pkgmgrinfo_app_component component,
-               pkgmgrinfo_app_list_cb app_func, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_usr_installed_list_full(
-               pkgmgrinfo_app_list_cb app_func, uid_t uid, int flag,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_installed_list_full(
-               pkgmgrinfo_app_list_cb app_func, int flag, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_usr_installed_list(
-               pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_pkgtype(pkgmgrinfo_appinfo_h  handle, char **pkgtype)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
-{
-       return PMINFO_R_OK;
-}
-
-
-API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
-{
-       return PMINFO_R_OK;
-}
-
-
-API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_metadata_value(pkgmgrinfo_appinfo_h handle, const char *metadata_key, char **metadata_value)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h  handle,
-               int *operation_count, char ***operation)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h  handle,
-               int *uri_count, char ***uri)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h  handle,
-               int *mime_count, char ***mime)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h  handle,
-               int *subapp_count, char ***subapp)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
-{
-       return PMINFO_R_ERROR;
-}
-
-API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
-{
-       return PMINFO_R_ERROR;
-}
-
-API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, char **effectimage_type)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_zip_mount_file(pkgmgrinfo_appinfo_h handle, char **zip_mount_file)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **root_path)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_installed_time(pkgmgrinfo_appinfo_h handle, int *installed_time)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid,
-               const char *type, uid_t uid, char **appid, char **access)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid,
-               const char *type, char **appid, char **access)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid,
-               uid_t uid, char **appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(
-               const char *providerid, const char *type, uid_t uid,
-               char **appid, bool *is_trusted)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_datacontrol_trsuted_info(const char *providerid,
-               const char *type, char **appid, bool *is_trusted)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_foreach_datacontrol_privileges(
-               const char *providerid, const char *type,
-               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
-               void *user_data, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(
-               const char *providerid, const char *type,
-               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h  handle, int *support_mode)
-{
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
                pkgmgrinfo_app_category_list_cb category_func, void *user_data)
 {
        return PMINFO_R_OK;
 }
 
-API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(const char *appid,
-               const char *operation,
-               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
-               void *user_data, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
-               const char *operation,
-               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_remote_appcontrol(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_background_category(
-               pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_background_category_list_cb category_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_splash_screen_list_cb splash_screen_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h  handle, bool *taskmanage)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h  handle, bool *enabled)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h  handle, bool *onboot)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h  handle, bool *autorestart)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h  handle, bool *mainapp)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle,
-               bool *ui_gadget)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle,
-               bool *support_disable)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_removable(pkgmgrinfo_appinfo_h handle,
-               bool *removable)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_system(pkgmgrinfo_appinfo_h handle, bool *system)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_splash_screen_display(pkgmgrinfo_appinfo_h handle, bool *splash_screen_display)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup_appid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle,
-               bool *support_ambient)
-{
-       return PMINFO_R_OK;
-}
-
 API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
 {
        return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
-{
-       return (pkgmgrinfo_pkginfo_filter_create(handle));
-}
-
-API int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
-{
-       return (pkgmgrinfo_pkginfo_filter_destroy(handle));
-}
-
-API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
-               const char *property, const int value)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
-               const char *property, const bool value)
-{
-       return PMINFO_R_OK;
-
-}
-
-API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
-               const char *property, const char *value)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(
-               pkgmgrinfo_appinfo_filter_h handle,
-               pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
-               pkgmgrinfo_app_list_cb app_cb, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_metadata_filter_add(
-               pkgmgrinfo_appinfo_metadata_filter_h handle,
-               const char *key, const char *value)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(
-               pkgmgrinfo_appinfo_metadata_filter_h handle,
-               pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_metadata_filter_foreach(
-               pkgmgrinfo_appinfo_metadata_filter_h handle,
-               pkgmgrinfo_app_list_cb app_cb, void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
-
-API int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(
-               pkgmgrinfo_appinfo_h handle,
-               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
-               void *user_data)
-{
-       return PMINFO_R_OK;
-}
+}
\ No newline at end of file
index f69fa33..ba15569 100644 (file)
@@ -25,9 +25,6 @@
 #include <string>
 #include "sst.h"
 
-#define LOG_D(fmt, arg...) //fprintf(fmt, arg...)
-#define LOG_E fprintf
-
 using namespace std;
 
 typedef std::map<string, pair<void*, void*>> NotifyMap;
@@ -108,7 +105,7 @@ void checkNotifyCallBack(const char *in_key, int type, UnionValue *value)
 
        NotifyMap::iterator  itr;
        for (itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++) {
-               LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
+               DBG("map Key[%s]", itr->first.c_str());
 
                if (str.compare(itr->first) == 0) {
                        vconf_callback_fn cb = (vconf_callback_fn)itr->second.first;
@@ -131,7 +128,7 @@ void checkNotifyCallBack(const char *in_key, int type, UnionValue *value)
                                node.value.b = value->b;
                                break;
                        default:
-                               LOG_D(stdout, "[%s][%d] invalid type [%d] \n", __func__, __LINE__, node.type);
+                               DBG("invalid type [%d] ", node.type);
                                return;
                        }
                        cb(&node, user_data);
@@ -141,7 +138,7 @@ void checkNotifyCallBack(const char *in_key, int type, UnionValue *value)
 
 static sqlite3 *db = NULL;
 
-void _sqlite_close()
+static void _sqlite_close()
 {
        if (db != NULL) {
                sqlite3_close(db);
@@ -149,14 +146,14 @@ void _sqlite_close()
        }
 }
 
-int _sqlite_connect()
+static int _sqlite_connect()
 {
        if (db != NULL)
                return VCONF_OK;
 
        int rc = sqlite3_open(DB_NAME, &db);
        if (rc != SQLITE_OK) {
-               LOG_E(stderr, "[%s][%d] sqlite3_open error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), sqlite3_errmsg(db));
+               ERR("sqlite3_open() Fail(%d) sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]", rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), sqlite3_errmsg(db));
                _sqlite_close();
                return VCONF_ERROR;
        }
@@ -263,7 +260,7 @@ API int vconf_keylist_del(keylist_t *keylist, const char *keyname)
  * setting APIs                                 *
  ************************************************/
 
-int _vconf_set_str(const char *in_key, const char *strval)
+static int _vconf_set_str(const char *in_key, const char *strval)
 {
        int rc;
        char *err_msg = 0;
@@ -277,13 +274,12 @@ int _vconf_set_str(const char *in_key, const char *strval)
 
 #if 1 /* journal mode */
        {
-               LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+               DBG("key[%s] value[%s]", in_key, strval);
                snprintf(sql, MAX_BUF_LEN, "PRAGMA JOURNAL_MODE=MEMORY");
 
                rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
                if (rc != SQLITE_OK) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
-
+                       ERR("sqlite3_exec() Fail(%d) sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]", rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
                        sqlite3_free(err_msg);
                        _sqlite_close();
                        return VCONF_ERROR;
@@ -298,7 +294,7 @@ int _vconf_set_str(const char *in_key, const char *strval)
 
                rc = sqlite3_prepare(db, sql, -1, &stmt, 0);
                if (rc != SQLITE_OK) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+                       ERR("sqlite3_prepare() Fail(%s)", sqlite3_errmsg(db));
                        sqlite3_finalize(stmt);
                        _sqlite_close();
                        return VCONF_ERROR;
@@ -307,13 +303,13 @@ int _vconf_set_str(const char *in_key, const char *strval)
                sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
                rc = sqlite3_step(stmt);
                if (rc != SQLITE_ROW) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+                       ERR("sqlite3_step() Fail(%s)", sqlite3_errmsg(db));
                        sqlite3_finalize(stmt);
                        _sqlite_close();
                        return VCONF_ERROR;
                }
 
-               LOG_D(stdout, "vconf get: layer[%s] key[%s], value[%s]\n",
+               DBG("vconf get: layer[%s] key[%s], value[%s]",
                                sqlite3_column_text(stmt, 0),
                                sqlite3_column_text(stmt, 1),
                                sqlite3_column_text(stmt, 2));
@@ -324,14 +320,13 @@ int _vconf_set_str(const char *in_key, const char *strval)
 
 #if 0 /* insert key */
        {
-               LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+               DBG("key[%s] value[%s]", in_key, strval);
                snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
                                "VALUES ( \"%s\", \"%s\", \'%s\');", "system", in_key, strval);
 
                rc = sqlite3_exec(db, sql, 0, 0, &err_msg);
                if (rc != SQLITE_OK) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_exec error: rc [%d] sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]\n", __func__, __LINE__, rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
-
+                       ERR("sqlite3_exec() Fail(%d) sqlerrcode[%d] sqlexterrcode[%d] sqlmessage[%s]", rc, sqlite3_errcode(db), sqlite3_extended_errcode(db), err_msg);
                        sqlite3_free(err_msg);
                        _sqlite_close();
 
@@ -343,13 +338,13 @@ int _vconf_set_str(const char *in_key, const char *strval)
 #if 1 /* insert key with parameter */
        {
                sqlite3_stmt *stmt = NULL;
-               LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval);
+               DBG("key[%s] value[%s]", in_key, strval);
                snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) "
                                "VALUES ( \"%s\", ?, ?);", "system");
 
                rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
                if (rc != SQLITE_OK) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_prepare error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+                       ERR("sqlite3_prepare() Fail(%s)", sqlite3_errmsg(db));
                        sqlite3_finalize(stmt);
                        _sqlite_close();
                        return VCONF_ERROR;
@@ -360,7 +355,7 @@ int _vconf_set_str(const char *in_key, const char *strval)
 
                rc = sqlite3_step(stmt);
                if (rc != SQLITE_DONE) {
-                       LOG_E(stderr, "[%s][%d] sqlite3_step error! : %s\n", __func__, __LINE__, sqlite3_errmsg(db));
+                       ERR("sqlite3_step() Fail(%s)", sqlite3_errmsg(db));
                        sqlite3_finalize(stmt);
                        _sqlite_close();
                        return VCONF_ERROR;
@@ -383,7 +378,7 @@ API int vconf_set_int(const char *in_key, const int intval)
 
        rc = _vconf_set_str(in_key, buf);
        if (rc != VCONF_OK) {
-               LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+               ERR("_vconf_set_str() Fail");
                return VCONF_ERROR;
        }
 
@@ -402,7 +397,7 @@ API int vconf_set_bool(const char *in_key, const int boolval)
 
        rc = _vconf_set_str(in_key, buf);
        if (rc != VCONF_OK) {
-               LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+               ERR("_vconf_set_str() Fail");
                return VCONF_ERROR;
        }
 
@@ -421,7 +416,7 @@ API int vconf_set_dbl(const char *in_key, const double dblval)
 
        rc = _vconf_set_str(in_key, buf);
        if (rc != VCONF_OK) {
-               LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+               ERR("_vconf_set_str() Fail");
                return VCONF_ERROR;
        }
 
@@ -438,7 +433,7 @@ API int vconf_set_str(const char *in_key, const char *strval)
 
        rc = _vconf_set_str(in_key, strval);
        if (rc != VCONF_OK) {
-               LOG_E(stderr, "[%s][%d] _vconf_set_str error!\n", __func__, __LINE__);
+               ERR("_vconf_set_str() Fail");
                return VCONF_ERROR;
        }
 
@@ -460,7 +455,7 @@ API char *vconf_get_str(const char *in_key)
        char sql[MAX_BUF_LEN + 1];
        char *str = NULL;
 
-       LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key);
+       DBG("start! key [%s] ", in_key);
 
        rc = _sqlite_connect();
        if (rc != SQLITE_OK) {
@@ -475,7 +470,7 @@ API char *vconf_get_str(const char *in_key)
        do {
                rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0);
                if (rc != SQLITE_OK) {
-                       LOG_E(stderr, "[%s][%d] sqltie3_prepare error! rc[%d] : %s\n", __func__, __LINE__, rc, sqlite3_errmsg(db));
+                       ERR("sqltie3_prepare() Fail(%d) : %s", rc, sqlite3_errmsg(db));
 
                        if (count >= 5) {
                                _sqlite_close();
@@ -492,14 +487,13 @@ API char *vconf_get_str(const char *in_key)
        sqlite3_bind_text(stmt, 1, in_key, strlen(in_key), SQLITE_STATIC);
        rc = sqlite3_step(stmt);
        if (rc != SQLITE_ROW) {
-               LOG_E(stderr, "[%s][%d] sqlite3_step error! key[%s]\n", __func__, __LINE__, in_key);
+               ERR("sqlite3_step() Fail(%s)", in_key);
                sqlite3_finalize(stmt);
                _sqlite_close();
                return NULL;
        }
 
-       LOG_D(stdout, "[%s][%d] vconf get: layer[%s] key[%s], value[%s]\n",
-                       __func__, __LINE__,
+       DBG("vconf get: layer[%s] key[%s], value[%s]",
                        sqlite3_column_text(stmt, 0),
                        sqlite3_column_text(stmt, 1),
                        sqlite3_column_text(stmt, 2));
@@ -509,14 +503,12 @@ API char *vconf_get_str(const char *in_key)
 
        sqlite3_finalize(stmt);
 
-       LOG_D(stdout, "[%s][%d] vconf get: key[%s], value[%s]\n", __func__, __LINE__, in_key, str);
+       DBG("vconf get: key[%s], value[%s]", in_key, str);
        return str;
 }
 
 API int vconf_get_int(const char *in_key, int *intval)
 {
-       LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__);
-
        char *value = vconf_get_str(in_key);
 
        if (value == NULL)
@@ -530,12 +522,12 @@ API int vconf_get_int(const char *in_key, int *intval)
 
 API int vconf_get_bool(const char *in_key, int *boolval)
 {
-       LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key);
+       DBG("start! key [%s] ", in_key);
 
        char *value = vconf_get_str(in_key);
 
        if (value == NULL) {
-               LOG_E(stdout, "[%s][%d] value is NULL! \n", __func__, __LINE__);
+               ERR("NULL value");
                return VCONF_ERROR;
        }
 
@@ -550,8 +542,6 @@ API int vconf_get_bool(const char *in_key, int *boolval)
 
 API int vconf_get_dbl(const char *in_key, double *dblval)
 {
-       LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__);
-
        char *value = vconf_get_str(in_key);
        char *ptr;
 
@@ -589,7 +579,7 @@ API int vconf_notify_key_changed(const char *in_key, vconf_callback_fn cb,
 #if 0 /* map debug */
        NotifyMap::iterator  itr;
        for (itr = notifyCallBackMap.begin(); itr != notifyCallBackMap.end(); itr++) {
-               LOG_D(stdout, "[%s][%d] map Key[%s]\n", __func__, __LINE__, itr->first.c_str());
+               DBG("map Key[%s]", itr->first.c_str());
        }
 #endif
        return VCONF_OK;
similarity index 88%
rename from tests/sys_settings_test.h
rename to tests/sstt.h
index c701717..4686fa1 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <glib.h>
+
+void add_test_func(char *test_name, GTestFunc func_pointer);
+void unittest_api();
+
+#ifndef SYS_SETTINGS_TEST_DIR
+#define SYS_SETTINGS_TEST_DIR "/usr/bin/sys-settings"
+#warning "SYS_SETTINGS_TEST_DIR is redefined"
+#endif
+
+#define GLIB_MODE
+
+#ifdef GLIB_MODE
+#define RETTYPE void
+#define RETURN(a) return
+#else
+#define RETTYPE int
+#define RETURN(a) return a
+#endif
+
+#ifndef N_THREADS
+#define N_THERADS 0
+#endif
+
+#define MAX_TEST_CASE 1000
 
 #ifndef GLIB_MODE
 #define assert(exp) \
similarity index 93%
rename from tests/sys_settings_test_fw.c
rename to tests/sstt_main.c
index 3335fb4..6b8ccdd 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include "sys_settings_test_fw.h"
+#include <unistd.h>
+
+#include "sst.h"
+#include "sstt.h"
 
 typedef struct __thread_test_table {
        char * test_name;
@@ -27,7 +30,7 @@ static int thread_test_idx = 0;
 static int loop = 100;
 static int thread_sw = 1;
 
-void *thread_function(void *data)
+static void *thread_function(void *data)
 {
        int cnt = 0;
        int test_idx = (int)data;
@@ -100,8 +103,17 @@ static void stop_main_loop_thread()
        g_main_loop_unref(main_loop);
 }
 
+void add_test_func(char *test_name, GTestFunc func_pointer)
+{
+       g_test_add_func(test_name, func_pointer);
+
+       thread_test_table[thread_test_idx].test_name = test_name;
+       thread_test_table[thread_test_idx].t_func = func_pointer;
+
+       thread_test_idx++;
+}
 
-int main(int argc, char* argv[])
+int main(int argc, char **argv)
 {
        main_loop = g_main_loop_new(NULL, FALSE);
 
@@ -118,14 +130,3 @@ int main(int argc, char* argv[])
        stop_main_loop_thread();
        return 0;
 }
-
-void add_test_func(char * test_name, GTestFunc func_pointer)
-{
-       g_test_add_func(test_name, func_pointer);
-
-       thread_test_table[thread_test_idx].test_name = test_name;
-       thread_test_table[thread_test_idx].t_func = func_pointer;
-
-       thread_test_idx++;
-}
-
similarity index 99%
rename from tests/sys_settings_test.c
rename to tests/sstt_test.c
index 919350e..be937e9 100644 (file)
@@ -17,7 +17,7 @@
 #include <system_settings.h>
 
 #include "sst.h"
-#include "sys_settings_test_fw.h"
+#include "sstt.h"
 
 void unit_test_callback0(system_settings_key_e key, void *user_data) { }
 void unit_test_callback1(system_settings_key_e key, void *user_data) { }
diff --git a/tests/sys_settings_test_fw.h b/tests/sys_settings_test_fw.h
deleted file mode 100644 (file)
index 1619c28..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2017-2020 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#ifndef __UNIT_TEST_FW__
-#define __UNIT_TEST_FW__
-
-#define GLIB_MODE
-
-#include <stdio.h>
-#include <glib.h>
-#include <unistd.h>
-
-#include "sys_settings_test.h"
-
-void add_test_func(char *test_name, GTestFunc func_pointer);
-void unittest_api();
-
-#ifndef SYS_SETTINGS_TEST_DIR
-#define SYS_SETTINGS_TEST_DIR "/usr/bin/sys-settings"
-#warning "SYS_SETTINGS_TEST_DIR is redefined"
-#endif
-
-#ifdef GLIB_MODE
-#define RETTYPE void
-#define RETURN(a) return
-#else
-#define RETTYPE int
-#define RETURN(a) return a
-#endif
-
-#ifndef N_THREADS
-#define N_THERADS 0
-#endif
-
-#define MAX_TEST_CASE 1000
-
-#endif
similarity index 58%
rename from utils/sys_settings_util.c
rename to utils/sstu.c
index 2048a01..499b182 100644 (file)
 #include "system_settings.h"
 #include "sst.h"
 #include "sst_core.h"
-#include "sys_settings_util.h"
-#include "sys_settings_font.h"
+#include "sstu.h"
+#include "sstu_font.h"
 
 #ifdef TIZEN_WEARABLE
 #define SMALL_FONT_DPI                                         (-90)
-#endif
-#ifdef TIZEN_MOBILE
+#else
 #define SMALL_FONT_DPI                                         (-80)
 #endif
+
 #define MIDDLE_FONT_DPI                                                (-100)
+
 #ifdef TIZEN_WEARABLE
 #define LARGE_FONT_DPI                                         (-110)
-#endif
-#ifdef TIZEN_MOBILE
+#else
 #define LARGE_FONT_DPI                                         (-150)
 #endif
+
 #define HUGE_FONT_DPI                                          (-190)
 #define GIANT_FONT_DPI                                         (-250)
 
 #define SETTING_EFL_EXTENSION_SO_PATH "libefl-extension.so.0"
 #define SETTING_EVAS_SO_PATH "libevas.so.1"
 
-void *d_font_handle = NULL;
-void *d_ecore_evas_handle = NULL;
-void *d_evas_handle = NULL;
-void *d_efl_eext_handle = NULL;
+static void *sstu_font_handle = NULL;
+static void *sstu_efl_handle = NULL;
+static void *sstu_evas_handle = NULL;
+static void *sstu_efl_ext_handle = NULL;
 
 #define DYM_FUNC_LOADING(error, handle, pfunc, func_name) do { \
-       pfunc = (void*)dlsym(handle, func_name); \
+       pfunc = dlsym(handle, func_name); \
        if ((error = dlerror()) != NULL) { \
-               SST_SECURE_TRACE("ERROR!! canNOT find %s function at %s", func_name, #handle); \
+               SECURE_ERR("ERROR!! canNOT find %s function at %s", func_name, #handle); \
                if (handle) \
                dlclose(handle); \
                return false; \
@@ -70,105 +71,104 @@ void *d_efl_eext_handle = NULL;
        } \
 } while (0)
 
-int loading_dym_font(f_libs *font_lib)
+static int _load_font_symbol(f_libs *font_lib)
 {
        char *error = NULL;
 
        if (!font_lib)
                return false;
 
-       if (!d_font_handle) {
-               d_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY);
-               if (!d_font_handle) {
-                       SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH);
+       if (!sstu_font_handle) {
+               sstu_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY | RTLD_GLOBAL);
+               if (!sstu_font_handle) {
+                       SECURE_ERR("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH);
                        return false;
                }
        }
 
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcInitLoadConfigAndFonts, "FcInitLoadConfigAndFonts");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcPatternBuild, "FcPatternBuild");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcConfigDestroy, "FcConfigDestroy");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcConfigSubstitute, "FcConfigSubstitute");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcDefaultSubstitute, "FcDefaultSubstitute");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcFontSort, "FcFontSort");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcPatternGetString, "FcPatternGetString");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcFontSetDestroy, "FcFontSetDestroy");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcPatternDestroy, "FcPatternDestroy");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcPatternCreate, "FcPatternCreate");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcObjectSetBuild, "FcObjectSetBuild");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcFontList, "FcFontList");
-       DYM_FUNC_LOADING(error, d_font_handle, font_lib->d_FcObjectSetDestroy, "FcObjectSetDestroy");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcInitLoadConfigAndFonts, "FcInitLoadConfigAndFonts");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcPatternBuild, "FcPatternBuild");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcConfigDestroy, "FcConfigDestroy");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcConfigSubstitute, "FcConfigSubstitute");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcDefaultSubstitute, "FcDefaultSubstitute");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcFontSort, "FcFontSort");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcPatternGetString, "FcPatternGetString");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcFontSetDestroy, "FcFontSetDestroy");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcPatternDestroy, "FcPatternDestroy");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcPatternCreate, "FcPatternCreate");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcObjectSetBuild, "FcObjectSetBuild");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcFontList, "FcFontList");
+       DYM_FUNC_LOADING(error, sstu_font_handle, font_lib->d_FcObjectSetDestroy, "FcObjectSetDestroy");
 
        return true;
 }
 
-int loading_dym_efl(e_libs *efl_libs)
+static int _load_efl(e_libs *efl_libs)
 {
        char *error = NULL;
 
        if (!efl_libs)
                return false;
 
-       if (!d_ecore_evas_handle) {
-               d_ecore_evas_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY);
-               if (!d_ecore_evas_handle) {
-                       SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_ECORE_EVAS_SO_PATH" %s", dlerror());
+       if (!sstu_efl_handle) {
+               sstu_efl_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY | RTLD_GLOBAL);
+               if (!sstu_efl_handle) {
+                       SECURE_ERR("ERROR!! canNOT find "SETTING_ECORE_EVAS_SO_PATH" %s", dlerror());
 
                        return false;
                }
        }
 
-       if (!d_evas_handle) {
-               d_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY);
-               if (!d_evas_handle) {
-                       SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_EVAS_SO_PATH" %s", dlerror());
+       if (!sstu_evas_handle) {
+               sstu_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY | RTLD_GLOBAL);
+               if (!sstu_evas_handle) {
+                       SECURE_ERR("ERROR!! canNOT find "SETTING_EVAS_SO_PATH" %s", dlerror());
                        return false;
                }
        }
 
-       DYM_FUNC_LOADING(error, d_evas_handle, efl_libs->d_evas_init, "evas_init");
-       DYM_FUNC_LOADING(error, d_evas_handle, efl_libs->d_evas_object_image_add, "evas_object_image_add");
-       DYM_FUNC_LOADING(error, d_evas_handle, efl_libs->d_evas_object_image_file_set, "evas_object_image_file_set");
-       DYM_FUNC_LOADING(error, d_evas_handle, efl_libs->d_evas_object_image_load_error_get, "evas_object_image_load_error_get");
-       DYM_FUNC_LOADING(error, d_evas_handle, efl_libs->d_evas_shutdown, "evas_shutdown");
+       DYM_FUNC_LOADING(error, sstu_evas_handle, efl_libs->d_evas_init, "evas_init");
+       DYM_FUNC_LOADING(error, sstu_evas_handle, efl_libs->d_evas_object_image_add, "evas_object_image_add");
+       DYM_FUNC_LOADING(error, sstu_evas_handle, efl_libs->d_evas_object_image_file_set, "evas_object_image_file_set");
+       DYM_FUNC_LOADING(error, sstu_evas_handle, efl_libs->d_evas_object_image_load_error_get, "evas_object_image_load_error_get");
+       DYM_FUNC_LOADING(error, sstu_evas_handle, efl_libs->d_evas_shutdown, "evas_shutdown");
 
-       DYM_FUNC_LOADING(error, d_ecore_evas_handle, efl_libs->d_ecore_evas_init, "ecore_evas_init");
-       DYM_FUNC_LOADING(error, d_ecore_evas_handle, efl_libs->d_ecore_evas_shutdown, "ecore_evas_shutdown");
-       DYM_FUNC_LOADING(error, d_ecore_evas_handle, efl_libs->d_ecore_evas_new, "ecore_evas_new");
-       DYM_FUNC_LOADING(error, d_ecore_evas_handle, efl_libs->d_ecore_evas_get, "ecore_evas_get");
-       DYM_FUNC_LOADING(error, d_ecore_evas_handle, efl_libs->d_ecore_evas_free, "ecore_evas_free");
+       DYM_FUNC_LOADING(error, sstu_efl_handle, efl_libs->d_ecore_evas_init, "ecore_evas_init");
+       DYM_FUNC_LOADING(error, sstu_efl_handle, efl_libs->d_ecore_evas_shutdown, "ecore_evas_shutdown");
+       DYM_FUNC_LOADING(error, sstu_efl_handle, efl_libs->d_ecore_evas_new, "ecore_evas_new");
+       DYM_FUNC_LOADING(error, sstu_efl_handle, efl_libs->d_ecore_evas_get, "ecore_evas_get");
+       DYM_FUNC_LOADING(error, sstu_efl_handle, efl_libs->d_ecore_evas_free, "ecore_evas_free");
 
        return true;
 }
 
-void close_dym_efl()
+static void _close_efl()
 {
-       DYM_CLOSE_HANDLE(d_evas_handle);
-       DYM_CLOSE_HANDLE(d_ecore_evas_handle);
+       DYM_CLOSE_HANDLE(sstu_evas_handle);
+       DYM_CLOSE_HANDLE(sstu_efl_handle);
 }
 
-int loading_dym_efl_eext(ex_libs *eext_libs)
+static int _load_efl_extension(ex_libs *eext_libs)
 {
        char *error = NULL;
 
        if (!eext_libs)
                return false;
 
-       if (!d_efl_eext_handle) {
-               d_efl_eext_handle = dlopen(SETTING_EFL_EXTENSION_SO_PATH, RTLD_LAZY);
-               if (!d_efl_eext_handle) {
-                       SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_EFL_EXTENSION_SO_PATH" %s", dlerror());
+       if (!sstu_efl_ext_handle) {
+               sstu_efl_ext_handle = dlopen(SETTING_EFL_EXTENSION_SO_PATH, RTLD_LAZY | RTLD_GLOBAL);
+               if (!sstu_efl_ext_handle) {
+                       SECURE_ERR("ERROR!! canNOT find "SETTING_EFL_EXTENSION_SO_PATH" %s", dlerror());
                        return false;
                }
        }
 
-       DYM_FUNC_LOADING(error, d_efl_eext_handle, eext_libs->d_eext_config_font_set, "eext_config_font_set");
+       DYM_FUNC_LOADING(error, sstu_efl_ext_handle, eext_libs->d_eext_config_font_set, "eext_config_font_set");
 
        return true;
 }
 
-/* Returned family name should be free'd manually. */
-char* __get_main_font_family_name_by_alias(char *alias)
+static char* _get_main_font_family(char *alias)
 {
        FcFontSet *set = NULL;
        FcPattern *pat = NULL;
@@ -178,12 +178,12 @@ char* __get_main_font_family_name_by_alias(char *alias)
        FcResult res = 0;
        f_libs font_libs;
 
-       if (!loading_dym_font(&font_libs))
+       if (!_load_font_symbol(&font_libs))
                return NULL;
 
        font_config = font_libs.d_FcInitLoadConfigAndFonts();
        if (font_config == NULL) {
-               DYM_CLOSE_HANDLE(d_font_handle);
+               DYM_CLOSE_HANDLE(sstu_font_handle);
                return ret;
        }
 
@@ -194,7 +194,7 @@ char* __get_main_font_family_name_by_alias(char *alias)
                        font_libs.d_FcConfigDestroy(font_config);
                        font_config = NULL;
                }
-               DYM_CLOSE_HANDLE(d_font_handle);
+               DYM_CLOSE_HANDLE(sstu_font_handle);
                return ret;
        }
 
@@ -226,15 +226,15 @@ char* __get_main_font_family_name_by_alias(char *alias)
                font_libs.d_FcConfigDestroy(font_config);
                font_config = NULL;
        }
-       DYM_CLOSE_HANDLE(d_font_handle);
+       DYM_CLOSE_HANDLE(sstu_font_handle);
        return ret;
 }
 
-API bool __is_supported_image_type_load(char *path)
+API bool sstu_is_valid_image(char *path)
 {
        e_libs efl_libs;
-       if (!loading_dym_efl(&efl_libs)) {
-               SST_SECURE_TRACE("ERROR!! canNOT loading efl!!");
+       if (!_load_efl(&efl_libs)) {
+               SECURE_ERR("ERROR!! canNOT loading efl!!");
                return false;
        }
 
@@ -242,7 +242,7 @@ API bool __is_supported_image_type_load(char *path)
        void *evas;
 
        if (!efl_libs.d_ecore_evas_init()) {
-               close_dym_efl();
+               _close_efl();
                return false;
        }
 
@@ -255,23 +255,23 @@ API bool __is_supported_image_type_load(char *path)
 
        bool result = false;
        if (ret == 0) {
-               SST_SECURE_TRACE("%s - OK", path);
+               SECURE_ERR("%s - OK", path);
                result = true;
        } else {
-               SST_SECURE_TRACE("%s - NO", path);
+               SECURE_ERR("%s - NO", path);
                result = false;
        }
        efl_libs.d_ecore_evas_free(ee);
        efl_libs.d_ecore_evas_shutdown();
-       close_dym_efl();
+       _close_efl();
        return result;
 }
 
-API void font_config_set_notification()
+API void sstu_font_config_set_notification()
 {
 }
 
-API int __is_available_font(char *font_name)
+API int sstu_is_available_font(char *font_name)
 {
        FcObjectSet *os = NULL;
        FcFontSet *fs = NULL;
@@ -280,11 +280,11 @@ API int __is_available_font(char *font_name)
        int ret = 0;
        f_libs font_libs = {0};
 
-       if (!loading_dym_font(&font_libs))
+       if (!_load_font_symbol(&font_libs))
                return -1;
 
        if (font_name == NULL) {
-               DYM_CLOSE_HANDLE(d_font_handle);
+               DYM_CLOSE_HANDLE(sstu_font_handle);
                return -1;
        }
 
@@ -311,7 +311,7 @@ API int __is_available_font(char *font_name)
 
        if (fs) {
                int j;
-               SST_SECURE_TRACE("fs->nfont = %d", fs->nfont);
+               SECURE_ERR("fs->nfont = %d", fs->nfont);
 
                for (j = 0; j < fs->nfont; j++) {
                        FcChar8 *family = NULL;
@@ -353,7 +353,7 @@ API int __is_available_font(char *font_name)
                                        }
 
                                        if (family_result) {
-                                               SST_SECURE_TRACE("-------- FONT - family_result = %s", (char*)family_result);
+                                               SECURE_ERR("-------- FONT - family_result = %s", (char*)family_result);
                                                if (strcmp(family_result, font_name) == 0) {
                                                        ret = 1;
                                                        break;
@@ -367,16 +367,16 @@ API int __is_available_font(char *font_name)
        }
        font_libs.d_FcConfigDestroy(font_config);
        font_config = NULL;
-       DYM_CLOSE_HANDLE(d_font_handle);
+       DYM_CLOSE_HANDLE(sstu_font_handle);
        return ret;
 }
 
-API char* _get_default_font()
+API char* sstu_get_default_font()
 {
-       return __get_main_font_family_name_by_alias(SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS);
+       return _get_main_font_family(SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS);
 }
 
-static int __font_size_get()
+static int _get_font_size()
 {
        int font_size = -1;
 
@@ -407,28 +407,28 @@ static int __font_size_get()
        return font_size;
 }
 
-API bool font_config_set(char *font_name)
+API bool sstu_set_font_config(char *font_name)
 {
        ex_libs eext_libs;
-       if (!loading_dym_efl_eext(&eext_libs))
+       if (!_load_efl_extension(&eext_libs))
                return false;
-       int font_size = __font_size_get();
+       int font_size = _get_font_size();
        bool ret = eext_libs.d_eext_config_font_set(font_name, font_size);
-       DYM_CLOSE_HANDLE(d_efl_eext_handle);
+       DYM_CLOSE_HANDLE(sstu_efl_ext_handle);
        return ret;
 }
 
-API void __font_size_set()
+API void sstu_set_font_size()
 {
        ex_libs eext_libs;
-       if (!loading_dym_efl_eext(&eext_libs))
+       if (!_load_efl_extension(&eext_libs))
                return;
-       int font_size = __font_size_get();
+       int font_size = _get_font_size();
        char *font_name = NULL;
        font_name = vconf_get_str(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME);
 
        eext_libs.d_eext_config_font_set(font_name, font_size);
 
-       DYM_CLOSE_HANDLE(d_efl_eext_handle);
+       DYM_CLOSE_HANDLE(sstu_efl_ext_handle);
        free(font_name);
 }
similarity index 72%
rename from utils/sys_settings_util.h
rename to utils/sstu.h
index ec118ea..c3d02d3 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#pragma once
 
-bool font_config_set(char *font_name);
-int __is_available_font(char *font_name);
-char *_get_default_font();
-bool __is_supported_image_type_load(char *path);
-void __font_size_set();
-void font_config_set_notification();
+bool sstu_set_font_config(char *font_name);
+int sstu_is_available_font(char *font_name);
+char* sstu_get_default_font();
+bool sstu_is_valid_image(char *path);
+void sstu_set_font_size();
+void sstu_font_config_set_notification();
similarity index 100%
rename from utils/sys_settings_font.h
rename to utils/sstu_font.h