[refactoring] separate big files 02/234202/2
authorYoungjae Shin <yj99.shin@samsung.com>
Fri, 22 May 2020 11:56:13 +0000 (20:56 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Mon, 25 May 2020 01:53:14 +0000 (10:53 +0900)
Change-Id: I548d6fb8cc712374cc699e586705693cf7074670

30 files changed:
common/sst_define.h
src/sst_api.c [new file with mode: 0644]
src/sst_core.c [new file with mode: 0644]
src/sst_core.h [new file with mode: 0644]
src/sst_feature.c [new file with mode: 0644]
src/sst_feature.h [new file with mode: 0644]
src/sst_font.c [new file with mode: 0644]
src/sst_font.h [new file with mode: 0644]
src/sst_interface.c [moved from src/sys_settings.c with 55% similarity]
src/sst_interface.h [new file with mode: 0644]
src/sst_json.c [moved from src/sys_settings_json.c with 94% similarity]
src/sst_json.h [moved from src/sys_settings_json.h with 94% similarity]
src/sst_ringtones.c [new file with mode: 0644]
src/sst_ringtones.h [new file with mode: 0644]
src/sst_screen.c [new file with mode: 0644]
src/sst_screen.h [new file with mode: 0644]
src/sst_time_N_locale.c [new file with mode: 0644]
src/sst_time_N_locale.h [new file with mode: 0644]
src/sst_utils.c [new file with mode: 0644]
src/sst_utils.h [new file with mode: 0644]
src/sst_vconf.c [new file with mode: 0644]
src/sst_vconf.h [new file with mode: 0644]
src/sys_settings.h [deleted file]
src/sys_settings_multi_callback.c [deleted file]
src/sys_settings_multi_callback.h [deleted file]
src/sys_settings_platform.c [deleted file]
src/sys_settings_ringtones.c [deleted file]
src/sys_settings_ringtones.h [deleted file]
src/sys_settings_vconf.c [deleted file]
utils/sys_settings_util.c

index 69699cd..ac6d57b 100644 (file)
@@ -24,7 +24,7 @@
 #define SETTING_DEF_RES "/opt/usr/data/settings"
 #warning "SETTING_DEF_RES is redefined"
 #endif
-#define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones"
+#define DEFAULT_RINGTONE_DIR SETTING_DEF_RES"/Ringtones"
 
 #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"
@@ -34,4 +34,6 @@
 
 #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"
\ No newline at end of file
+#define SETTING_TZONE_SYMLINK_PATH             "/opt/etc/localtime"
+
+#define SETTING_UTILS_SO_FILE_PATH "libsystem-settings-util.so"
diff --git a/src/sst_api.c b/src/sst_api.c
new file mode 100644 (file)
index 0000000..63faf1e
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ * 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 "system_settings.h"
+
+#include "sst.h"
+#include "sst_core.h"
+#include "sst_utils.h"
+#include "sst_vconf.h"
+#include "sst_interface.h"
+
+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 *ptr = &value;
+       int **p_ptr = &ptr;
+       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void*)p_ptr);
+}
+
+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 value_int = 0;
+       int *ptr = &value_int;
+       int **p_ptr = &ptr;
+       int ret = 0;
+       ret = sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void **)p_ptr);
+       *value = value_int;
+       return ret;
+}
+
+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;
+
+       bool *ptr = &value;
+       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void*)ptr);
+}
+
+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;
+
+       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+
+       ret = sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void **)&flag);
+       SST_SECURE_TRACE(" inf (flag) value : %ld ", flag);
+       if (flag == 0) {
+               *value = false;
+               SST_SECURE_TRACE(" flag == 0 ");
+       } else if (flag == 1) {
+               *value = true;
+               SST_SECURE_TRACE(" flag == 1 ");
+       } else {
+               *value = false;
+               SST_SECURE_TRACE(" exception here!!! ");
+       }
+
+       return ret;
+}
+
+
+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;
+
+       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+
+       return sst_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
+}
+
+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;
+
+       return sst_get_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void **)value);
+}
+
+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 = 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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return system_setting_set_changed_cb(system_setting_item, user_data);
+}
+
+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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return system_setting_unset_changed_cb(system_setting_item);
+}
+
+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;
+
+       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;
+
+       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;
+
+       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 = 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);
+               return ret;
+       }
+
+       if (system_setting_item->vconf_key == NULL)
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+
+       ERR("[%s] key = %d %s", __FUNCTION__, key, system_setting_item->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);
+               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;
+       }
+
+       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 = 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);
+               return ret;
+       }
+
+       sst_utils_del_multi_cb(&system_setting_item->changed_cb_list, callback);
+
+       if (system_setting_item->changed_cb_list.list == NULL) {
+               int ret = 0;
+               if (system_setting_item->vconf_key == NULL)
+                       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;
+       }
+
+       ERR("Leave [%s]", __FUNCTION__);
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/sst_core.c b/src/sst_core.c
new file mode 100644 (file)
index 0000000..13ba3d1
--- /dev/null
@@ -0,0 +1,398 @@
+/*
+ * Copyright (c) 2011-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_core.h"
+
+#include <unistd.h>
+#include <app_manager.h>
+#include <package_manager.h>
+#include <vconf.h>
+#include "sst.h"
+#include "sst_utils.h"
+#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)
+{
+       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_get_value_cb     system_setting_getter;
+
+       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);
+               }
+               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);
+               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;
+       }
+
+       return system_setting_getter(system_setting_item, value);
+}
+
+int sst_set_value(system_settings_key_e key, system_setting_data_type_e 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 = 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);
+               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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       }
+
+       return system_setting_setter(system_setting_item, 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)
+{
+       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 = system_settings_get_item(key, &system_setting_item);
+
+       if (ret != 0) {
+               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
+                       ERR("INVALID_PARAMETER(0x%08x) : invalid 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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       }
+
+       return system_setting_lister(key, system_setting_data_iterator, user_data);
+}
+
+////////////////////////////////////////////////////////////////////////////////////
+// list
+////////////////////////////////////////////////////////////////////////////////////
+
+int sst_add_value(system_settings_key_e key, system_setting_data_type_e 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_add_value_cb     system_setting_adder;
+
+       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);
+               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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       }
+
+       return system_setting_adder(key, value);
+}
+
+int sst_del_value(system_settings_key_e key, system_setting_data_type_e 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;
+       }
+
+       /* 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);
+               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);
+               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+       }
+
+       return system_setting_deler(key, value);
+}
+
+/**
+ * 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
+ */
+int system_setting_get_sound_silent_mode(system_setting_h item, void **value)
+{
+       bool sound_cond;
+       bool vib_cond;
+
+       bool vconf_value;
+       if (sst_vconf_get_real_bool(item->vconf_key, &sound_cond))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (sst_vconf_get_real_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond))
+               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;
+       }
+       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
+ */
+int system_setting_set_sound_silent_mode(system_setting_h item, 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))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (vconf_set_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_sound_notification(system_setting_h item, 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);
+                       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);
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_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))
+               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 vconf_value;
+       if (vconf_get_int(item->vconf_key, &vconf_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       bool bret;
+       bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
+
+       *value = (void*)bret;
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+
+#define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
+
+int system_setting_get_ads_id(system_setting_h item, void **value)
+{
+       int optout_value = 0;
+       if (vconf_get_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (optout_value == 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))
+               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)
+{
+       char *vconf_value = value;
+
+       if (vconf_set_str(item->vconf_key, vconf_value)) {
+               SST_SECURE_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_uds_state(system_setting_h item, void **value)
+{
+       int **p_value = (int**)value;
+       int vconf_value;
+       char *vconf_string_value = NULL;
+
+       if (vconf_get_int(item->vconf_key, &vconf_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       SST_SECURE_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
+
+       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 (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;
+                               }
+                       }
+                       free(vconf_string_value);
+               }
+       }
+
+       **p_value = vconf_value;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/sst_core.h b/src/sst_core.h
new file mode 100644 (file)
index 0000000..09e0e98
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2011-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 __TIZEN_SYSTEM_SETTING_PRIVATE_H__
+#define __TIZEN_SYSTEM_SETTING_PRIVATE_H__
+
+#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);
+
+/**
+ * @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);
+/*// */
+
+
+
+#endif /* __TIZEN_SYSTEM_SETTING_PRIVATE_H__ */
diff --git a/src/sst_feature.c b/src/sst_feature.c
new file mode 100644 (file)
index 0000000..76f981e
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * 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_feature.h"
+
+#include <stdlib.h>
+#include <system_info.h>
+#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)
+{
+       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;
+       }
+
+       ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_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);
+               first_query = false;
+       }
+
+       return ret;
+}
+
+int system_setting_feature_check_wearable_profile(void *value)
+{
+       static bool first_query = true;
+       static int ret = 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);
+               if (ret != SYSTEM_INFO_ERROR_NONE) {
+                       SST_SECURE_TRACE("Setting - reading profile string failed, %d", 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);
+
+               first_query = false;
+       }
+
+       return ret;
+}
diff --git a/src/sst_feature.h b/src/sst_feature.h
new file mode 100644 (file)
index 0000000..239bd55
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * 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
+
+/**
+ * @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
diff --git a/src/sst_font.c b/src/sst_font.c
new file mode 100644 (file)
index 0000000..9b3e0c8
--- /dev/null
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2011-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_font.h"
+
+#include <dlfcn.h>
+#include <libxml/tree.h>
+#include <vconf.h>
+#include "sst.h"
+
+static int dl_is_available_font(char *str)
+{
+       void *handle = NULL;
+       char *error;
+       int ret = false;
+       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;
+       }
+
+       check_available_font = dlsym(handle, "__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;
+       }
+       ret = check_available_font(str);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
+
+static void dl_font_size_set()
+{
+       void *handle = NULL;
+       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");
+               return;
+       }
+
+       set_font_size = dlsym(handle, "__font_size_set");
+       if ((error = dlerror()) != NULL) {
+               SST_SECURE_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so");
+               if (handle)
+                       dlclose(handle);
+               return;
+       }
+       set_font_size();
+       if (handle)
+               dlclose(handle);
+       return;
+}
+
+static void dl_font_config_set_notification()
+{
+       void *handle = NULL;
+       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");
+               return;
+       }
+
+       set_font_nodification = dlsym(handle, "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);
+               return;
+       }
+       set_font_nodification();
+       if (handle)
+               dlclose(handle);
+       return;
+}
+
+static bool dl_font_config_set(char *font_name)
+{
+       void *handle = NULL;
+       char *error;
+       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");
+               return false;
+       }
+
+       check_font_type = dlsym(handle, "font_config_set");
+       if ((error = dlerror()) != NULL) {
+               SST_SECURE_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so");
+               if (handle)
+                       dlclose(handle);
+               return false;
+       }
+       ret = check_font_type(font_name);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
+
+static char *dl_get_default_font_info()
+{
+       void *handle = NULL;
+       char *error;
+       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;
+       }
+
+       get_font_info = dlsym(handle, "_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;
+       }
+       ret = get_font_info();
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
+
+int system_setting_set_font_size(system_setting_h item, 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;
+
+       if (vconf_set_int(item->vconf_key, *vconf_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       dl_font_size_set();
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+static void* font_conf_doc_parse(char *doc_name, char *font_name)
+{
+       xmlDocPtr doc = NULL;
+       xmlNodePtr cur = NULL;
+       xmlNodePtr cur2 = NULL;
+       xmlNodePtr cur3 = NULL;
+       xmlChar *key = NULL;
+
+       doc = xmlParseFile(doc_name);
+
+       cur = xmlDocGetRootElement(doc);
+
+       if (cur == NULL) {
+               xmlFreeDoc(doc);
+               doc = NULL;
+               return NULL;
+       }
+
+       if (xmlStrcmp(cur->name, (const xmlChar*)"fontconfig")) {
+               xmlFreeDoc(doc);
+               doc = NULL;
+               return NULL;
+       }
+
+       cur = cur->xmlChildrenNode;
+
+       bool is_changed = false;
+       while (cur != NULL) {
+               if ((!xmlStrcmp(cur->name, (const xmlChar*)"match"))) {
+                       cur2 = cur->xmlChildrenNode;
+                       while (cur2 != NULL) {
+                               if ((!xmlStrcmp(cur2->name, (const xmlChar*)"edit"))) {
+                                       xmlChar *name = xmlGetProp(cur2, (const xmlChar*)"name");
+                                       /* if name is not 'family', break */
+                                       if (xmlStrcmp(name, (const xmlChar*)"family")) {
+                                               xmlFree(name);
+                                               name = NULL;
+                                               break;
+                                       }
+                                       xmlFree(name);
+                                       name = NULL;
+
+                                       cur3 = cur2->xmlChildrenNode;
+                                       while (cur3 != NULL) {
+                                               if ((!xmlStrcmp(cur3->name, (const xmlChar*)"string"))) {
+                                                       xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name);
+                                                       key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
+                                                       xmlFree(key);
+                                                       key = NULL;
+                                                       is_changed = true;
+                                               }
+                                               cur3 = cur3->next;
+                                       }
+                               }
+                               cur2 = cur2->next;
+                       }
+               } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"alias"))) {
+                       cur2 = cur->xmlChildrenNode;
+                       while (cur2 != NULL) {
+                               if ((!xmlStrcmp(cur2->name, (const xmlChar*)"family"))) {
+                                       xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar*)font_name);
+                                       key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
+                                       xmlFree(key);
+                                       key = NULL;
+                                       is_changed = true;
+                               } else if ((!xmlStrcmp(cur2->name, (const xmlChar*)"prefer"))) {
+                                       cur3 = cur2->xmlChildrenNode;
+                                       while (cur3 != NULL) {
+                                               if ((!xmlStrcmp(cur3->name, (const xmlChar*)"family"))) {
+                                                       xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name);
+                                                       key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
+                                                       xmlFree(key);
+                                                       key = NULL;
+                                                       is_changed = true;
+                                                       cur3 = cur3->next;
+                                                       return doc;
+                                               }
+                                               cur3 = cur3->next;
+                                       }
+                               }
+                               cur2 = cur2->next;
+                       }
+               }
+               cur = cur->next;
+       }
+
+       if (is_changed) {
+               return doc;
+       } else {
+               xmlFreeDoc(doc);
+               doc = NULL;
+               return NULL;
+       }
+}
+
+int system_setting_set_font_type(system_setting_h item, 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);
+       } else {
+               SST_SECURE_TRACE(" 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() ");
+               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);
+       if (doc != NULL) {
+               xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
+               xmlFreeDoc(doc);
+               doc = NULL;
+       }
+
+       dl_font_config_set_notification();
+
+       char *vconf_value;
+       vconf_value = (char*)value;
+
+       if (vconf_set_str(item->vconf_key, vconf_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_default_font_type(system_setting_h item, void **value)
+{
+       char *font_name = dl_get_default_font_info();
+       if (font_name) {
+               *value = (void*)font_name;
+               return SYSTEM_SETTINGS_ERROR_NONE;
+       } else {
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+}
diff --git a/src/sst_font.h b/src/sst_font.h
new file mode 100644 (file)
index 0000000..01935ba
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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
+
+#include "sst_core.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);
similarity index 55%
rename from src/sys_settings.c
rename to src/sst_interface.c
index 54da6a2..0a01952 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2020 Samsung Electronics Co., Ltd All Rights Reserved
+ * 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <vconf.h>
+#include "sst_interface.h"
 
+#include <vconf.h>
 #include "sst.h"
-#include "system_settings.h"
-#include "sys_settings.h"
-
-#include <glib.h>
+#include "sst_core.h"
+#include "sst_font.h"
+#include "sst_utils.h"
+#include "sst_vconf.h"
+#include "sst_screen.h"
+#include "sst_feature.h"
+#include "sst_ringtones.h"
+#include "sst_time_N_locale.h"
 
 #define SYSTEM_SETTINGS_MAX -1
-#define GET_SLOT(x) ((x)%4)
 
-system_setting_s system_setting_table[] = {
+struct _system_setting_s system_setting_table[] = {
        {
                SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE,
                VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR,
@@ -177,9 +179,9 @@ system_setting_s system_setting_table[] = {
                { NULL, 0 }, /* changed callabck list */
                NULL,           /* user data */
        },
-//     { /* Deprecated */
-//             -5, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { NULL, 0 }, NULL
-//     },
+       //{ /* Deprecated */
+       //      -5, NULL, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { NULL, 0 }, NULL
+       //},
        {
                SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP,
                VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR,
@@ -650,12 +652,13 @@ 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(system_setting_s) - 1;
+       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);
@@ -670,7 +673,7 @@ static void _dump_context()
 }
 #endif
 
-static int _dump_context_node(int key)
+int sst_dump_context_node(int key)
 {
        int index = 0;
 
@@ -729,7 +732,7 @@ int system_settings_get_item(system_settings_key_e key, system_setting_h *item)
 }
 #else
 
-int binary_search_for_item(system_settings_key_e key)
+static int binary_search_for_item(system_settings_key_e key)
 {
        int start = 0;
        int end = SYSTEM_SETTINGS_KEY_MAX;
@@ -775,510 +778,3 @@ int system_settings_get_item(system_settings_key_e key, system_setting_h *item)
        return SYSTEM_SETTINGS_ERROR_NONE;
 }
 #endif
-
-int system_setting_get_vconf(system_setting_h item, void **value)
-{
-       char *vconf_char;
-       int vconf_int;
-       int **val = (int**)value;
-       bool vconf_bool;
-
-       switch (item->data_type) {
-       case SYSTEM_SETTING_DATA_TYPE_STRING:
-               if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_char))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               *value = vconf_char;
-               break;
-       case SYSTEM_SETTING_DATA_TYPE_INT:
-               if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_int))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               **val = vconf_int;
-               break;
-       case SYSTEM_SETTING_DATA_TYPE_BOOL:
-               if (system_setting_vconf_get_value_bool(item->vconf_key, &vconf_bool))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               *value = (void*)vconf_bool;
-               break;
-       default:
-               ERR("Error system_setting_h struct data_type");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_vconf(system_setting_h item, void *value)
-{
-       char *vconf_char;
-       int vconf_int;
-       bool vconf_bool;
-
-       switch (item->data_type) {
-       case SYSTEM_SETTING_DATA_TYPE_STRING:
-               vconf_char = (char*)value;
-               if (system_setting_vconf_set_value_string(item->vconf_key, vconf_char))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               break;
-       case SYSTEM_SETTING_DATA_TYPE_INT:
-               vconf_int = **(int**)value;
-               if (system_setting_vconf_set_value_int(item->vconf_key, vconf_int))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               break;
-       case SYSTEM_SETTING_DATA_TYPE_BOOL:
-               vconf_bool = *(bool*)value;
-               if (system_setting_vconf_set_value_bool(item->vconf_key, vconf_bool))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               break;
-       default:
-               ERR("Error system_setting_h struct data_type");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-API int system_settings_get_value(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
-{
-       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_get_value_cb     system_setting_getter;
-
-       int ret = system_settings_get_item(key, &system_setting_item);
-       if (ret != 0) {
-               if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) {
-                       _dump_context_node(key);
-                       ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
-               }
-               return ret;
-       }
-
-       if (system_setting_item->data_type != data_type) {
-               _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);
-               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;
-       }
-
-       return system_setting_getter(system_setting_item, value);
-}
-
-API int system_settings_set_value(system_settings_key_e key, system_setting_data_type_e 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 = 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);
-               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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-       }
-
-       return system_setting_setter(system_setting_item, value);
-}
-
-int system_settings_add_value(system_settings_key_e key, system_setting_data_type_e 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_add_value_cb     system_setting_adder;
-
-       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);
-               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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-       }
-
-       return system_setting_adder(key, value);
-}
-
-API int system_settings_del_value(system_settings_key_e key, system_setting_data_type_e 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;
-       }
-
-       /* 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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-       }
-
-       return system_setting_deler(key, value);
-}
-
-API int system_settings_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)
-{
-       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 = 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);
-               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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-       }
-
-       return system_setting_lister(key, system_setting_data_iterator, user_data);
-}
-
-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 *ptr = &value;
-       int **p_ptr = &ptr;
-       return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void*)p_ptr);
-}
-
-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 value_int = 0;
-       int *ptr = &value_int;
-       int **p_ptr = &ptr;
-       int ret = 0;
-       ret = system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void **)p_ptr);
-       *value = value_int;
-       return ret;
-}
-
-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;
-
-       bool *ptr = &value;
-       return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void*)ptr);
-}
-
-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;
-
-       if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key))
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       ret = system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void **)&flag);
-       SST_SECURE_TRACE(" inf (flag) value : %ld ", flag);
-       if (flag == 0) {
-               *value = false;
-               SST_SECURE_TRACE(" flag == 0 ");
-       } else if (flag == 1) {
-               *value = true;
-               SST_SECURE_TRACE(" flag == 1 ");
-       } else {
-               *value = false;
-               SST_SECURE_TRACE(" exception here!!! ");
-       }
-
-       return ret;
-}
-
-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;
-
-       if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
-}
-
-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;
-
-       return system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void **)value);
-}
-
-int system_setting_set_changed_vconf_genernal_callback(system_setting_h item, void *user_data)
-{
-       return system_setting_vconf_set_changed_cb(item->vconf_key, item->key, GET_SLOT(item->key), user_data);
-}
-
-int system_setting_unset_changed_vconf_genernal_callback(system_setting_h item)
-{
-       return system_setting_vconf_unset_changed_cb(item->vconf_key, GET_SLOT(item->key));
-}
-
-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 = 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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return system_setting_set_changed_cb(system_setting_item, user_data);
-}
-
-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);
-               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);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return system_setting_unset_changed_cb(system_setting_item);
-}
-
-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 = 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);
-               return ret;
-       }
-
-       if (system_setting_item->vconf_key == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       ERR("[%s] key = %d %s", __FUNCTION__, key, system_setting_item->vconf_key);
-
-       /* Store the callback function from application side */
-       ret = add_multi_callback(&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);
-               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;
-       }
-
-       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 = 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);
-               return ret;
-       }
-
-       delete_multi_callback(&system_setting_item->changed_cb_list, callback);
-
-       if (system_setting_item->changed_cb_list.list == NULL) {
-               int ret = 0;
-               if (system_setting_item->vconf_key == NULL)
-                       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;
-       }
-
-       ERR("Leave [%s]", __FUNCTION__);
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-// list
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-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;
-
-       return system_settings_list_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, callback, (void*)value);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-// add
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-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;
-
-       return system_settings_add_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////////
-// del
-//////////////////////////////////////////////////////////////////////////////////////////////////
-
-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;
-
-       return system_settings_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value);
-}
diff --git a/src/sst_interface.h b/src/sst_interface.h
new file mode 100644 (file)
index 0000000..4b33aa3
--- /dev/null
@@ -0,0 +1,134 @@
+/*
+ * 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
+
+#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 */
+       SYSTEM_SETTING_DATA_TYPE_BOOL,          /**< boolean */
+#if 0
+       /*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);
+
+typedef int (*system_setting_feature_check_cb)(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_changed_callback_cb)(system_setting_h item, 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 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_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 */
+
+       system_setting_add_value_cb add_value_cb;
+       system_setting_del_value_cb del_value_cb;
+       system_setting_list_value_cb list_value_cb;
+
+       system_setting_feature_check_cb feature_check_cb;
+
+       callback_list changed_cb_list;
+
+       void *user_data;                                                                                                /* 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
similarity index 94%
rename from src/sys_settings_json.c
rename to src/sst_json.c
index 6e60e45..24ccd65 100644 (file)
  */
 #include <vconf.h>
 
