#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+#include <time.h>
+#include <dlfcn.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <aul.h>
+#include <regex.h>
#include <dlog.h>
#include <vconf.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
-#include <Ecore_X.h>
-#include <Elementary.h>
+#include <fontconfig/fontconfig.h>
+
+#include <pkgmgr-info.h>
#include <system_settings.h>
#include <system_settings_private.h>
+#include <system_settings_ringtones.h>
+#include <system_settings_json.h>
+
+
+#include <tzplatform_config.h>
+#include <alarm.h>
+
+#ifdef USE_EFL_ASSIST
+#include <efl_assist.h>
+#endif
+
+
+
+#define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
+#define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
+
+#define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
+#define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
+#define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime"
-#define SMALL_FONT_DPI (-80)
-#define MIDDLE_FONT_DPI (-100)
-#define LARGE_FONT_DPI (-150)
-#define HUGE_FONT_DPI (-190)
-#define GIANT_FONT_DPI (-250)
-#define SETTING_FONT_CONF_FILE "/opt/etc/fonts/conf.avail/99-slp.conf"
-#define SETTING_STR_SLP_LEN 256
+#define __FREE(del, arg) do { \
+ if (arg) { \
+ del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
+ arg = NULL; \
+ } \
+ } while (0);
+#define FREE(arg) __FREE(free, arg)
-static char* _get_cur_font();
-static void __font_size_set();
-static int __font_size_get();
+#ifdef SETTING_ARCH_64
+#define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
+#else
+#define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
+#endif
+
+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_font_info(char *str);
+static int dl_is_available_font(char *str);
+static void dl_font_size_set();
+static void dl_font_config_set_notification();
-static void font_config_set(char *font_name);
-static void font_config_set_notification();
/**
* VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
* @return the ringtone file path specified by user in normal case
- * if it's not accessable, return the default ringtone path
+ * if it's not accessable, return the default ringtone path
*/
-int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* vconf_value;
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &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
+ /* 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(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
- //*value = strdup("ERROR");
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ } else { /* not zero on errro */
+ *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
}
- //*value = vconf_value;
+ /**value = vconf_value; */
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* vconf_value;
- if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, &vconf_value)) {
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
+ if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- *value = vconf_value;
+
+ /* 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);
+ }
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* vconf_value;
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
}
-int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* vconf_value;
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
-// [int] vconf GET
-int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+/* [int] vconf GET */
+int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
+ SETTING_TRACE_BEGIN;
int vconf_value;
+ int ** val = (int**)value;
if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- *value = (void*)vconf_value;
+ **val = vconf_value;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-// [int] vconf GET
-int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ char *font_name = dl_get_font_info("default");
+ if (font_name) {
+ *value = (void *)font_name;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+ } else {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+}
+
+/* [int] vconf GET */
+int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* font_name = _get_cur_font();
- *value = (void*)font_name;
+ SETTING_TRACE_BEGIN;
+ char *font_name = dl_get_font_info("cur");
+ *value = (void *)font_name;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
+ SETTING_TRACE_BEGIN;
bool vconf_value;
if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- *value = (void*)vconf_value;
+ *value = (void *)vconf_value;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
+ SETTING_TRACE_BEGIN;
bool vconf_value;
if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- *value = (void*)vconf_value;
+ *value = (void *)vconf_value;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void** value)
+int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
+ SETTING_TRACE_BEGIN;
bool vconf_value;
if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- *value = (void*)vconf_value;
+ *value = (void *)vconf_value;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-////////////////////////////////////////////////////////////////////////////////////////////////////
+/*////////////////////////////////////////////////////////////////////////////////////////////////// */
-int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+
+/**
+ * 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_settings_key_e key, system_setting_data_type_e data_type, void **value)
{
- char* vconf_value;
- vconf_value = (char*)value;
+ SETTING_TRACE_BEGIN;
+ char *pkg_name = NULL;
+ int locktype = -1;
+ system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
- int is_load = _is_file_accessible(vconf_value);
- if (is_load == 0)
- {
- if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- } else {
+ if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
- return SYSTEM_SETTINGS_ERROR_NONE;
-}
-
-
-int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
-{
- char* vconf_value;
- vconf_value = (char*)value;
- if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
+ return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
}
+ *value = pkg_name;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-int _is_file_accessible(const char * path)
+/*////////////////////////////////////////////////////////////////////////////////////////////////// */
+
+int _is_file_accessible(const char *path)
{
- int ret = access(path ,R_OK);
- if (ret == 0)
- {
- SETTING_TRACE("found the file %s", path);
- return 0;
- }
- else
- {
- return errno;
+ SETTING_TRACE_BEGIN;
+ int ret = access(path , R_OK);
+ if (ret == 0) {
+ SETTING_TRACE("found the file %s", path);
+ return 0;
+ } else {
+ /* error code : 13 */
+ SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
+ return -errno;
}
}
-int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
-{
- char* vconf_value;
- vconf_value = (char*)value;
- // error handling here
- if (_is_file_accessible(vconf_value) != 0)
- return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
+/*////////////////////////////////////////////////////////////////////////////////////////////////// */
+// @todo move to CMake
+#define DEF_RINGTONE_FILE_PATH "/opt/share/settings/Ringtones"
+#define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
+#define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
- return SYSTEM_SETTINGS_ERROR_NONE;
+#if 0
+static char* _get_json_file_path()
+{
+ // for testing
+ return JSONFILE;
}
+#endif
-int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
- char* vconf_value;
- vconf_value = (char*)value;
-
- // error handling here
- if (_is_file_accessible(vconf_value) != 0)
- return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ SETTING_TRACE_BEGIN;
+ char* pathval = (char*)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);
+
+ // dirname
+ // basename
+ int ret = SYSTEM_SETTINGS_ERROR_NONE;
+ if (false == ss_json_ringtone_contain(root, pathval)) {
+ SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
+ SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
+ // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
+ ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
+ SETTING_TRACE("pathval is : %s -- OK", pathval);
+ } else {
+ SETTING_TRACE("pathval is duplicated : %s", pathval);
+ SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
+ SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
+ ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ }
- if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ if (parser) {
+ g_object_unref(parser);
+ parser = NULL;
}
- return SYSTEM_SETTINGS_ERROR_NONE;
+ return ret;
}
-int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
SETTING_TRACE_BEGIN;
- int* vconf_value;
- vconf_value = (int*)value;
-
- if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
- return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ char* pathval = (char*)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, 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;
}
- if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- __font_size_set();
- SETTING_TRACE_END;
return SYSTEM_SETTINGS_ERROR_NONE;
}
-/**
- * [internal API]
+
+
+static int _compare_cb(const void *d1, const void *d2)
+{
+ fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
+ fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
+
+ return strcmp(pNode1->media_name, pNode2->media_name);
+}
+
+/*
+ * get the RINGTONE list
*/
-void *font_conf_doc_parse(char *doc_name, char *font_name)
+static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
{
- 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;
-
- Eina_Bool is_changed = EINA_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 = EINA_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 = EINA_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 = EINA_TRUE;
- cur3 = cur3->next;
- break; /* just set first element, so break */
- }
- 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_settings_key_e key, system_setting_data_type_e data_type, void* value)
-{
- char* font_name = NULL;
- font_name = (char*)value;
-
- font_config_set(font_name);
- font_config_set_notification();
-
- char* vconf_value;
- vconf_value = (char*)value;
- if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ SETTING_TRACE_BEGIN;
+ /*Get file list */
+ Eina_List *filelist = NULL;
+ Eina_List *l = NULL;
+ 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) {
+ SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
+ }
+ filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
+
+ EINA_LIST_FOREACH(filelist, l, node)
+ {
+ SETTING_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) {
+ SETTING_TRACE("quit the iteration by return value == false : %d", ret);
+ break;
+ }
+
+ } else {
+ SETTING_TRACE("--> system_setting_data_iterator is NULL");
+ }
}
- 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;
- }
+ l = NULL;
+ node = NULL;
+ EINA_LIST_FOREACH(filelist, l, node)
+ {
+ FREE(node->path);
+ FREE(node->name);
+ FREE(node->media_name);
+ FREE(node);
+ }
+ eina_list_free(filelist);
+ filelist = NULL;
- return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
{
- bool* vconf_value;
- vconf_value = (bool*)value;
- if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ SETTING_TRACE_BEGIN;
+
+#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");
+ SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
+ if (callback) {
+ char* path = strdup(pathval);
+ bool ret = callback(i, (void *)(path), data);
+ if (ret == false) {
+ SETTING_TRACE("quit the iteration by return value == false : %d", ret);
+ break;
+ }
+ } else {
+ SETTING_TRACE("--> callback is NULL");
+ }
}
- return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
{
- bool* vconf_value;
- vconf_value = (bool*)value;
- if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
- }
- return SYSTEM_SETTINGS_ERROR_NONE;
+ SETTING_TRACE_BEGIN;
+ _get_default_ringtones(key, data_type, callback, data);
+ //-----------------------------------------------------------------------------------------------------------------
+ // 2. get the USER ringtone list
+ //-----------------------------------------------------------------------------------------------------------------
+ _get_user_ringtones(key, data_type, callback, data);
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
}
-int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void* value)
+
+/* LCOV_EXCL_START */
+int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
- bool* vconf_value;
- vconf_value = (bool*)value;
- if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
- return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
+ vconf_value = (char *)value;
+
+ int ret = _is_file_accessible(vconf_value);
+ if (ret == 0) {
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ } else {
+ /* @todo add a common ret_handler */
+ return ret;
}
+
return SYSTEM_SETTINGS_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
-/////////////////////////////////////////////////////////////////////////////////////////////////
-//
-int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+/* LCOV_EXCL_START */
+int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
-}
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
+ vconf_value = (char *)value;
-int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
-{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
-}
+ int ret = _is_file_accessible(vconf_value);
+ if (ret == 0) {
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ } else {
+ /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
+ /* @todo add a common ret_handler */
+ return ret;
+ }
-int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
-{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
+ return SYSTEM_SETTINGS_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static bool dl_is_supported_image_type_load(char *path)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_EMAIL_RINGTONE_PATH_STR, 0);
-}
+ 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) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
-int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
-{
- return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
+ image_type_check = dlsym(handle, "__is_supported_image_type_load");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = image_type_check(path);
+ if (handle)
+ dlclose(handle);
+ return ret;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static int dl_is_available_font(char *str)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
-}
+ 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) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
-int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
-{
- return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET,SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
+ check_available_font = dlsym(handle, "__is_available_font");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = check_available_font(str);
+ if (handle)
+ dlclose(handle);
+ return ret;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static void dl_font_size_set()
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
+ void *handle = NULL;
+ char *error;
+ void (*set_font_size)();
+
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return;
+ }
+
+ set_font_size = dlsym(handle, "__font_size_set");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return;
+ }
+ set_font_size();
+ if (handle)
+ dlclose(handle);
+ return;
}
+/* LCOV_EXCL_STOP */
-int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+/* LCOV_EXCL_START */
+static void dl_font_config_set_notification()
{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE,SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
+ void *handle = NULL;
+ char *error;
+ void (*set_font_nodification)();
+
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return;
+ }
+
+ set_font_nodification = dlsym(handle, "font_config_set_notification");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return;
+ }
+ set_font_nodification();
+ if (handle)
+ dlclose(handle);
+ return;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static bool dl_font_config_set(char *font_name)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
+ 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) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
+
+ check_font_type = dlsym(handle, "font_config_set");
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = check_font_type(font_name);
+ if (handle)
+ dlclose(handle);
+ return ret;
}
+/* LCOV_EXCL_STOP */
-int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+/* LCOV_EXCL_START */
+static char *dl_get_font_info(char *str)
{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL,SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
+ void *handle = NULL;
+ char *error;
+ char *ret = NULL;
+ char *(*get_font_info)();
+
+ handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
+ if (!handle) {
+ SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
+ return false;
+ }
+
+ if (strcmp(str, "cur") == 0)
+ get_font_info = dlsym(handle, "_get_cur_font");
+ else
+ get_font_info = dlsym(handle, "_get_default_font");
+
+ if ((error = dlerror()) != NULL) {
+ SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
+ if (handle)
+ dlclose(handle);
+ return false;
+ }
+ ret = get_font_info();
+ if (handle)
+ dlclose(handle);
+ return ret;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
+/* LCOV_EXCL_START */
+#define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
+bool __is_supported_image_type_by_ext(char *file_path)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
-}
+ SETTING_TRACE_BEGIN;
+ regex_t fsm;
+ regmatch_t str[2048 + 1];
-int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+ if (!file_path) return false;
+
+ int ret = false;
+ if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
+ SETTING_TRACE("regular expresstion fail");
+ return 1;
+ }
+
+ /* code */
+ if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
+ /*SETTING_TRACE("FAILED - %s", file_path[i]); */
+ ret = 0;
+ } else {
+ /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
+ ret = 1;
+ }
+ return ret;
+}
+/* LCOV_EXCL_STOP */
+#ifdef TIZEN_WEARABLE
+/* LCOV_EXCL_START */
+static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
{
- return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE,SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1,user_data);
+ 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;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
-}
+ SETTING_TRACE_BEGIN;
+ if (!source_file_path || !dest_file_path) {
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ }
+ char buf[1024];
-/**
- * @todo need to add custom event notification method
- */
-int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
-{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME,SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
+ 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;
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
+/* LCOV_EXCL_START */
+static int system_setting_remove_oldest_extended_wallpaper()
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME,2);
+ 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;
}
+/* LCOV_EXCL_STOP */
-// TODO : 2th argument, callback, is not in use.
-int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+/* LCOV_EXCL_START */
+static int system_setting_check_extended_wallpaper(const char *file_path)
{
- return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data );
+ 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);
}
+/* LCOV_EXCL_STOP */
-int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
+#define WALLPAPER_MAX_COUNT 10
+#endif
+/* LCOV_EXCL_START */
+int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
{
- return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
-}
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
+ vconf_value = (char *)value;
-static char* _get_cur_font()
-{
- xmlDocPtr doc = NULL;
- xmlNodePtr cur = NULL;
- xmlNodePtr cur2 = NULL;
- xmlNodePtr cur3 = NULL;
- xmlChar *key = NULL;
-
- char *font_name = NULL;
-
- doc = xmlParseFile(SETTING_FONT_CONF_FILE);
-
- cur = xmlDocGetRootElement(doc);
-
- if(cur == NULL) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- if(xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
- }
-
- cur = cur->xmlChildrenNode;
-
- while(cur != NULL)
- {
- if((!xmlStrcmp(cur->name, (const xmlChar *)"match")))
- {
- cur2 = cur->xmlChildrenNode;
- while(cur2 != NULL)
- {
- if((!xmlStrcmp(cur2->name, (const xmlChar *)"edit")))
- {
- cur3 = cur2->xmlChildrenNode;
- while(cur3 != NULL)
- {
- if((!xmlStrcmp(cur3->name, (const xmlChar *)"string")))
- {
- key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
-
- font_name = g_strdup((char *)key);
- xmlFree(key);
- key = NULL;
- xmlFreeDoc(doc);
- doc = NULL;
- return font_name;
- }
- cur3 = cur3->next;
- }
- }
- cur2 = cur2->next;
- }
- }
- cur = cur->next;
- }
-
- xmlFreeDoc(doc);
- doc = NULL;
- return NULL;
-}
-
-static void font_config_set_notification()
-{
- /* notification */
- Ecore_X_Window ecore_win = ecore_x_window_root_first_get();
- Ecore_X_Atom atom = ecore_x_atom_get("FONT_TYPE_change");
- ecore_x_window_prop_string_set(ecore_win, atom, "tizen");
-}
-
-static void font_config_set(char *font_name)
-{
- Eina_List *text_classes = NULL;
- Elm_Text_Class *etc = NULL;
- const Eina_List *l = NULL;
- Eina_List *fo_list = NULL;
- Elm_Font_Overlay *efo = NULL;
- int font_size = __font_size_get();
- int size = 0;
-
- text_classes = elm_config_text_classes_list_get();
-
- fo_list = (Eina_List *)elm_config_font_overlay_list_get();
-
- Eina_List *ll = NULL;
- Eina_List *l_next = NULL;
-
- Eina_Bool slp_medium_exist = EINA_FALSE;
- Eina_Bool slp_roman_exist = EINA_FALSE;
- Eina_Bool slp_bold_exist = EINA_FALSE;
- Eina_Bool slp_regular_exist = EINA_FALSE;
-
- // Tizen
- Eina_Bool tizen_exist = EINA_FALSE;
-
- EINA_LIST_FOREACH_SAFE(fo_list, ll, l_next, efo)
- {
- if (!strcmp(efo->text_class, "tizen_medium")) {
- elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
- slp_medium_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_roman")) {
- elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
- slp_roman_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_bold")) {
- elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
- slp_bold_exist = EINA_TRUE;
- } else if (!strcmp(efo->text_class, "tizen_regular")) {
- elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
- slp_regular_exist = EINA_TRUE;
- }
-
- // Tizen
- if (!strcmp(efo->text_class, "tizen")) {
- elm_config_font_overlay_set(efo->text_class, (const char*)font_name, efo->size);
- tizen_exist = EINA_TRUE;
- }
-
- }
-
- /* if slp_XX do not exist, need to set them, font size is -100(100%) */
- if (slp_medium_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_medium", (const char*)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_roman_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_roman", (const char*)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_bold_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_bold", (const char*)font_name, MIDDLE_FONT_DPI);
- }
- if (slp_regular_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen_regular", (const char*)font_name, MIDDLE_FONT_DPI);
- }
-
- // Tizen
- if (tizen_exist == EINA_FALSE) {
- elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
- }
-
- elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
-
- // Tizen
- elm_config_font_overlay_set("tizen", (const char*)font_name, MIDDLE_FONT_DPI);
-
- EINA_LIST_FOREACH(text_classes, l, etc)
- {
- ll = NULL;
-
- size = font_size;
- EINA_LIST_FOREACH(fo_list, ll, efo)
- {
- if (!strcmp(etc->name, efo->text_class)) {
- size = efo->size;
- }
- }
- elm_config_font_overlay_set(etc->name, (const char*)font_name, size);
- }
-
- elm_config_font_overlay_apply();
- elm_config_all_flush();
-// elm_config_engine_set("software_x11");
- elm_config_save();
- elm_config_text_classes_list_free(text_classes);
- text_classes = NULL;
-
- // vconf update
- vconf_set_str(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, font_name);
-}
-
-static void __font_size_set()
-{
- Eina_List *text_classes = NULL;
- Elm_Text_Class *etc = NULL;
- const Eina_List *l = NULL;
- int font_size = __font_size_get();
- char *font_name = _get_cur_font();
-
- if (font_size == -1) {
- return;
- }
-
- text_classes = elm_config_text_classes_list_get();
-
- EINA_LIST_FOREACH(text_classes, l, etc)
- {
- elm_config_font_overlay_set(etc->name, font_name, font_size);
- }
-
- elm_config_font_overlay_apply();
- elm_config_all_flush();
- elm_config_save();
- elm_config_text_classes_list_free(text_classes);
- text_classes = NULL;
- g_free(font_name);
-}
-
-static int __font_size_get()
-{
- int font_size = -1;
- int err = -1;
-
- int vconf_value = -1;
- if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
- return -1;
+ bool isok = dl_is_supported_image_type_load(vconf_value);
+ if (!isok) {
+ /* not supported */
+ SETTING_TRACE("path : %s is not supported file format", vconf_value);
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ } else {
+ SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
}
- switch(vconf_value) {
- case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
- font_size = SMALL_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_NORMAL:
- font_size = MIDDLE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
- font_size = LARGE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
- font_size = HUGE_FONT_DPI;
- break;
- case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
- font_size = GIANT_FONT_DPI;
- break;
- default:
- font_size = MIDDLE_FONT_DPI;
- break;
- }
- return font_size;
-}
+ /* 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(VCONFKEY_BGSET, 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(VCONFKEY_BGSET, 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(VCONFKEY_BGSET, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ }
+#endif
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value;
+ vconf_value = (char *)value;
+
+ bool isok = dl_is_supported_image_type_load(vconf_value);
+ if (!isok) {
+ /* not supported */
+ SETTING_TRACE("path : %s is not supported file format", vconf_value);
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ } else {
+ SETTING_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(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ 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(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ dl_font_size_set();
+ SETTING_TRACE_END;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+/**
+ * [internal API]
+ */
+/* LCOV_EXCL_START */
+void *font_conf_doc_parse(char *doc_name, char *font_name)
+{
+ SETTING_TRACE_BEGIN;
+ 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;
+ }
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *font_name = NULL;
+ font_name = (char *)value;
+
+ /* get current font list */
+ int is_found = dl_is_available_font(font_name);
+
+ if (is_found) {
+ SETTING_TRACE("found font : %s ", font_name);
+ } else {
+ SETTING_TRACE(" NOT found font : %s ", font_name);
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ bool bsave = dl_font_config_set(font_name);
+
+ if (!bsave) {
+ SETTING_TRACE(" font type save error by font_config_set() ");
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ } else {
+ SETTING_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(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+ vconf_value = (bool *)value;
+ if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+ vconf_value = (bool *)value;
+ if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+ vconf_value = (bool *)value;
+ if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+static int category_func(const char *name, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ static char *category = "lock-screen";
+ if (name && !strcmp(name, category)) {
+ SETTING_TRACE(" SAME ");
+ return -1;
+ } else {
+ SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
+ return 0;
+ }
+
+ return 0;
+}
+/* LCOV_EXCL_STOP */
+
+/**
+ *
+ * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
+ *
+ */
+
+/* LCOV_EXCL_START */
+int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ 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) {
+ SETTING_TRACE("*** pkginfo failed ");
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ } else {
+ SETTING_TRACE("%x", 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;
+}
+/* LCOV_EXCL_STOP */
+
+/*/////////////////////////////////////////////////////////////////////////////////////////////// */
+/* */
+
+int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
+}
+
+int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
+}
+
+int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
+}
+
+int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
+}
+
+int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
+}
+
+int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
+}
+
+int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
+}
+
+int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
+}
+
+int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
+}
+
+int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
+}
+
+int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
+}
+
+int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
+}
+
+
+/**
+ * @todo need to add custom event notification method
+ */
+int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
+}
+
+int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
+}
+
+/* TODO : 2th argument, callback, is not in use. */
+int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
+}
+
+/*//////////////////////////////////////////////////////////////////////////////////////// */
+/*--------------------------------------- */
+int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ /* parsing validation */
+ /* en_US.UTF-8 */
+ char arr[20];
+ snprintf(arr, 20, "%s", vconf_value);
+ arr[5] = '\0';
+ *value = strdup(arr);
+ free(vconf_value);
+ vconf_value = NULL;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ char *ext = "UTF-8";
+
+ char arr[20];
+ snprintf(arr, 20, "%s.%s", vconf_value, ext);
+
+ if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
+}
+
+
+/*--------------------------------------- */
+int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ /* parsing validation */
+ /* en_US.UTF-8 */
+ char arr[20];
+ snprintf(arr, 20, "%s", vconf_value);
+ arr[5] = '\0';
+ *value = strdup(arr);
+ free(vconf_value);
+ vconf_value = NULL;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ char *ext = "UTF-8";
+
+ char arr[20];
+ snprintf(arr, 20, "%s.%s", vconf_value, ext);
+
+ if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
+ return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
+}
+
+int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
+}
+
+/*--------------------------------------- */
+/* LCOV_EXCL_START */
+int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ int vconf_value;
+
+ if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &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;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+
+ vconf_value = (bool *)value;
+
+ if (*vconf_value) {
+ if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ } else {
+ if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ }
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
+}
+
+int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ char tzpath[256];
+ ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
+ if (len != -1) {
+ tzpath[len] = '\0';
+ } else {
+ SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ SETTING_TRACE("tzpath : %s ", &tzpath[20]);
+ *value = strdup(&tzpath[20]);
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ 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(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ return SYSTEM_SETTINGS_ERROR_NONE;
+ }
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+}
+/* LCOV_EXCL_STOP */
+
+
+
+/* LCOV_EXCL_START */
+int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
+{
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+}
+/* LCOV_EXCL_STOP */
+
+
+/* LCOV_EXCL_START */
+int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ 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;
+
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
+}
+
+
+
+/* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
+int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ bool vconf_value;
+
+ if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ *value = (void *)vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
+}
+
+/**
+ * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
+ *
+ * a == false, b == false --> silent mode
+ * a == true, b == false --> sound mode
+ * a == false, b == true --> vibration mode
+ */
+/* LCOV_EXCL_START */
+int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ bool sound_cond;
+ bool vib_cond;
+
+ bool vconf_value;
+ if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &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;
+}
+/* LCOV_EXCL_STOP */
+
+/**
+ * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL 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_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+
+ vconf_value = (bool *)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(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 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;
+}
+
+
+
+/* TODO */
+int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
+}
+
+/* TODO */
+int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
+}
+
+/* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
+int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ bool vconf_value;
+
+ int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
+ if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
+ return ret;
+ }
+ *value = (void *)vconf_value;
+ return ret;
+}
+
+int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
+}
+
+int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
+}
+
+#if 0
+/* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
+int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ bool vconf_value;
+
+ if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ *value = (void *)vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+#endif
+
+int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ bool vconf_value;
+
+ if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ *value = (void *)vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ bool *vconf_value;
+ vconf_value = (bool *)value;
+ if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
+}
+
+int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
+}
+
+int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ int vconf_value;
+ int ** val = (int**)value;
+
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ **val = vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+
+/* LCOV_EXCL_START */
+int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ int *vconf_value;
+ vconf_value = *(int **)value;
+
+ if (!(*vconf_value > 0 && *vconf_value <= 600)) {
+ SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
+ return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ SETTING_TRACE_END;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
+}
+
+int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
+}
+
+int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ *value = vconf_value;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ 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(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 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;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
+}
+
+int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ int ** val = (int**)value;
+ int vconf_value;
+
+ if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ **val = vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ int *vconf_value;
+ vconf_value = *(int **)value;
+
+ if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ SETTING_TRACE_END;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, 1, user_data);
+}
+
+int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
+}
+
+int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ *value = vconf_value;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ 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;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
+}
+
+/*---------------------------------------------- */
+int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ bool vconf_value;
+ if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ *value = (void *)vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
+}
+
+int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
+}
+
+int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ int vconf_value;
+ if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &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;
+}
+
+int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
+}
+
+int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
+}
+
+/* LCOV_EXCL_START */
+int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ int vconf_value;
+ int ** val = (int**)value;
+
+ if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ **val = vconf_value;
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ int *vconf_value;
+ vconf_value = *(int **)value;
+
+ if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+ SETTING_TRACE_END;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
+}
+/* LCOV_EXCL_STOP */
+
+/* LCOV_EXCL_START */
+int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
+{
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
+}
+/* LCOV_EXCL_STOP */
+
+//----------------------------------------------------------------------------------------------------------------------------
+
+#define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
+
+int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
+{
+ SETTING_TRACE_BEGIN;
+ 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(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ *value = vconf_value;
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+
+
+#if 0
+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
+/* LCOV_EXCL_START */
+int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
+{
+ SETTING_TRACE_BEGIN;
+ char *vconf_value = NULL;
+ vconf_value = (char *)value;
+
+ if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
+ SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
+ return SYSTEM_SETTINGS_ERROR_IO_ERROR;
+ }
+
+ return SYSTEM_SETTINGS_ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
+
+int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
+}
+
+int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
+{
+ SETTING_TRACE_BEGIN;
+ return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);
+}
+
+