2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
25 #include <sys/types.h>
36 #include <libxml/xmlmemory.h>
37 #include <libxml/parser.h>
39 #include <fontconfig/fontconfig.h>
41 #include <pkgmgr-info.h>
43 #include <system_settings.h>
44 #include <system_settings_private.h>
45 #include <system_settings_ringtones.h>
46 #include <system_settings_json.h>
49 #include <tzplatform_config.h>
54 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
55 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
57 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
58 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
59 #define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime"
62 #define __FREE(del, arg) do { \
64 del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
68 #define FREE(arg) __FREE(free, arg)
70 #ifdef SETTING_ARCH_64
71 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
73 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
76 int _is_file_accessible(const char *path);
78 static bool dl_is_supported_image_type_load(char *path);
79 static bool dl_font_config_set(char *font_name);
80 static char *dl_get_font_info(char *str);
81 static int dl_is_available_font(char *str);
82 static void dl_font_size_set();
83 static void dl_font_config_set_notification();
87 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
88 * @return the ringtone file path specified by user in normal case
89 * if it's not accessable, return the default ringtone path
91 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
95 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
96 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
99 /* check to see if it's accessable -> OK */
100 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
101 int is_load = _is_file_accessible(vconf_value);
103 *value = vconf_value;
104 } else { /* not zero on errro */
105 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
108 /**value = vconf_value; */
109 return SYSTEM_SETTINGS_ERROR_NONE;
113 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
117 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
118 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
121 /* check to see if it's accessable -> OK */
122 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
123 int is_load = _is_file_accessible(vconf_value);
125 *value = vconf_value;
126 } else { /* not zero on errro */
127 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
130 return SYSTEM_SETTINGS_ERROR_NONE;
134 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
138 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
139 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
141 *value = vconf_value;
142 return SYSTEM_SETTINGS_ERROR_NONE;
146 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
151 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
152 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
154 *value = vconf_value;
156 return SYSTEM_SETTINGS_ERROR_NONE;
160 /* [int] vconf GET */
161 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
165 int ** val = (int**)value;
167 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
168 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
172 return SYSTEM_SETTINGS_ERROR_NONE;
176 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
179 char *font_name = dl_get_font_info("default");
181 *value = (void *)font_name;
182 return SYSTEM_SETTINGS_ERROR_NONE;
184 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
188 /* [int] vconf GET */
189 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
192 char *font_name = dl_get_font_info("cur");
193 *value = (void *)font_name;
195 return SYSTEM_SETTINGS_ERROR_NONE;
199 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
204 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
205 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
207 *value = (void *)vconf_value;
209 return SYSTEM_SETTINGS_ERROR_NONE;
212 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
217 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
218 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
220 *value = (void *)vconf_value;
222 return SYSTEM_SETTINGS_ERROR_NONE;
225 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
230 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
231 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
233 *value = (void *)vconf_value;
235 return SYSTEM_SETTINGS_ERROR_NONE;
237 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
241 * get current lock scren app package name (string)
243 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
245 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
248 char *pkg_name = NULL;
250 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
252 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
253 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
256 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
257 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
261 return SYSTEM_SETTINGS_ERROR_NONE;
265 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
267 int _is_file_accessible(const char *path)
270 int ret = access(path , R_OK);
272 SETTING_TRACE("found the file %s", path);
275 /* error code : 13 */
276 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
283 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
284 // @todo move to CMake
285 #define DEF_RINGTONE_FILE_PATH "/opt/share/settings/Ringtones"
286 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
287 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
290 static char* _get_json_file_path()
297 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
300 char* pathval = (char*)value;
304 JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
306 JsonParser *parser = ss_json_ringtone_load_from_data();
309 JsonNode *root = json_parser_get_root(parser);
313 int ret = SYSTEM_SETTINGS_ERROR_NONE;
314 if (false == ss_json_ringtone_contain(root, pathval)) {
315 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
316 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
317 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
318 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
319 SETTING_TRACE("pathval is : %s -- OK", pathval);
321 SETTING_TRACE("pathval is duplicated : %s", pathval);
322 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
323 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
324 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
328 g_object_unref(parser);
335 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
338 char* pathval = (char*)value;
341 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
343 JsonParser* parser = ss_json_ringtone_load_from_data();
345 JsonNode *root = json_parser_get_root(parser);
347 ss_json_ringtone_remove(root, JSONFILE, pathval);
348 //void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
350 ss_json_ringtone_print(root);
352 g_object_unref(parser);
356 return SYSTEM_SETTINGS_ERROR_NONE;
360 static int _compare_cb(const void *d1, const void *d2)
362 fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
363 fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
365 return strcmp(pNode1->media_name, pNode2->media_name);
369 * get the RINGTONE list
371 static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
375 Eina_List *filelist = NULL;
377 fileNodeInfo *node = NULL;
380 //-----------------------------------------------------------------------------------------------------------------
381 // 1. get the default ringtone list
382 //-----------------------------------------------------------------------------------------------------------------
383 int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
385 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
387 filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
389 EINA_LIST_FOREACH(filelist, l, node)
391 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
392 // @todo assert NULL check
395 snprintf(temp, 1024, "%s/%s", node->path, node->name);
396 char* path = strdup(temp);
397 bool ret = callback(idx, (void *)(path), data);
403 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
408 SETTING_TRACE("--> system_setting_data_iterator is NULL");
414 EINA_LIST_FOREACH(filelist, l, node)
418 FREE(node->media_name);
421 eina_list_free(filelist);
426 static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
432 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
434 JsonParser* parser = ss_json_ringtone_load_from_data();
437 JsonNode *root = json_parser_get_root(parser);
438 int size = json_array_get_length(json_node_get_array(root));
441 for (i = 0; i < size ; i++) {
442 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
443 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
444 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
445 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
447 char* path = strdup(pathval);
448 bool ret = callback(i, (void *)(path), data);
450 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
454 SETTING_TRACE("--> callback is NULL");
459 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)
463 _get_default_ringtones(key, data_type, callback, data);
464 //-----------------------------------------------------------------------------------------------------------------
465 // 2. get the USER ringtone list
466 //-----------------------------------------------------------------------------------------------------------------
467 _get_user_ringtones(key, data_type, callback, data);
469 return SYSTEM_SETTINGS_ERROR_NONE;
473 /* LCOV_EXCL_START */
474 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
478 vconf_value = (char *)value;
480 int ret = _is_file_accessible(vconf_value);
482 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
483 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
486 /* @todo add a common ret_handler */
490 return SYSTEM_SETTINGS_ERROR_NONE;
495 /* LCOV_EXCL_START */
496 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
500 vconf_value = (char *)value;
502 int ret = _is_file_accessible(vconf_value);
504 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
505 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
508 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
509 /* @todo add a common ret_handler */
513 return SYSTEM_SETTINGS_ERROR_NONE;
517 /* LCOV_EXCL_START */
518 static bool dl_is_supported_image_type_load(char *path)
523 bool (*image_type_check)(char *path);
525 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
527 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
531 image_type_check = dlsym(handle, "__is_supported_image_type_load");
532 if ((error = dlerror()) != NULL) {
533 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
538 ret = image_type_check(path);
545 /* LCOV_EXCL_START */
546 static int dl_is_available_font(char *str)
551 int (*check_available_font)(char *font_name);
553 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
555 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
559 check_available_font = dlsym(handle, "__is_available_font");
560 if ((error = dlerror()) != NULL) {
561 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
566 ret = check_available_font(str);
573 /* LCOV_EXCL_START */
574 static void dl_font_size_set()
578 void (*set_font_size)();
580 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
582 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
586 set_font_size = dlsym(handle, "__font_size_set");
587 if ((error = dlerror()) != NULL) {
588 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
600 /* LCOV_EXCL_START */
601 static void dl_font_config_set_notification()
605 void (*set_font_nodification)();
607 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
609 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
613 set_font_nodification = dlsym(handle, "font_config_set_notification");
614 if ((error = dlerror()) != NULL) {
615 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
620 set_font_nodification();
627 /* LCOV_EXCL_START */
628 static bool dl_font_config_set(char *font_name)
633 bool (*check_font_type)(char *font_name);
635 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
637 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
641 check_font_type = dlsym(handle, "font_config_set");
642 if ((error = dlerror()) != NULL) {
643 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
648 ret = check_font_type(font_name);
655 /* LCOV_EXCL_START */
656 static char *dl_get_font_info(char *str)
661 char *(*get_font_info)();
663 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
665 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
669 if (strcmp(str, "cur") == 0)
670 get_font_info = dlsym(handle, "_get_cur_font");
672 get_font_info = dlsym(handle, "_get_default_font");
674 if ((error = dlerror()) != NULL) {
675 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
680 ret = get_font_info();
687 /* LCOV_EXCL_START */
688 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
689 bool __is_supported_image_type_by_ext(char *file_path)
693 regmatch_t str[2048 + 1];
695 if (!file_path) return false;
698 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
699 SETTING_TRACE("regular expresstion fail");
704 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
705 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
708 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
714 #ifdef TIZEN_WEARABLE
715 /* LCOV_EXCL_START */
716 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
720 const char *find_str = "extended_wallpaper_";
723 if (!(ch = strstr(file_path, find_str))) {
724 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
726 strncpy(buffer, file_path, ch - file_path);
727 buffer[ch - file_path] = 0;
728 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
730 if (!isdigit(buffer[0])) {
731 SETTING_TRACE("%s is not number", buffer);
732 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
737 return SYSTEM_SETTINGS_ERROR_NONE;
741 /* LCOV_EXCL_START */
742 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
745 if (!source_file_path || !dest_file_path) {
746 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
752 fd = open(source_file_path, O_RDONLY);
754 SETTING_TRACE("file open failed: %s", source_file_path);
755 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
759 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
761 SETTING_TRACE("file creation failed: %s", dest_file_path);
763 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
766 while (read(fd, buf, sizeof(buf) - 1) > 0) {
767 write(fd2, buf, sizeof(buf) - 1);
773 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
774 SETTING_TRACE("chmod failed: %s", dest_file_path);
777 return SYSTEM_SETTINGS_ERROR_NONE;
781 /* LCOV_EXCL_START */
782 static int system_setting_remove_oldest_extended_wallpaper()
787 char *min_image_name = NULL;
788 unsigned int min_image_num = 0;
789 unsigned int temp_image_num = 0;
792 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
793 SETTING_TRACE("opendir error");
794 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
797 while ((dirp = readdir(dp))) {
798 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
801 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
802 != SYSTEM_SETTINGS_ERROR_NONE) {
803 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
806 if ((image_count == 0) || (min_image_num > temp_image_num)) {
807 min_image_num = temp_image_num;
808 min_image_name = dirp->d_name;
815 if (min_image_name) {
816 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
817 if (remove(buf) < 0) { /* remove oldest image */
818 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
822 return SYSTEM_SETTINGS_ERROR_NONE;
826 /* LCOV_EXCL_START */
827 static int system_setting_check_extended_wallpaper(const char *file_path)
831 if (!file_path || !strlen(file_path))
833 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
834 return (strstr(file_path, buffer) != NULL);
838 #define WALLPAPER_MAX_COUNT 10
840 /* LCOV_EXCL_START */
841 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
845 vconf_value = (char *)value;
847 bool isok = dl_is_supported_image_type_load(vconf_value);
850 SETTING_TRACE("path : %s is not supported file format", vconf_value);
851 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
853 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
856 /* error handling here */
857 if (_is_file_accessible(vconf_value) != 0)
858 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
860 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
861 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
865 #ifdef TIZEN_WEARABLE
866 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
869 unsigned int max_image_num = 0;
870 unsigned int temp_image_num = 0;
873 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
874 SETTING_TRACE("Setting - dir open error!");
875 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
878 /* Check a max number of wallpapers */
879 while ((dirp = readdir(dp))) {
880 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
883 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
884 != SYSTEM_SETTINGS_ERROR_NONE) {
887 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
890 if ((image_count == 0) || (max_image_num < temp_image_num)) {
891 max_image_num = temp_image_num;
899 /* Numbering rule: Gear is odd number */
900 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
903 char file_name_buffer[512];
904 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
905 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
907 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
908 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
909 != SYSTEM_SETTINGS_ERROR_NONE) {
910 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
913 /* remove oldest wallpaper */
914 if (image_count >= WALLPAPER_MAX_COUNT) {
915 if (system_setting_remove_oldest_extended_wallpaper()
916 != SYSTEM_SETTINGS_ERROR_NONE) {
917 remove(file_name_buffer);
918 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
922 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
923 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
926 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
927 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
928 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
931 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
932 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
937 return SYSTEM_SETTINGS_ERROR_NONE;
941 /* LCOV_EXCL_START */
942 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
946 vconf_value = (char *)value;
948 bool isok = dl_is_supported_image_type_load(vconf_value);
951 SETTING_TRACE("path : %s is not supported file format", vconf_value);
952 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
954 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
957 /* error handling here */
958 if (_is_file_accessible(vconf_value) != 0)
959 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
961 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
962 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
965 return SYSTEM_SETTINGS_ERROR_NONE;
969 /* LCOV_EXCL_START */
970 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
974 vconf_value = *(int **)value;
976 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
977 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
980 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
981 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
985 return SYSTEM_SETTINGS_ERROR_NONE;
991 /* LCOV_EXCL_START */
992 void *font_conf_doc_parse(char *doc_name, char *font_name)
995 xmlDocPtr doc = NULL;
996 xmlNodePtr cur = NULL;
997 xmlNodePtr cur2 = NULL;
998 xmlNodePtr cur3 = NULL;
1001 doc = xmlParseFile(doc_name);
1003 cur = xmlDocGetRootElement(doc);
1011 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1017 cur = cur->xmlChildrenNode;
1019 bool is_changed = false;
1020 while (cur != NULL) {
1021 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1022 cur2 = cur->xmlChildrenNode;
1023 while (cur2 != NULL) {
1024 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1025 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1026 /* if name is not 'family', break */
1027 if (xmlStrcmp(name, (const xmlChar *)"family")) {
1035 cur3 = cur2->xmlChildrenNode;
1036 while (cur3 != NULL) {
1037 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1038 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1039 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1049 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1050 cur2 = cur->xmlChildrenNode;
1051 while (cur2 != NULL) {
1052 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1053 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1054 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1058 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1059 cur3 = cur2->xmlChildrenNode;
1060 while (cur3 != NULL) {
1061 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1062 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1063 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1087 /* LCOV_EXCL_STOP */
1089 /* LCOV_EXCL_START */
1090 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1092 SETTING_TRACE_BEGIN;
1093 char *font_name = NULL;
1094 font_name = (char *)value;
1096 /* get current font list */
1097 int is_found = dl_is_available_font(font_name);
1100 SETTING_TRACE("found font : %s ", font_name);
1102 SETTING_TRACE(" NOT found font : %s ", font_name);
1103 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1106 bool bsave = dl_font_config_set(font_name);
1109 SETTING_TRACE(" font type save error by font_config_set() ");
1110 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1112 SETTING_TRACE(" save OK - font_config_set() ");
1115 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1117 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1122 dl_font_config_set_notification();
1125 vconf_value = (char *)value;
1127 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1128 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1130 return SYSTEM_SETTINGS_ERROR_NONE;
1132 /* LCOV_EXCL_STOP */
1134 /* LCOV_EXCL_START */
1135 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1137 SETTING_TRACE_BEGIN;
1139 vconf_value = (bool *)value;
1140 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1141 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1143 return SYSTEM_SETTINGS_ERROR_NONE;
1145 /* LCOV_EXCL_STOP */
1147 /* LCOV_EXCL_START */
1148 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1150 SETTING_TRACE_BEGIN;
1152 vconf_value = (bool *)value;
1153 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1154 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1156 return SYSTEM_SETTINGS_ERROR_NONE;
1159 /* LCOV_EXCL_STOP */
1161 /* LCOV_EXCL_START */
1162 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1164 SETTING_TRACE_BEGIN;
1166 vconf_value = (bool *)value;
1167 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1168 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1171 return SYSTEM_SETTINGS_ERROR_NONE;
1173 /* LCOV_EXCL_STOP */
1175 /* LCOV_EXCL_START */
1176 static int category_func(const char *name, void *user_data)
1178 SETTING_TRACE_BEGIN;
1179 static char *category = "lock-screen";
1180 if (name && !strcmp(name, category)) {
1181 SETTING_TRACE(" SAME ");
1184 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1190 /* LCOV_EXCL_STOP */
1194 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1198 /* LCOV_EXCL_START */
1199 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1201 SETTING_TRACE_BEGIN;
1203 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
1206 pkgmgrinfo_appinfo_h handle;
1207 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1208 if (r != PMINFO_R_OK) {
1209 SETTING_TRACE("*** pkginfo failed ");
1210 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1212 SETTING_TRACE("%x", handle);
1215 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1216 if (ret != PMINFO_R_OK) {
1217 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1218 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1221 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1222 /*----------------------------------------------------------------------------------- */
1224 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1225 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1228 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1229 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1231 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1232 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1235 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1236 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1237 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1240 return SYSTEM_SETTINGS_ERROR_NONE;
1242 /* LCOV_EXCL_STOP */
1244 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1247 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1249 SETTING_TRACE_BEGIN;
1250 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1253 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1255 SETTING_TRACE_BEGIN;
1256 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1259 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1261 SETTING_TRACE_BEGIN;
1262 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1265 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1267 SETTING_TRACE_BEGIN;
1268 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1271 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1273 SETTING_TRACE_BEGIN;
1274 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1277 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1279 SETTING_TRACE_BEGIN;
1280 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1283 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1285 SETTING_TRACE_BEGIN;
1286 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1289 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1291 SETTING_TRACE_BEGIN;
1292 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1295 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1297 SETTING_TRACE_BEGIN;
1298 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1301 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1303 SETTING_TRACE_BEGIN;
1304 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1307 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1309 SETTING_TRACE_BEGIN;
1310 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1313 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1315 SETTING_TRACE_BEGIN;
1316 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1319 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1321 SETTING_TRACE_BEGIN;
1322 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1325 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1327 SETTING_TRACE_BEGIN;
1328 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1331 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1333 SETTING_TRACE_BEGIN;
1334 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1337 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1339 SETTING_TRACE_BEGIN;
1340 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1345 * @todo need to add custom event notification method
1347 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1349 SETTING_TRACE_BEGIN;
1350 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1353 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1355 SETTING_TRACE_BEGIN;
1356 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1359 /* TODO : 2th argument, callback, is not in use. */
1360 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1362 SETTING_TRACE_BEGIN;
1363 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1366 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1368 SETTING_TRACE_BEGIN;
1369 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1372 /*//////////////////////////////////////////////////////////////////////////////////////// */
1373 /*--------------------------------------- */
1374 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1376 SETTING_TRACE_BEGIN;
1377 char *vconf_value = NULL;
1378 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1379 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1382 /* parsing validation */
1385 snprintf(arr, 20, "%s", vconf_value);
1387 *value = strdup(arr);
1391 return SYSTEM_SETTINGS_ERROR_NONE;
1394 /* LCOV_EXCL_START */
1395 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1397 SETTING_TRACE_BEGIN;
1398 char *vconf_value = NULL;
1399 vconf_value = (char *)value;
1401 char *ext = "UTF-8";
1404 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1406 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1407 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1409 return SYSTEM_SETTINGS_ERROR_NONE;
1411 /* LCOV_EXCL_STOP */
1413 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1415 SETTING_TRACE_BEGIN;
1416 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1419 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1421 SETTING_TRACE_BEGIN;
1422 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1426 /*--------------------------------------- */
1427 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1429 SETTING_TRACE_BEGIN;
1430 char *vconf_value = NULL;
1431 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1432 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1435 /* parsing validation */
1438 snprintf(arr, 20, "%s", vconf_value);
1440 *value = strdup(arr);
1443 return SYSTEM_SETTINGS_ERROR_NONE;
1446 /* LCOV_EXCL_START */
1447 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1449 SETTING_TRACE_BEGIN;
1450 char *vconf_value = NULL;
1451 vconf_value = (char *)value;
1453 char *ext = "UTF-8";
1456 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1458 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1459 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1461 return SYSTEM_SETTINGS_ERROR_NONE;
1463 /* LCOV_EXCL_STOP */
1465 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1467 SETTING_TRACE_BEGIN;
1468 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1469 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1472 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1474 SETTING_TRACE_BEGIN;
1475 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1478 /*--------------------------------------- */
1479 /* LCOV_EXCL_START */
1480 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1482 SETTING_TRACE_BEGIN;
1485 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1486 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1489 bool ret_value = true;
1490 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1492 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1495 *value = (void *)ret_value;
1497 return SYSTEM_SETTINGS_ERROR_NONE;
1499 /* LCOV_EXCL_STOP */
1501 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1503 SETTING_TRACE_BEGIN;
1506 vconf_value = (bool *)value;
1509 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1510 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1514 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1515 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1520 return SYSTEM_SETTINGS_ERROR_NONE;
1523 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1525 SETTING_TRACE_BEGIN;
1526 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1529 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1531 SETTING_TRACE_BEGIN;
1532 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1535 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1538 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1542 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1543 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1546 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1547 *value = strdup(&tzpath[20]);
1548 return SYSTEM_SETTINGS_ERROR_NONE;
1551 /* LCOV_EXCL_START */
1552 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1554 SETTING_TRACE_BEGIN;
1555 char *timezone_value = NULL;
1556 timezone_value = (char *)value;
1559 snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1561 int is_load = _is_file_accessible(tz_path);
1563 alarmmgr_set_timezone(tz_path);
1565 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1566 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1568 return SYSTEM_SETTINGS_ERROR_NONE;
1570 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1572 /* LCOV_EXCL_STOP */
1576 /* LCOV_EXCL_START */
1577 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1579 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1581 /* LCOV_EXCL_STOP */
1583 /* LCOV_EXCL_START */
1584 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1586 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1588 /* LCOV_EXCL_STOP */
1590 /* LCOV_EXCL_START */
1591 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1593 SETTING_TRACE_BEGIN;
1594 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1596 /* LCOV_EXCL_STOP */
1598 /* LCOV_EXCL_START */
1599 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1601 SETTING_TRACE_BEGIN;
1602 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1604 /* LCOV_EXCL_STOP */
1607 /* LCOV_EXCL_START */
1608 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1610 SETTING_TRACE_BEGIN;
1612 int ** val = (int**)value;
1613 cur_tick = time(NULL);
1615 /* struct tm * localtime = time (cur_tick); */
1616 /* printf("%s\n", ctime(&cur_tick); */
1617 return SYSTEM_SETTINGS_ERROR_NONE;
1620 /* LCOV_EXCL_STOP */
1622 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1624 SETTING_TRACE_BEGIN;
1625 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1628 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1630 SETTING_TRACE_BEGIN;
1631 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1636 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1637 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1639 SETTING_TRACE_BEGIN;
1642 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1643 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1645 *value = (void *)vconf_value;
1647 return SYSTEM_SETTINGS_ERROR_NONE;
1650 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1652 SETTING_TRACE_BEGIN;
1653 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1656 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1658 SETTING_TRACE_BEGIN;
1659 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1663 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1665 * a == false, b == false --> silent mode
1666 * a == true, b == false --> sound mode
1667 * a == false, b == true --> vibration mode
1669 /* LCOV_EXCL_START */
1670 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1672 SETTING_TRACE_BEGIN;
1677 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1678 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1681 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1682 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1685 if (sound_cond == false && vib_cond == false) {
1687 *value = (void *)vconf_value;
1689 vconf_value = false;
1690 *value = (void *)vconf_value;
1692 return SYSTEM_SETTINGS_ERROR_NONE;
1694 /* LCOV_EXCL_STOP */
1697 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1699 * a == false, b == false --> silent mode
1700 * a == true, b == false --> sound mode
1702 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1704 SETTING_TRACE_BEGIN;
1707 vconf_value = (bool *)value;
1709 bool vconf_sound = false;
1710 bool vconf_vib = false;
1713 vconf_sound = false;
1720 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1721 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1723 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1724 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1727 return SYSTEM_SETTINGS_ERROR_NONE;
1733 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1735 SETTING_TRACE_BEGIN;
1736 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1740 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1742 SETTING_TRACE_BEGIN;
1743 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1746 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1747 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1749 SETTING_TRACE_BEGIN;
1752 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1753 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1756 *value = (void *)vconf_value;
1760 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1762 SETTING_TRACE_BEGIN;
1763 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1766 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1768 SETTING_TRACE_BEGIN;
1769 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1773 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1774 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1778 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1779 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1781 *value = (void *)vconf_value;
1783 return SYSTEM_SETTINGS_ERROR_NONE;
1787 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1789 SETTING_TRACE_BEGIN;
1792 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1793 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1795 *value = (void *)vconf_value;
1797 return SYSTEM_SETTINGS_ERROR_NONE;
1800 /* LCOV_EXCL_START */
1801 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1803 SETTING_TRACE_BEGIN;
1805 vconf_value = (bool *)value;
1806 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1807 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1810 return SYSTEM_SETTINGS_ERROR_NONE;
1812 /* LCOV_EXCL_STOP */
1814 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1816 SETTING_TRACE_BEGIN;
1817 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1820 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1822 SETTING_TRACE_BEGIN;
1823 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1826 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1828 SETTING_TRACE_BEGIN;
1830 int ** val = (int**)value;
1832 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1833 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1835 **val = vconf_value;
1837 return SYSTEM_SETTINGS_ERROR_NONE;
1841 /* LCOV_EXCL_START */
1842 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1844 SETTING_TRACE_BEGIN;
1846 vconf_value = *(int **)value;
1848 if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1849 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1850 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1853 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1854 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1857 return SYSTEM_SETTINGS_ERROR_NONE;
1859 /* LCOV_EXCL_STOP */
1861 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1863 SETTING_TRACE_BEGIN;
1864 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
1867 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1869 SETTING_TRACE_BEGIN;
1870 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1873 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1875 SETTING_TRACE_BEGIN;
1876 char *vconf_value = NULL;
1877 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1878 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1881 *value = vconf_value;
1882 return SYSTEM_SETTINGS_ERROR_NONE;
1885 /* LCOV_EXCL_START */
1886 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1888 SETTING_TRACE_BEGIN;
1889 char *vconf_value = NULL;
1890 vconf_value = (char *)value;
1892 int is_load = _is_file_accessible(vconf_value);
1894 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1895 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1896 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1897 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1900 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1901 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1904 return SYSTEM_SETTINGS_ERROR_NONE;
1906 /* LCOV_EXCL_STOP */
1908 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1910 SETTING_TRACE_BEGIN;
1911 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
1914 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1916 SETTING_TRACE_BEGIN;
1917 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1920 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1922 SETTING_TRACE_BEGIN;
1923 int ** val = (int**)value;
1926 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1927 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1929 **val = vconf_value;
1931 return SYSTEM_SETTINGS_ERROR_NONE;
1934 /* LCOV_EXCL_START */
1935 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1937 SETTING_TRACE_BEGIN;
1939 vconf_value = *(int **)value;
1941 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1942 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1945 return SYSTEM_SETTINGS_ERROR_NONE;
1947 /* LCOV_EXCL_STOP */
1949 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1951 SETTING_TRACE_BEGIN;
1952 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);
1955 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1957 SETTING_TRACE_BEGIN;
1958 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1961 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1963 SETTING_TRACE_BEGIN;
1964 char *vconf_value = NULL;
1965 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1966 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1969 *value = vconf_value;
1970 return SYSTEM_SETTINGS_ERROR_NONE;
1973 /* LCOV_EXCL_START */
1974 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1976 SETTING_TRACE_BEGIN;
1977 char *vconf_value = NULL;
1978 vconf_value = (char *)value;
1980 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1981 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1984 return SYSTEM_SETTINGS_ERROR_NONE;
1986 /* LCOV_EXCL_STOP */
1988 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1990 SETTING_TRACE_BEGIN;
1991 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1994 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1996 SETTING_TRACE_BEGIN;
1997 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
2000 /*---------------------------------------------- */
2001 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2003 SETTING_TRACE_BEGIN;
2005 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
2006 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2008 *value = (void *)vconf_value;
2010 return SYSTEM_SETTINGS_ERROR_NONE;
2013 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2015 SETTING_TRACE_BEGIN;
2016 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
2019 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2021 SETTING_TRACE_BEGIN;
2022 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
2025 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2027 SETTING_TRACE_BEGIN;
2029 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2030 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2033 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2035 *value = (void *)bret;
2036 return SYSTEM_SETTINGS_ERROR_NONE;
2039 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2041 SETTING_TRACE_BEGIN;
2042 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
2045 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2047 SETTING_TRACE_BEGIN;
2048 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
2051 /* LCOV_EXCL_START */
2052 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2055 int ** val = (int**)value;
2057 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2058 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2060 **val = vconf_value;
2062 return SYSTEM_SETTINGS_ERROR_NONE;
2064 /* LCOV_EXCL_STOP */
2066 /* LCOV_EXCL_START */
2067 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2069 SETTING_TRACE_BEGIN;
2071 vconf_value = *(int **)value;
2073 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2074 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2077 return SYSTEM_SETTINGS_ERROR_NONE;
2079 /* LCOV_EXCL_STOP */
2081 /* LCOV_EXCL_START */
2082 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2084 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
2086 /* LCOV_EXCL_STOP */
2088 /* LCOV_EXCL_START */
2089 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2091 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
2093 /* LCOV_EXCL_STOP */
2095 //----------------------------------------------------------------------------------------------------------------------------
2097 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2099 int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2101 SETTING_TRACE_BEGIN;
2102 int optout_value = 0;
2103 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2104 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2107 if (optout_value == 1) {
2108 *value = strdup(DEFAULT_ADS_ID);
2109 return SYSTEM_SETTINGS_ERROR_NONE;
2112 char *vconf_value = NULL;
2113 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2114 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2117 *value = vconf_value;
2118 return SYSTEM_SETTINGS_ERROR_NONE;
2123 void make_ad_id(void)
2126 char uuid_unparsed[50] = {0};
2127 uuid_generate(uuid_value);
2128 uuid_unparse(uuid_value, uuid_unparsed);
2129 system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2132 /* LCOV_EXCL_START */
2133 int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2135 SETTING_TRACE_BEGIN;
2136 char *vconf_value = NULL;
2137 vconf_value = (char *)value;
2139 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
2140 SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
2141 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2144 return SYSTEM_SETTINGS_ERROR_NONE;
2146 /* LCOV_EXCL_STOP */
2148 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2150 SETTING_TRACE_BEGIN;
2151 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
2154 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2156 SETTING_TRACE_BEGIN;
2157 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);