-#include "system_settings.h"
-#include "sys_settings.h"
-#include "sys_settings_json.h"
+#include "sst.h"
+#include "sst_core.h"
+#include "sst_json.h"
 
-//#define VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST
-
-/* LCOV_EXCL_START */
 static void ss_json_ringtone_save(JsonNode *root)
 {
        // write here
@@ -37,9 +34,7 @@ static void ss_json_ringtone_save(JsonNode *root)
 #endif
        g_object_unref(generator);
 }
-/* LCOV_EXCL_STOP */
 
-/* LCOV_EXCL_START */
 JsonParser* ss_json_ringtone_open_file(char *path)
 {
        JsonParser *parser;
@@ -59,7 +54,6 @@ JsonParser* ss_json_ringtone_open_file(char *path)
 
        return parser;
 }
-/* LCOV_EXCL_STOP */
 
 JsonParser* ss_json_ringtone_load_from_data()
 {
@@ -160,7 +154,6 @@ bool ss_json_ringtone_contain(JsonNode *root, char *newfile)
        return ret;
 }
 
-/* LCOV_EXCL_START */
 void ss_json_ringtone_list(JsonNode *root)
 {
        int size = json_array_get_length(json_node_get_array(root));
@@ -173,4 +166,3 @@ void ss_json_ringtone_list(JsonNode *root)
                SST_SECURE_TRACE("(%s) --- (%s) \n", name, path);
        }
 }
-/* LCOV_EXCL_STOP */
similarity index 94%
rename from src/sys_settings_json.h
rename to src/sst_json.h
index 5da8d7e..0d913b4 100644 (file)
 
 //#define USE_JSONFILE
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
 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);
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif /* __TIZEN_SYSTEM_SETTING_JSON_H__ */
 
diff --git a/src/sst_ringtones.c b/src/sst_ringtones.c
new file mode 100644 (file)
index 0000000..d6622bc
--- /dev/null
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 2016-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_ringtones.h"
+#include <pthread.h>
+#include <stdio.h>
+#include <libgen.h>
+#include <glib.h>
+#include <vconf.h>
+#include <metadata_extractor.h>
+
+#include "sst.h"
+#include "sst_json.h"
+#include "sst_vconf.h"
+#include "sst_utils.h"
+#include "sst_interface.h"
+
+typedef struct _ugFsNodeInfo {
+       char *path;
+       char *name;
+       char *media_name;
+} fileNodeInfo;
+
+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;
+
+       char path[512] = {0};
+       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 {
+               return strdup(name);
+       }
+}
+
+static int _get_filelist_in_dir(char *path, GList **file_list)
+{
+       DIR *pDir = NULL;
+       struct dirent *ent;
+       static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
+       if (path == NULL) {
+               SST_SECURE_TRACE("dir path is null");
+               return -1;
+       }
+
+       if (file_list == NULL) {
+               SST_SECURE_TRACE("file_list is null");
+               return -1;
+       }
+
+       pDir = opendir(path);
+
+       if (pDir == NULL)
+               return -2;
+
+       pthread_mutex_lock(&mutex);
+       while ((ent = readdir(pDir)) != NULL) {
+               fileNodeInfo *pNode = 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;
+
+               pNode->path = strdup(path);
+               pNode->name = strdup(ent->d_name);
+               pNode->media_name = get_media_basename(
+                               pNode->path, pNode->name);
+
+               *file_list = g_list_append(*file_list, pNode);
+       }
+       pthread_mutex_unlock(&mutex);
+
+       closedir(pDir);
+       return 0;
+}
+
+static gint _ringtone_compare_cb(gconstpointer d1, gconstpointer d2)
+{
+       const fileNodeInfo *pNode1 = d1;
+       const fileNodeInfo *pNode2 = d2;
+
+       return strcmp(pNode1->media_name, pNode2->media_name);
+}
+
+static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
+{
+       /*Get file list */
+       GList *filelist = NULL;
+       GList *iter;
+       fileNodeInfo *node = NULL;
+       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);
+
+       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");
+               }
+       }
+
+       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);
+       }
+       g_list_free(filelist);
+       filelist = NULL;
+}
+
+static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *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");
+               }
+       }
+
+       g_object_unref(parser);
+}
+int system_setting_add_incoming_call_ringtone(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;
+       }
+
+       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));
+       }
+       free(dnameval);
+       free(baseval);
+
+       if (parser) {
+               g_object_unref(parser);
+               parser = NULL;
+       }
+
+       return ret;
+}
+
+int system_setting_del_incoming_call_ringtone(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;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data)
+{
+       _get_default_ringtones(key, callback, data);
+       _get_user_ringtones(key, callback, data);
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_incoming_call_ringtone(system_setting_h item, 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;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_email_alert_ringtone(system_setting_h item, 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;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/**
+ * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
+ * @return the ringtone file path specified by user in normal case
+ *                if it's not accessable, return the default ringtone path
+ */
+int system_setting_get_incoming_call_ringtone(system_setting_h item, void **value)
+{
+       char *vconf_value = NULL;
+       if (sst_vconf_get_string(item->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) {
+               *value = vconf_value;
+       } else { /* not zero on errro */
+               *value = vconf_get_str(item->vconf_key);
+               free(vconf_value);
+       }
+
+       /**value = vconf_value; */
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_email_alert_ringtone(system_setting_h item, void **value)
+{
+       char *vconf_value = NULL;
+       if (sst_vconf_get_string(item->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) {
+               *value = vconf_value;
+       } else { /* not zero on errro */
+               *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
+               free(vconf_value);
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/sst_ringtones.h b/src/sst_ringtones.h
new file mode 100644 (file)
index 0000000..1e3f951
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2011-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 __SYSTEM_SETTINGS_RINGTONES_H__
+#define __SYSTEM_SETTINGS_RINGTONES_H__
+
+#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);
+
+
+#endif /* __SYSTEM_SETTINGS_RINGTONES_H__ */
diff --git a/src/sst_screen.c b/src/sst_screen.c
new file mode 100644 (file)
index 0000000..79ebdfe
--- /dev/null
@@ -0,0 +1,380 @@
+/*
+ * 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_screen.h"
+
+#include <dlfcn.h>
+#include <pkgmgr-info.h>
+#include <vconf.h>
+#include "sst.h"
+#include "sst_vconf.h"
+#include "sst_utils.h"
+
+int system_setting_set_screen_backlight_time(system_setting_h item, void *value)
+{
+       int *vconf_value = *(int **)value;
+
+       if (!(*vconf_value > 0 && *vconf_value <= 600)) {
+               SST_SECURE_TRACE(" ERR Betweeny here  0 ~ 600");
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
+       if (vconf_set_int(item->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)
+{
+       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");
+               return false;
+       }
+
+       image_type_check = dlsym(handle, "__is_supported_image_type_load");
+       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);
+               return false;
+       }
+       ret = image_type_check(path);
+       if (handle)
+               dlclose(handle);
+       return ret;
+}
+
+int system_setting_set_wallpaper_home_screen(system_setting_h item, 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);
+               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;
+}
+
+int system_setting_set_wallpaper_lock_screen(system_setting_h item, 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);
+               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))
+               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;
+       } else {
+               SST_SECURE_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
+               return 0;
+       }
+
+       return 0;
+}
+
+/**
+ *
+ * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
+ *
+ */
+int system_setting_set_lockscreen_app(system_setting_h item, 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 ");
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       } else {
+               SST_SECURE_TRACE("%p", handle);
+       }
+
+       int ret = pkgmgrinfo_appinfo_foreach_category(handle, _category_func, (void*)"lock-screen");
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       /*----------------------------------------------------------------------------------- */
+       int locktype = -1;
+       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
+               return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
+
+       if (vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value))
+               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))
+                       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)
+{
+       char *pkg_name = NULL;
+       int locktype = -1;
+       if (vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (sst_vconf_get_string(item->vconf_key, &pkg_name))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
+               free(pkg_name);
+               return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
+       }
+
+       *value = pkg_name;
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/sst_screen.h b/src/sst_screen.h
new file mode 100644 (file)
index 0000000..7f1fa1f
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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
+
+#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);
+
+/**
+ * @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);
+
diff --git a/src/sst_time_N_locale.c b/src/sst_time_N_locale.c
new file mode 100644 (file)
index 0000000..4d77c26
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2011-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_time_N_locale.h"
+
+#include <stdio.h>
+#include <alarm.h>
+#include <vconf.h>
+#include "sst.h"
+#include "sst_vconf.h"
+#include "sst_utils.h"
+#include "sst_interface.h"
+
+int system_setting_get_locale_country(system_setting_h item, 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;
+               }
+       }
+       *value = strdup(arr);
+       free(vconf_value);
+       vconf_value = NULL;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_locale_country(system_setting_h item, 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;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_locale_language(system_setting_h item, 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;
+               }
+       }
+       *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)
+{
+       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;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **value)
+{
+       int vconf_value;
+
+       if (vconf_get_int(item->vconf_key, &vconf_value))
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+       bool ret_value = true;
+       if (vconf_value == VCONFKEY_TIME_FORMAT_12)
+               ret_value = false;
+       else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
+               ret_value = true;
+
+       *value = (void*)ret_value;
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *value)
+{
+       bool *vconf_value;
+
+       vconf_value = (bool*)value;
+
+       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;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_get_locale_timezone(system_setting_h item, void **value)
+{
+       char tzpath[256];
+       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");
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       SST_SECURE_TRACE("tzpath : %s ", &tzpath[20]);
+       *value = strdup(&tzpath[20]);
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_locale_timezone(system_setting_h item, void *value)
+{
+       char *timezone_value = NULL;
+       timezone_value = (char*)value;
+
+       char tz_path[1024];
+       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
+
+       int is_load = sst_is_valid_file(tz_path);
+       if (is_load == 0) {
+               alarmmgr_set_timezone(tz_path);
+
+               if (vconf_set_str(item->vconf_key, timezone_value))
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+
+               return SYSTEM_SETTINGS_ERROR_NONE;
+       }
+       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;
+}
diff --git a/src/sst_time_N_locale.h b/src/sst_time_N_locale.h
new file mode 100644 (file)
index 0000000..048af75
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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
+
+#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
diff --git a/src/sst_utils.c b/src/sst_utils.c
new file mode 100644 (file)
index 0000000..2f454bf
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * 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_utils.h"
+
+#include <unistd.h>
+#include <errno.h>
+#include <glib.h>
+#include "sst.h"
+
+typedef struct __st_multi_callback_node_ {
+       system_settings_changed_cb callback;
+       void *user_data;
+} callback_node;
+
+static gint _compare_cb(gconstpointer val, gconstpointer s_val)
+{
+       if (NULL == val) return 1;
+       if (NULL == s_val) return 1;
+
+       const callback_node *node = val;
+       if (node->callback == s_val)
+               return 0;
+       return -1;
+}
+
+int sst_utils_add_multi_cb(callback_list *handle, system_settings_changed_cb ptr, void *user_data)
+{
+       RETV_IF(NULL == handle, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ptr, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       GList *found = g_list_find_custom(handle->list, ptr, _compare_cb);
+       if (found)
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+
+       callback_node *node = calloc(1, sizeof(callback_node));
+       if (NULL == node) {
+               ERR("calloc() Fail(%d)", errno);
+               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+       }
+
+       node->callback = ptr;
+       node->user_data = user_data;
+
+       handle->list = g_list_append(handle->list, node);
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int sst_utils_del_multi_cb(callback_list *handle, system_settings_changed_cb ptr)
+{
+       RETV_IF(NULL == handle, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == ptr, 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);
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int sst_utils_invoke_cb_list(callback_list *handle, system_settings_key_e key)
+{
+       RETV_IF(NULL == handle, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER);
+
+       GList *it;
+       for (it = handle->list; it; it = it->next) {
+               callback_node *node = it->data;
+               if (node && node->callback)
+                       node->callback(key, node->user_data);
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int sst_is_valid_file(const char *path)
+{
+       if (0 != access(path, R_OK)) {
+               /* error code : 13 */
+               SST_SECURE_TRACE("Invalid file(%s) : errno(%d)", path, errno);
+               return -errno;
+       }
+       return 0;
+}
diff --git a/src/sst_utils.h b/src/sst_utils.h
new file mode 100644 (file)
index 0000000..0a85014
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * 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
+
+#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);
diff --git a/src/sst_vconf.c b/src/sst_vconf.c
new file mode 100644 (file)
index 0000000..4f02331
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright (c) 2011-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_vconf.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <vconf.h>
+
+#include "sst.h"
+#include "sst_utils.h"
+#include "sst_interface.h"
+
+int sst_vconf_get_real_bool(const char *vconf_key, bool *value)
+{
+       int tempvalue = 0;
+       int ret = vconf_get_bool(vconf_key, &tempvalue);
+
+       if (tempvalue == 1)
+               *value = true;
+       else
+               *value = false;
+
+       return ret;
+}
+
+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;
+       }
+}
+
+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);
+               }
+
+               void *user_data = NULL;
+               user_data = system_setting_item->user_data;
+               system_setting_item->changed_cb(pkey, user_data);
+       }
+}
+
+static void _vconf_event_cb1(keynode_t *node, void *event_data)
+{
+       _vconf_event_cb0(node, event_data);
+}
+
+static void _vconf_event_cb2(keynode_t *node, void *event_data)
+{
+       _vconf_event_cb0(node, event_data);
+}
+
+static void _vconf_event_cb3(keynode_t *node, void *event_data)
+{
+       _vconf_event_cb0(node, event_data);
+}
+
+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)
+{
+       switch (slot) {
+       case SYSTEM_SETTING_CALLBACK_SLOT_0:
+               return _vconf_event_cb0;
+       case SYSTEM_SETTING_CALLBACK_SLOT_1:
+               return _vconf_event_cb1;
+       case SYSTEM_SETTING_CALLBACK_SLOT_2:
+               return _vconf_event_cb2;
+       case SYSTEM_SETTING_CALLBACK_SLOT_3:
+               return _vconf_event_cb3;
+       case SYSTEM_SETTING_CALLBACK_SLOT_4:
+               return _vconf_event_cb4;
+       default:
+               return NULL;
+       }
+}
+
+/**
+ * @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);
+
+       if (vconf_event_cb != NULL)
+               vconf_ignore_key_changed(vconf_key, vconf_event_cb);
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_unset_changed_vconf_genernal_callback(system_setting_h item)
+{
+       return _vconf_unset_changed_cb(item->vconf_key, (item->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;
+       }
+
+       if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key)) {
+               ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error");
+               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)
+{
+       return _vconf_set_changed_cb(item->vconf_key, item->key, (item->key) % 4, user_data);
+}
+
+static void _vconf_event_multi_cb(keynode_t *node, void *event_data)
+{
+       ERR("Enter [%s]", __FUNCTION__);
+       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);
+               }
+
+               sst_utils_invoke_cb_list(&system_setting_item->changed_cb_list, pkey);
+       }
+       ERR("Leave [%s]", __FUNCTION__);
+}
+
+static void _vconf_event_multi_cb_slot_0(keynode_t *node, void *event_data)
+{
+       _vconf_event_multi_cb(node, event_data);
+}
+
+static void _vconf_event_multi_cb_slot_1(keynode_t *node, void *event_data)
+{
+       _vconf_event_multi_cb(node, event_data);
+}
+
+static void _vconf_event_multi_cb_slot_2(keynode_t *node, void *event_data)
+{
+       _vconf_event_multi_cb(node, event_data);
+}
+
+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)
+{
+       int cal = (int)key;
+       int slot = cal % 4;
+
+       switch (slot) {
+       case 0:
+               return _vconf_event_multi_cb_slot_0;
+
+       case 1:
+               return _vconf_event_multi_cb_slot_1;
+
+       case 2:
+               return _vconf_event_multi_cb_slot_2;
+
+       case 3:
+               return _vconf_event_multi_cb_slot_3;
+
+       default:
+               return NULL;
+       }
+}
+
+int system_setting_vconf_set_changed_multi_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)
+               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");
+               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)
+{
+       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)
+               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");
+               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)
+{
+       char *vconf_char;
+       int vconf_int;
+       int **val = (int**)value;
+       bool vconf_bool;
+
+       switch (item->data_type) {
+       case SYSTEM_SETTING_DATA_TYPE_STRING:
+               if (sst_vconf_get_string(item->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))
+                       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))
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               *value = (void*)vconf_bool;
+               break;
+       default:
+               ERR("Error system_setting_h struct data_type");
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_vconf(system_setting_h item, void *value)
+{
+       char *vconf_char;
+       int vconf_int;
+       bool vconf_bool;
+
+       switch (item->data_type) {
+       case SYSTEM_SETTING_DATA_TYPE_STRING:
+               vconf_char = (char*)value;
+               if (vconf_set_str(item->vconf_key, vconf_char))
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               break;
+       case SYSTEM_SETTING_DATA_TYPE_INT:
+               vconf_int = **(int**)value;
+               if (vconf_set_int(item->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))
+                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+               break;
+       default:
+               ERR("Error system_setting_h struct data_type");
+               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+       }
+
+       return SYSTEM_SETTINGS_ERROR_NONE;
+}
diff --git a/src/sst_vconf.h b/src/sst_vconf.h
new file mode 100644 (file)
index 0000000..a1b6afe
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * 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
+
+#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);
+
+
+/**
+ * @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);
diff --git a/src/sys_settings.h b/src/sys_settings.h
deleted file mode 100644 (file)
index cd9bcc8..0000000
+++ /dev/null
@@ -1,782 +0,0 @@
-/*
- * Copyright (c) 2011-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 __TIZEN_SYSTEM_SETTING_PRIVATE_H__
-#define __TIZEN_SYSTEM_SETTING_PRIVATE_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#include "sst.h"
-#include "system_settings.h"
-#include "sys_settings_multi_callback.h"
-
-#ifndef VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST "db/setting/accessibility/high_contrast"
-#endif
-
-#ifndef VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE
-#define VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE "db/setting/accessibility/greyscale"
-#endif
-
-#define SETTING_PROFILE_PATH "tizen.org/feature/profile"
-#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"
-
-/**
- * @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 */
-       SYSTEM_SETTING_DATA_TYPE_BOOL,          /**< boolean */
-#if 0
-       /*SYSTEM_SETTING_DATA_TYPE_FLOAT, */
-       /*SYSTEM_SETTING_DATA_TYPE_DOULBE, */
-#endif
-} system_setting_data_type_e;
-
-/**
- * @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
-} system_setting_callback_slot_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);
-
-typedef int (*system_setting_feature_check_cb)(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_changed_callback_cb)(system_setting_h item, 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);
-
-/**
- * @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
- */
-typedef 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_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 */
-
-       system_setting_add_value_cb add_value_cb;
-       system_setting_del_value_cb del_value_cb;
-       system_setting_list_value_cb list_value_cb;
-
-       system_setting_feature_check_cb feature_check_cb;
-
-       callback_list changed_cb_list;
-
-       void *user_data;                                                                                                /* user_data */
-} system_setting_s;
-
-/**
- * @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);
-
-/* get */
-
-/**
- * @internal
- * @brief get vconf of in type value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key string
- * @param[out] value get the integer type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_vconf_get_value_int(const char *vconf_key, int *value);
-
-/**
- * @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 system_setting_vconf_get_value_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 system_setting_vconf_get_value_string(const char *vconf_key, char **value);
-
-/**
- * @internal
- * @brief set the int type vconf value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key key name
- * @param[in] value int type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_vconf_set_value_int(const char *vconf_key, int value);
-
-/**
- * @internal
- * @brief set the bool type vconf value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key key name
- * @param[in] value bool type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_vconf_set_value_bool(const char *vconf_key, bool value);
-
-/**
- * @internal
- * @brief set the string type vconf value
- * @since_tizen 2.3
- *
- * @param[in] vconf_key key name
- * @param[in] value string type value
- *
- * @return 0 on success, -1 on error
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_vconf_set_value_string(const char *vconf_key, char *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 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
- */
-int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_key_e key, system_setting_callback_slot_e slot, void *user_data);
-
-/**
- * @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
- */
-int system_setting_vconf_unset_changed_cb(const char *vconf_key, system_setting_callback_slot_e slot);
-
-/**
- * @internal
- * @brief Unset the system settings notification callback
- * @since_tizen 4.0
- * @param[in] key system_settings_key_e value to get vconf string
- * @param[out] key_string string pointer to be assigned vconf string
- * @return     0 on success, otherwise a negative error value
- * @retval     #SYSTEM_SETTINGS_ERROR_NONE Successful
- * @retval     #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API
- */
-int system_settings_vconf_get_key_string(system_settings_key_e key, char **key_string);
-
-/**
- * @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);
-
-/**
- * @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
- * @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);
-
-/**
- * @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
- * @retval     #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error
- */
-int system_setting_get_default_font_type(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
- * @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);
-
-/**
- * @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_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
- * @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_set_screen_backlight_time(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);
-
-/**
- * @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);
-
-/**
- * @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);
-
-/**
- * @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);
-
-/*// */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __TIZEN_SYSTEM_SETTING_PRIVATE_H__ */
diff --git a/src/sys_settings_multi_callback.c b/src/sys_settings_multi_callback.c
deleted file mode 100644 (file)
index 9c666dd..0000000
+++ /dev/null
@@ -1,113 +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.
- */
-#include <stdlib.h>
-#include "sys_settings.h"
-
-void clean_node(callback_node *node)
-{
-       if (!node)
-               return;
-
-       node->callback = NULL;
-       node->user_data = NULL;
-}
-
-callback_node* alloc_multi_callback_node()
-{
-       callback_node *node = NULL;
-       node = (callback_node*)malloc(sizeof(callback_node));
-
-       if (node == NULL) {
-               SST_SECURE_TRACE("Not enough node....");
-               return NULL;
-       }
-
-       clean_node(node);
-
-       return node;
-}
-
-void free_multi_callback_node(callback_node *node)
-{
-       if (node)
-               free(node);
-       return;
-}
-
-static gint _compare_cb(gconstpointer val, gconstpointer s_val)
-{
-       if (NULL == val) return 1;
-       if (NULL == s_val) return 1;
-
-       callback_node *node = (callback_node*)val;
-       if (node->callback == s_val)
-               return 0;
-       return -1;
-}
-
-int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr)
-{
-       if (!handle || !ptr)
-               return 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_multi_callback_node((callback_node*)found->data);
-               g_list_free(found);
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void *user_data)
-{
-       if (!handle || !ptr)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       GList *found = g_list_find_custom(handle->list, ptr, _compare_cb);
-       if (found != NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       callback_node *node = alloc_multi_callback_node();
-
-       if (node == NULL)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       node->callback = ptr;
-       node->user_data = user_data;
-
-       /* append the node to list. free_multi_callback_node will free the node */
-       handle->list = g_list_append(handle->list, node);
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int invoke_callback_list(callback_list *handle, system_settings_key_e key)
-{
-       if (!handle)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       GList *itr = handle->list;
-       while (itr != NULL) {
-               callback_node *node = (callback_node*)itr->data;
-               if (node->callback)
-                       node->callback(key, node->user_data);
-               itr = g_list_next(itr);
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
diff --git a/src/sys_settings_multi_callback.h b/src/sys_settings_multi_callback.h
deleted file mode 100644 (file)
index 754b693..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2017 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 __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__
-#define __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__
-
-#include <glib.h>
-#include "system_settings.h"
-
-typedef struct __st_multi_callback_node_ {
-       system_settings_changed_cb callback;
-       void* user_data;
-} callback_node;
-
-typedef struct __st_multi_callback_list_ {
-       GList * list;
-       int is_registered;
-} callback_list;
-
-int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void* user_data);
-int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr);
-int invoke_callback_list(callback_list *handle, system_settings_key_e key);
-
-
-#endif /* __TIZEN_SYSTEM_SETTING_MULTI_CALLBACK_H__ */
diff --git a/src/sys_settings_platform.c b/src/sys_settings_platform.c
deleted file mode 100644 (file)
index 0ca1576..0000000
+++ /dev/null
@@ -1,1515 +0,0 @@
-/*
- * Copyright (c) 2011-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 <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <time.h>
-#include <dlfcn.h>
-
-#include <string.h>
-#include <libgen.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <regex.h>
-
-#include <aul.h>
-#include <vconf.h>
-
-#include <glib.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-
-#include <fontconfig/fontconfig.h>
-
-#include <pkgmgr-info.h>
-#include <package_manager.h>
-#include <app_manager.h>
-#include <tzplatform_config.h>
-#include <alarm.h>
-#include <system_info.h>
-
-#include "system_settings.h"
-#include "sys_settings.h"
-#include "sys_settings_ringtones.h"
-#include "sys_settings_json.h"
-
-#define SETTING_UTILS_SO_FILE_PATH "libsystem-settings-util.so"
-
-int _is_file_accessible(const char *path);
-
-static bool dl_is_supported_image_type_load(char *path);
-static bool dl_font_config_set(char *font_name);
-static char *dl_get_default_font_info();
-static int dl_is_available_font(char *str);
-static void dl_font_size_set();
-static void dl_font_config_set_notification();
-
-/**
- * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
- * @return the ringtone file path specified by user in normal case
- *                if it's not accessable, return the default ringtone path
- */
-int system_setting_get_incoming_call_ringtone(system_setting_h item, void **value)
-{
-       char *vconf_value = NULL;
-       if (system_setting_vconf_get_value_string(item->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 = _is_file_accessible(vconf_value);
-       if (is_load == 0) {
-               *value = vconf_value;
-       } else { /* not zero on errro */
-               *value = vconf_get_str(item->vconf_key);
-               free(vconf_value);
-       }
-
-       /**value = vconf_value; */
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_get_email_alert_ringtone(system_setting_h item, void **value)
-{
-       char *vconf_value = NULL;
-       if (system_setting_vconf_get_value_string(item->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 = _is_file_accessible(vconf_value);
-       if (is_load == 0) {
-               *value = vconf_value;
-       } else { /* not zero on errro */
-               *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
-               free(vconf_value);
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_get_default_font_type(system_setting_h item, void **value)
-{
-       char *font_name = dl_get_default_font_info();
-       if (font_name) {
-               *value = (void*)font_name;
-               return SYSTEM_SETTINGS_ERROR_NONE;
-       } else {
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-}
-
-/*////////////////////////////////////////////////////////////////////////////////////////////////// */
-/**
- * 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)
-{
-       char *pkg_name = NULL;
-       int locktype = -1;
-       if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (system_setting_vconf_get_value_string(item->vconf_key, &pkg_name))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
-               free(pkg_name);
-               return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
-       }
-
-       *value = pkg_name;
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-/*////////////////////////////////////////////////////////////////////////////////////////////////// */
-
-int _is_file_accessible(const char *path)
-{
-       int ret = access(path, R_OK);
-       if (ret == 0) {
-               SST_SECURE_TRACE("found the file  %s", path);
-               return 0;
-       } else {
-               /* error code : 13 */
-               SST_SECURE_TRACE("found the file  %s --- error code : %d ", path, errno);
-               return -errno;
-       }
-}
-
-int system_setting_add_incoming_call_ringtone(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;
-       }
-
-       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));
-       }
-       free(dnameval);
-       free(baseval);
-
-       if (parser) {
-               g_object_unref(parser);
-               parser = NULL;
-       }
-
-       return ret;
-}
-
-int system_setting_del_incoming_call_ringtone(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;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-gint _compare_cb(gconstpointer d1, gconstpointer d2)
-{
-       fileNodeInfo *pNode1 = (fileNodeInfo*)d1;
-       fileNodeInfo *pNode2 = (fileNodeInfo*)d2;
-
-       return strcmp(pNode1->media_name, pNode2->media_name);
-}
-
-/*
- * get the RINGTONE list
- */
-static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
-{
-       /*Get file list */
-       GList *filelist = NULL;
-       GList *iter;
-       fileNodeInfo *node = NULL;
-       int idx = 0;
-
-       //-----------------------------------------------------------------------------------------------------------------
-       // 1. get the default ringtone list
-       //-----------------------------------------------------------------------------------------------------------------
-       int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
-       if (ret != 0)
-               SST_SECURE_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
-
-       filelist = g_list_sort(filelist, _compare_cb);
-
-       for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
-               node = (fileNodeInfo*)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");
-               }
-       }
-
-       for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
-               node = (fileNodeInfo*)iter->data;
-               free(node->path);
-               node->path = NULL;
-               free(node->name);
-               node->name = NULL;
-               free(node->media_name);
-               node->media_name = NULL;
-               free(node);
-       }
-       g_list_free(filelist);
-       filelist = NULL;
-}
-
-static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *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");
-               }
-       }
-
-       g_object_unref(parser);
-}
-
-int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data)
-{
-       _get_default_ringtones(key, callback, data);
-       //-----------------------------------------------------------------------------------------------------------------
-       // 2. get the USER ringtone list
-       //-----------------------------------------------------------------------------------------------------------------
-       _get_user_ringtones(key, callback, data);
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value)
-{
-       char *vconf_value = value;
-
-       int ret = _is_file_accessible(vconf_value);
-       if (ret == 0) {
-               if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               /* @todo add a common ret_handler */
-               return ret;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_email_alert_ringtone(system_setting_h item, void *value)
-{
-       char *vconf_value = value;
-
-       int ret = _is_file_accessible(vconf_value);
-       if (ret == 0) {
-               if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
-               /* @todo add a common ret_handler */
-               return ret;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-static bool dl_is_supported_image_type_load(char *path)
-{
-       void *handle = NULL;
-       char *error;
-       bool ret = false;
-       bool (*image_type_check)(char *path);
-
-       handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
-       if (!handle) {
-               SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so");
-               return false;
-       }
-
-       image_type_check = dlsym(handle, "__is_supported_image_type_load");
-       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);
-               return false;
-       }
-       ret = image_type_check(path);
-       if (handle)
-               dlclose(handle);
-       return ret;
-}
-
-static int dl_is_available_font(char *str)
-{
-       void *handle = NULL;
-       char *error;
-       int ret = false;
-       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;
-       }
-
-       check_available_font = dlsym(handle, "__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;
-       }
-       ret = check_available_font(str);
-       if (handle)
-               dlclose(handle);
-       return ret;
-}
-
-static void dl_font_size_set()
-{
-       void *handle = NULL;
-       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");
-               return;
-       }
-
-       set_font_size = dlsym(handle, "__font_size_set");
-       if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
-               return;
-       }
-       set_font_size();
-       if (handle)
-               dlclose(handle);
-       return;
-}
-
-static void dl_font_config_set_notification()
-{
-       void *handle = NULL;
-       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");
-               return;
-       }
-
-       set_font_nodification = dlsym(handle, "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);
-               return;
-       }
-       set_font_nodification();
-       if (handle)
-               dlclose(handle);
-       return;
-}
-
-static bool dl_font_config_set(char *font_name)
-{
-       void *handle = NULL;
-       char *error;
-       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");
-               return false;
-       }
-
-       check_font_type = dlsym(handle, "font_config_set");
-       if ((error = dlerror()) != NULL) {
-               SST_SECURE_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so");
-               if (handle)
-                       dlclose(handle);
-               return false;
-       }
-       ret = check_font_type(font_name);
-       if (handle)
-               dlclose(handle);
-       return ret;
-}
-
-static char *dl_get_default_font_info()
-{
-       void *handle = NULL;
-       char *error;
-       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;
-       }
-
-       get_font_info = dlsym(handle, "_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;
-       }
-       ret = get_font_info();
-       if (handle)
-               dlclose(handle);
-       return ret;
-}
-
-#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
-int system_setting_set_wallpaper_home_screen(system_setting_h item, 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);
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value);
-       }
-
-       /* error handling here */
-       if (_is_file_accessible(vconf_value) != 0)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-#ifdef TIZEN_MOBILE
-       if (system_setting_vconf_set_value_string(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 (system_setting_vconf_set_value_string(item->vconf_key, file_name_buffer))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-               if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
-                               VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-               }
-       } else {
-               if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-#endif
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_wallpaper_lock_screen(system_setting_h item, 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);
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value);
-       }
-
-       /* error handling here */
-       if (_is_file_accessible(vconf_value) != 0)
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-
-       if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_font_size(system_setting_h item, 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;
-
-       if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       dl_font_size_set();
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-/**
- * [internal API]
- */
-void* font_conf_doc_parse(char *doc_name, char *font_name)
-{
-       xmlDocPtr doc = NULL;
-       xmlNodePtr cur = NULL;
-       xmlNodePtr cur2 = NULL;
-       xmlNodePtr cur3 = NULL;
-       xmlChar *key = NULL;
-
-       doc = xmlParseFile(doc_name);
-
-       cur = xmlDocGetRootElement(doc);
-
-       if (cur == NULL) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       if (xmlStrcmp(cur->name, (const xmlChar*)"fontconfig")) {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-
-       cur = cur->xmlChildrenNode;
-
-       bool is_changed = false;
-       while (cur != NULL) {
-               if ((!xmlStrcmp(cur->name, (const xmlChar*)"match"))) {
-                       cur2 = cur->xmlChildrenNode;
-                       while (cur2 != NULL) {
-                               if ((!xmlStrcmp(cur2->name, (const xmlChar*)"edit"))) {
-                                       xmlChar *name = xmlGetProp(cur2, (const xmlChar*)"name");
-                                       /* if name is not 'family', break */
-                                       if (xmlStrcmp(name, (const xmlChar*)"family")) {
-                                               xmlFree(name);
-                                               name = NULL;
-                                               break;
-                                       }
-                                       xmlFree(name);
-                                       name = NULL;
-
-                                       cur3 = cur2->xmlChildrenNode;
-                                       while (cur3 != NULL) {
-                                               if ((!xmlStrcmp(cur3->name, (const xmlChar*)"string"))) {
-                                                       xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name);
-                                                       key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-                                                       xmlFree(key);
-                                                       key = NULL;
-                                                       is_changed = true;
-                                               }
-                                               cur3 = cur3->next;
-                                       }
-                               }
-                               cur2 = cur2->next;
-                       }
-               } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"alias"))) {
-                       cur2 = cur->xmlChildrenNode;
-                       while (cur2 != NULL) {
-                               if ((!xmlStrcmp(cur2->name, (const xmlChar*)"family"))) {
-                                       xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar*)font_name);
-                                       key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
-                                       xmlFree(key);
-                                       key = NULL;
-                                       is_changed = true;
-                               } else if ((!xmlStrcmp(cur2->name, (const xmlChar*)"prefer"))) {
-                                       cur3 = cur2->xmlChildrenNode;
-                                       while (cur3 != NULL) {
-                                               if ((!xmlStrcmp(cur3->name, (const xmlChar*)"family"))) {
-                                                       xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name);
-                                                       key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-                                                       xmlFree(key);
-                                                       key = NULL;
-                                                       is_changed = true;
-                                                       cur3 = cur3->next;
-                                                       return doc;
-                                               }
-                                               cur3 = cur3->next;
-                                       }
-                               }
-                               cur2 = cur2->next;
-                       }
-               }
-               cur = cur->next;
-       }
-
-       if (is_changed) {
-               return doc;
-       } else {
-               xmlFreeDoc(doc);
-               doc = NULL;
-               return NULL;
-       }
-}
-
-int system_setting_set_font_type(system_setting_h item, 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);
-       } else {
-               SST_SECURE_TRACE(" 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() ");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               SST_SECURE_TRACE(" save OK - font_config_set() ");
-       }
-
-       xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
-       if (doc != NULL) {
-               xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
-               xmlFreeDoc(doc);
-               doc = NULL;
-       }
-
-       dl_font_config_set_notification();
-
-       char *vconf_value;
-       vconf_value = (char*)value;
-
-       if (system_setting_vconf_set_value_string(item->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;
-       } else {
-               SST_SECURE_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
-               return 0;
-       }
-
-       return 0;
-}
-
-/**
- *
- * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
- *
- */
-
-int system_setting_set_lockscreen_app(system_setting_h item, 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 ");
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       } else {
-               SST_SECURE_TRACE("%p", handle);
-       }
-
-       int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void*)"lock-screen");
-       if (ret != PMINFO_R_OK) {
-               pkgmgrinfo_appinfo_destroy_appinfo(handle);
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       }
-
-       pkgmgrinfo_appinfo_destroy_appinfo(handle);
-       /*----------------------------------------------------------------------------------- */
-       int locktype = -1;
-       if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
-               return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
-
-       if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
-               if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-/*/////////////////////////////////////////////////////////////////////////////////////////////// */
-/**
- * @todo need to add custom event notification method
- */
-
-/*//////////////////////////////////////////////////////////////////////////////////////// */
-/*--------------------------------------- */
-int system_setting_get_locale_country(system_setting_h item, void **value)
-{
-       char *vconf_value = NULL;
-       if (system_setting_vconf_get_value_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;
-               }
-       }
-       *value = strdup(arr);
-       free(vconf_value);
-       vconf_value = NULL;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_locale_country(system_setting_h item, 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 (system_setting_vconf_set_value_string(item->vconf_key, arr))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-/*--------------------------------------- */
-int system_setting_get_locale_language(system_setting_h item, void **value)
-{
-       char *vconf_value = NULL;
-       if (system_setting_vconf_get_value_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;
-               }
-       }
-       *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)
-{
-       char *vconf_value = NULL;
-       vconf_value = (char*)value;
-
-       char *ext = "UTF-8";
-
-       char arr[20];
-       snprintf(arr, 20, "%s.%s", vconf_value, ext);
-
-       if (system_setting_vconf_set_value_string(item->vconf_key, arr))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-/*--------------------------------------- */
-int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **value)
-{
-       int vconf_value;
-
-       if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       bool ret_value = true;
-       if (vconf_value == VCONFKEY_TIME_FORMAT_12)
-               ret_value = false;
-       else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
-               ret_value = true;
-
-       *value = (void*)ret_value;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *value)
-{
-       bool *vconf_value;
-
-       vconf_value = (bool*)value;
-
-       if (*vconf_value) {
-               if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_24))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       } else {
-               if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_12))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_get_locale_timezone(system_setting_h item, void **value)
-{
-       char tzpath[256];
-       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");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       SST_SECURE_TRACE("tzpath : %s ", &tzpath[20]);
-       *value = strdup(&tzpath[20]);
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_locale_timezone(system_setting_h item, void *value)
-{
-       char *timezone_value = NULL;
-       timezone_value = (char*)value;
-
-       char tz_path[1024];
-       snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
-
-       int is_load = _is_file_accessible(tz_path);
-       if (is_load == 0) {
-               alarmmgr_set_timezone(tz_path);
-
-               if (system_setting_vconf_set_value_string(item->vconf_key, timezone_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-               return SYSTEM_SETTINGS_ERROR_NONE;
-       }
-       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;
-}
-
-/**
- * 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
- */
-int system_setting_get_sound_silent_mode(system_setting_h item, void **value)
-{
-       bool sound_cond;
-       bool vib_cond;
-
-       bool vconf_value;
-       if (system_setting_vconf_get_value_bool(item->vconf_key, &sound_cond))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond))
-               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;
-       }
-       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
- */
-int system_setting_set_sound_silent_mode(system_setting_h item, 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 (system_setting_vconf_set_value_bool(item->vconf_key, vconf_sound))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_screen_backlight_time(system_setting_h item, void *value)
-{
-       int *vconf_value = *(int **)value;
-
-       if (!(*vconf_value > 0 && *vconf_value <= 600)) {
-               SST_SECURE_TRACE(" ERR Betweeny here  0 ~ 600");
-               return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
-       }
-
-       if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_sound_notification(system_setting_h item, void *value)
-{
-       char *vconf_value = value;
-
-       int is_load = _is_file_accessible(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 (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
-                       //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", 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);
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_set_device_name(system_settings_key_e key, void *value)
-{
-       char *vconf_value = value;
-
-       if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 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 vconf_value;
-       if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       bool bret;
-       bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
-
-       *value = (void*)bret;
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-//----------------------------------------------------------------------------------------------------------------------------
-
-#define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
-
-int system_setting_get_ads_id(system_setting_h item, void **value)
-{
-       int optout_value = 0;
-       if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       if (optout_value == 1) {
-               *value = strdup(DEFAULT_ADS_ID);
-               return SYSTEM_SETTINGS_ERROR_NONE;
-       }
-
-       char *vconf_value = NULL;
-       if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value))
-               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)
-{
-       char *vconf_value = value;
-
-       if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) {
-               SST_SECURE_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_settings_feature_check_bool(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;
-       }
-
-       ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_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);
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_feature_check_wearable_profile(void *value)
-{
-       static bool first_query = true;
-       static int ret = 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);
-               if (ret != SYSTEM_INFO_ERROR_NONE) {
-                       SST_SECURE_TRACE("Setting - reading profile string failed, %d", 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);
-
-               first_query = false;
-       }
-
-       return ret;
-}
-
-int system_setting_get_uds_state(system_setting_h item, void **value)
-{
-       int **p_value = (int**)value;
-       int vconf_value;
-       char *vconf_string_value = NULL;
-
-       if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value))
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-       SST_SECURE_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
-
-       if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
-               if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
-                       return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-
-               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;
-                               }
-                       }
-                       free(vconf_string_value);
-               }
-       }
-
-       **p_value = vconf_value;
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-/*  LCOV_EXCL_STOP */
diff --git a/src/sys_settings_ringtones.c b/src/sys_settings_ringtones.c
deleted file mode 100644 (file)
index a3d78e3..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2016-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 <pthread.h>
-#include <stdio.h>
-
-#include <glib.h>
-
-#include "system_settings.h"
-#include "sys_settings.h"
-#include "sys_settings_ringtones.h"
-#include "sys_settings_json.h"
-
-/* LCOV_EXCL_START */
-/*remove ext name */
-char* get_filename_from_fullname(const char *fullname)
-{
-       //retvm_if(fullname == NULL, NULL, "fullname == NULL");
-       if (fullname == NULL) return NULL;
-
-       char tmp[512];
-       snprintf(tmp, sizeof(tmp), "%s", fullname);
-
-       char *name = strrchr(tmp, '.');
-       if (name != NULL)
-               *name = '\0';
-
-       return strdup((char*)tmp);
-}
-/* LCOV_EXCL_STOP */
-
-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;
-
-       char path[512] = {0};
-       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 {
-               return strdup(name);
-       }
-}
-
-int get_filelist_from_dir_path(char *path, GList **file_list)
-{
-       DIR *pDir = NULL;
-       struct dirent *ent;
-       static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-
-       if (path == NULL) {
-               SST_SECURE_TRACE("dir path is null");
-               return -1;
-       }
-
-       if (file_list == NULL) {
-               SST_SECURE_TRACE("file_list is null");
-               return -1;
-       }
-
-       pDir = opendir(path);
-
-       if (pDir == NULL)
-               return -2;
-
-       pthread_mutex_lock(&mutex);
-       while ((ent = readdir(pDir)) != NULL) {
-               fileNodeInfo *pNode = 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;
-
-               pNode->path = strdup(path);
-               pNode->name = strdup(ent->d_name);
-               pNode->media_name = get_media_basename(
-                       pNode->path, pNode->name);
-
-               *file_list = g_list_append(*file_list, pNode);
-       }
-       pthread_mutex_unlock(&mutex);
-
-       closedir(pDir);
-       return 0;
-}
diff --git a/src/sys_settings_ringtones.h b/src/sys_settings_ringtones.h
deleted file mode 100644 (file)
index 500c2fe..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2011-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 __SYSTEM_SETTINGS_RINGTONES_H__
-#define __SYSTEM_SETTINGS_RINGTONES_H__
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <metadata_extractor.h>
-
-typedef struct _ugFsNodeInfo fileNodeInfo;
-struct _ugFsNodeInfo {
-       char *path;
-       char *name;
-       char *media_name;
-};
-
-int get_filelist_from_dir_path(char *path, GList **file_list);
-char *get_filename_from_fullname(const char *fullname);
-
-#if 0
-void ringtone_play_sound(const char *sound_file, player_h **mp_handle);
-void ringtone_stop_sound(void *data);
-#endif
-
-#endif /* __SYSTEM_SETTINGS_RINGTONES_H__ */
diff --git a/src/sys_settings_vconf.c b/src/sys_settings_vconf.c
deleted file mode 100644 (file)
index 3a6fd05..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2011-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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <vconf.h>
-
-#include "system_settings.h"
-#include "sys_settings.h"
-
-int system_setting_vconf_get_value_int(const char *vconf_key, int *value)
-{
-       return vconf_get_int(vconf_key, value);
-}
-
-int system_setting_vconf_get_value_bool(const char *vconf_key, bool *value)
-{
-       int tempvalue = 0;
-       int ret = vconf_get_bool(vconf_key, &tempvalue);
-
-       if (tempvalue == 1)
-               *value = true;
-       else
-               *value = false;
-
-       return ret;
-}
-
-int system_setting_vconf_get_value_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;
-       }
-}
-
-int system_setting_vconf_set_value_int(const char *vconf_key, int value)
-{
-       return vconf_set_int(vconf_key, value);
-}
-
-int system_setting_vconf_set_value_bool(const char *vconf_key, bool value)
-{
-       return vconf_set_bool(vconf_key, (int)value);
-}
-
-int system_setting_vconf_set_value_string(const char *vconf_key, char *value)
-{
-       return vconf_set_str(vconf_key, value);
-}
-
-/*/////////////////////////////////////////////////////////////////////////////////////////// */
-
-typedef void (*system_setting_vconf_event_cb)(keynode_t *node, void *event_data);
-
-static void system_setting_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);
-               }
-
-               void *user_data = NULL;
-               user_data = system_setting_item->user_data;
-               system_setting_item->changed_cb(pkey, user_data);
-       }
-}
-
-static void system_setting_vconf_event_cb1(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_cb0(node, event_data);
-}
-
-static void system_setting_vconf_event_cb2(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_cb0(node, event_data);
-}
-
-static void system_setting_vconf_event_cb3(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_cb0(node, event_data);
-}
-
-static void system_setting_vconf_event_cb4(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_cb0(node, event_data);
-}
-
-static system_setting_vconf_event_cb system_setting_vconf_get_event_cb_slot(system_setting_callback_slot_e slot)
-{
-       switch (slot) {
-       case SYSTEM_SETTING_CALLBACK_SLOT_0:
-               return system_setting_vconf_event_cb0;
-       case SYSTEM_SETTING_CALLBACK_SLOT_1:
-               return system_setting_vconf_event_cb1;
-       case SYSTEM_SETTING_CALLBACK_SLOT_2:
-               return system_setting_vconf_event_cb2;
-       case SYSTEM_SETTING_CALLBACK_SLOT_3:
-               return system_setting_vconf_event_cb3;
-       case SYSTEM_SETTING_CALLBACK_SLOT_4:
-               return system_setting_vconf_event_cb4;
-       default:
-               return NULL;
-       }
-}
-
-int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_key_e key, system_setting_callback_slot_e slot, void *user_data)
-{
-       system_setting_vconf_event_cb vconf_event_cb;
-
-       vconf_event_cb = system_setting_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;
-       }
-
-       if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key)) {
-               ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-int system_setting_vconf_unset_changed_cb(const char *vconf_key, system_setting_callback_slot_e slot)
-{
-       system_setting_vconf_event_cb vconf_event_cb;
-
-       vconf_event_cb = system_setting_vconf_get_event_cb_slot(slot);
-
-       if (vconf_event_cb != NULL)
-               vconf_ignore_key_changed(vconf_key, vconf_event_cb);
-
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-static void system_setting_vconf_event_multi_cb(keynode_t *node, void *event_data)
-{
-       ERR("Enter [%s]", __FUNCTION__);
-       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);
-               }
-
-               invoke_callback_list(&system_setting_item->changed_cb_list, pkey);
-       }
-       ERR("Leave [%s]", __FUNCTION__);
-}
-
-static void system_setting_vconf_event_multi_cb_slot_0(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_multi_cb(node, event_data);
-}
-
-static void system_setting_vconf_event_multi_cb_slot_1(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_multi_cb(node, event_data);
-}
-
-static void system_setting_vconf_event_multi_cb_slot_2(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_multi_cb(node, event_data);
-}
-
-static void system_setting_vconf_event_multi_cb_slot_3(keynode_t *node, void *event_data)
-{
-       system_setting_vconf_event_multi_cb(node, event_data);
-}
-
-static system_setting_vconf_event_cb system_setting_vconf_get_event_multi_cb_slot(system_settings_key_e key)
-{
-       int cal = (int)key;
-       int slot = cal % 4;
-
-       switch (slot) {
-       case 0:
-               return system_setting_vconf_event_multi_cb_slot_0;
-
-       case 1:
-               return system_setting_vconf_event_multi_cb_slot_1;
-
-       case 2:
-               return system_setting_vconf_event_multi_cb_slot_2;
-
-       case 3:
-               return system_setting_vconf_event_multi_cb_slot_3;
-
-       default:
-               return NULL;
-       }
-}
-
-int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key)
-{
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_vconf_event_cb vconf_event_cb;
-
-       vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key);
-
-       if (vconf_event_cb == NULL)
-               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");
-               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)
-{
-       ERR("Enter [%s]", __FUNCTION__);
-       system_setting_vconf_event_cb vconf_event_cb;
-
-       vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key);
-
-       if (vconf_event_cb == NULL)
-               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");
-               return SYSTEM_SETTINGS_ERROR_IO_ERROR;
-       }
-
-       ERR("Leave [%s]", __FUNCTION__);
-       return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
index e8dbadc..2048a01 100644 (file)
@@ -16,7 +16,8 @@
 #include <tzplatform_config.h>
 
 #include "system_settings.h"
-#include "sys_settings.h"
+#include "sst.h"
+#include "sst_core.h"
 #include "sys_settings_util.h"
 #include "sys_settings_font.h"
 
@@ -39,8 +40,6 @@
 #define SETTING_FONT_PRELOAD_FONT_PATH _TZ_SYS_RO_SHARE"/fonts"
 #define SETTING_FONT_DOWNLOADED_FONT_PATH _TZ_SYS_SHARE"/fonts"
 
-#define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
-
 #define SETTING_FONT_TIZEN_FONT_ALIAS "Tizen"
 #define SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS "TizenDefaultFont"
 
@@ -49,8 +48,6 @@
 #define SETTING_EFL_EXTENSION_SO_PATH "libefl-extension.so.0"
 #define SETTING_EVAS_SO_PATH "libevas.so.1"
 
-static int __font_size_get();
-
 void *d_font_handle = NULL;
 void *d_ecore_evas_handle = NULL;
 void *d_evas_handle = NULL;
@@ -325,7 +322,7 @@ API int __is_available_font(char *font_name)
                                int download_path_len = strlen(SETTING_FONT_DOWNLOADED_FONT_PATH);
 
                                if (file && (!strncmp((const char*)file, SETTING_FONT_PRELOAD_FONT_PATH, preload_path_len)
-                                       || !strncmp((const char*)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) {
+                                                       || !strncmp((const char*)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) {
                                        char *family_result = NULL;
                                        FcChar8 *lang = NULL;
                                        int id = 0;
@@ -379,32 +376,6 @@ API char* _get_default_font()
        return __get_main_font_family_name_by_alias(SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS);
 }
 
-API bool font_config_set(char *font_name)
-{
-       ex_libs eext_libs;
-       if (!loading_dym_efl_eext(&eext_libs))
-               return false;
-       int font_size = __font_size_get();
-       bool ret = eext_libs.d_eext_config_font_set(font_name, font_size);
-       DYM_CLOSE_HANDLE(d_efl_eext_handle);
-       return ret;
-}
-
-API void __font_size_set()
-{
-       ex_libs eext_libs;
-       if (!loading_dym_efl_eext(&eext_libs))
-               return;
-       int font_size = __font_size_get();
-       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);
-       free(font_name);
-}
-
 static int __font_size_get()
 {
        int font_size = -1;
@@ -435,4 +406,29 @@ static int __font_size_get()
        }
        return font_size;
 }
-/*  LCOV_EXCL_STOP */
+
+API bool font_config_set(char *font_name)
+{
+       ex_libs eext_libs;
+       if (!loading_dym_efl_eext(&eext_libs))
+               return false;
+       int font_size = __font_size_get();
+       bool ret = eext_libs.d_eext_config_font_set(font_name, font_size);
+       DYM_CLOSE_HANDLE(d_efl_eext_handle);
+       return ret;
+}
+
+API void __font_size_set()
+{
+       ex_libs eext_libs;
+       if (!loading_dym_efl_eext(&eext_libs))
+               return;
+       int font_size = __font_size_get();
+       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);
+       free(font_name);
+}