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>
53 #include <efl_assist.h>
58 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
59 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
61 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
62 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
63 #define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime"
66 #define __FREE(del, arg) do { \
68 del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
72 #define FREE(arg) __FREE(free, arg)
74 #ifdef SETTING_ARCH_64
75 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
77 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
80 int _is_file_accessible(const char *path);
82 static bool dl_is_supported_image_type_load(char *path);
83 static bool dl_font_config_set(char *font_name);
84 static char *dl_get_font_info(char *str);
85 static int dl_is_available_font(char *str);
86 static void dl_font_size_set();
87 static void dl_font_config_set_notification();
91 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
92 * @return the ringtone file path specified by user in normal case
93 * if it's not accessable, return the default ringtone path
95 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
99 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
100 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
103 /* check to see if it's accessable -> OK */
104 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
105 int is_load = _is_file_accessible(vconf_value);
107 *value = vconf_value;
108 } else { /* not zero on errro */
109 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
112 /**value = vconf_value; */
113 return SYSTEM_SETTINGS_ERROR_NONE;
117 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
121 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
122 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
125 /* check to see if it's accessable -> OK */
126 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
127 int is_load = _is_file_accessible(vconf_value);
129 *value = vconf_value;
130 } else { /* not zero on errro */
131 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
134 return SYSTEM_SETTINGS_ERROR_NONE;
138 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
142 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
143 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
145 *value = vconf_value;
146 return SYSTEM_SETTINGS_ERROR_NONE;
150 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
155 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
156 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
158 *value = vconf_value;
160 return SYSTEM_SETTINGS_ERROR_NONE;
164 /* [int] vconf GET */
165 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
169 int ** val = (int**)value;
171 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
172 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
176 return SYSTEM_SETTINGS_ERROR_NONE;
180 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
183 char *font_name = dl_get_font_info("default");
185 *value = (void *)font_name;
186 return SYSTEM_SETTINGS_ERROR_NONE;
188 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
192 /* [int] vconf GET */
193 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
196 char *font_name = dl_get_font_info("cur");
197 *value = (void *)font_name;
199 return SYSTEM_SETTINGS_ERROR_NONE;
203 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
208 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
209 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
211 *value = (void *)vconf_value;
213 return SYSTEM_SETTINGS_ERROR_NONE;
216 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
221 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
222 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
224 *value = (void *)vconf_value;
226 return SYSTEM_SETTINGS_ERROR_NONE;
229 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
234 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
235 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
237 *value = (void *)vconf_value;
239 return SYSTEM_SETTINGS_ERROR_NONE;
241 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
245 * get current lock scren app package name (string)
247 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
249 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
252 char *pkg_name = NULL;
254 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
256 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
257 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
260 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
261 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
265 return SYSTEM_SETTINGS_ERROR_NONE;
269 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
271 int _is_file_accessible(const char *path)
274 int ret = access(path , R_OK);
276 SETTING_TRACE("found the file %s", path);
279 /* error code : 13 */
280 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
287 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
288 // @todo move to CMake
289 #define DEF_RINGTONE_FILE_PATH "/opt/share/settings/Ringtones"
290 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
291 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
294 static char* _get_json_file_path()
301 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
304 char* pathval = (char*)value;
308 JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
310 JsonParser *parser = ss_json_ringtone_load_from_data();
313 JsonNode *root = json_parser_get_root(parser);
317 int ret = SYSTEM_SETTINGS_ERROR_NONE;
318 if (false == ss_json_ringtone_contain(root, pathval)) {
319 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
320 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
321 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
322 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
323 SETTING_TRACE("pathval is : %s -- OK", pathval);
325 SETTING_TRACE("pathval is duplicated : %s", pathval);
326 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
327 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
328 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
332 g_object_unref(parser);
339 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
342 char* pathval = (char*)value;
345 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
347 JsonParser* parser = ss_json_ringtone_load_from_data();
349 JsonNode *root = json_parser_get_root(parser);
351 ss_json_ringtone_remove(root, JSONFILE, pathval);
352 //void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
354 ss_json_ringtone_print(root);
356 g_object_unref(parser);
360 return SYSTEM_SETTINGS_ERROR_NONE;
364 static int _compare_cb(const void *d1, const void *d2)
366 fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
367 fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
369 return strcmp(pNode1->media_name, pNode2->media_name);
373 * get the RINGTONE list
375 static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
379 Eina_List *filelist = NULL;
381 fileNodeInfo *node = NULL;
384 //-----------------------------------------------------------------------------------------------------------------
385 // 1. get the default ringtone list
386 //-----------------------------------------------------------------------------------------------------------------
387 int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
389 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
391 filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
393 EINA_LIST_FOREACH(filelist, l, node)
395 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
396 // @todo assert NULL check
399 snprintf(temp, 1024, "%s/%s", node->path, node->name);
400 char* path = strdup(temp);
401 bool ret = callback(idx, (void *)(path), data);
407 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
412 SETTING_TRACE("--> system_setting_data_iterator is NULL");
418 EINA_LIST_FOREACH(filelist, l, node)
422 FREE(node->media_name);
425 eina_list_free(filelist);
430 static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
436 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
438 JsonParser* parser = ss_json_ringtone_load_from_data();
441 JsonNode *root = json_parser_get_root(parser);
442 int size = json_array_get_length(json_node_get_array(root));
445 for (i = 0; i < size ; i++) {
446 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
447 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
448 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
449 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
451 char* path = strdup(pathval);
452 bool ret = callback(i, (void *)(path), data);
454 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
458 SETTING_TRACE("--> callback is NULL");
463 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)
467 _get_default_ringtones(key, data_type, callback, data);
468 //-----------------------------------------------------------------------------------------------------------------
469 // 2. get the USER ringtone list
470 //-----------------------------------------------------------------------------------------------------------------
471 _get_user_ringtones(key, data_type, callback, data);
473 return SYSTEM_SETTINGS_ERROR_NONE;
477 /* LCOV_EXCL_START */
478 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
482 vconf_value = (char *)value;
484 int ret = _is_file_accessible(vconf_value);
486 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
487 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
490 /* @todo add a common ret_handler */
494 return SYSTEM_SETTINGS_ERROR_NONE;
499 /* LCOV_EXCL_START */
500 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
504 vconf_value = (char *)value;
506 int ret = _is_file_accessible(vconf_value);
508 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
509 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
512 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
513 /* @todo add a common ret_handler */
517 return SYSTEM_SETTINGS_ERROR_NONE;
521 /* LCOV_EXCL_START */
522 static bool dl_is_supported_image_type_load(char *path)
527 bool (*image_type_check)(char *path);
529 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
531 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
535 image_type_check = dlsym(handle, "__is_supported_image_type_load");
536 if ((error = dlerror()) != NULL) {
537 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
542 ret = image_type_check(path);
549 /* LCOV_EXCL_START */
550 static int dl_is_available_font(char *str)
555 int (*check_available_font)(char *font_name);
557 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
559 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
563 check_available_font = dlsym(handle, "__is_available_font");
564 if ((error = dlerror()) != NULL) {
565 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
570 ret = check_available_font(str);
577 /* LCOV_EXCL_START */
578 static void dl_font_size_set()
582 void (*set_font_size)();
584 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
586 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
590 set_font_size = dlsym(handle, "__font_size_set");
591 if ((error = dlerror()) != NULL) {
592 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
604 /* LCOV_EXCL_START */
605 static void dl_font_config_set_notification()
609 void (*set_font_nodification)();
611 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
613 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
617 set_font_nodification = dlsym(handle, "font_config_set_notification");
618 if ((error = dlerror()) != NULL) {
619 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
624 set_font_nodification();
631 /* LCOV_EXCL_START */
632 static bool dl_font_config_set(char *font_name)
637 bool (*check_font_type)(char *font_name);
639 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
641 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
645 check_font_type = dlsym(handle, "font_config_set");
646 if ((error = dlerror()) != NULL) {
647 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
652 ret = check_font_type(font_name);
659 /* LCOV_EXCL_START */
660 static char *dl_get_font_info(char *str)
665 char *(*get_font_info)();
667 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
669 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
673 if (strcmp(str, "cur") == 0)
674 get_font_info = dlsym(handle, "_get_cur_font");
676 get_font_info = dlsym(handle, "_get_default_font");
678 if ((error = dlerror()) != NULL) {
679 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
684 ret = get_font_info();
691 /* LCOV_EXCL_START */
692 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
693 bool __is_supported_image_type_by_ext(char *file_path)
697 regmatch_t str[2048 + 1];
699 if (!file_path) return false;
702 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
703 SETTING_TRACE("regular expresstion fail");
708 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
709 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
712 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
718 #ifdef TIZEN_WEARABLE
719 /* LCOV_EXCL_START */
720 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
724 const char *find_str = "extended_wallpaper_";
727 if (!(ch = strstr(file_path, find_str))) {
728 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
730 strncpy(buffer, file_path, ch - file_path);
731 buffer[ch - file_path] = 0;
732 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
734 if (!isdigit(buffer[0])) {
735 SETTING_TRACE("%s is not number", buffer);
736 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
741 return SYSTEM_SETTINGS_ERROR_NONE;
745 /* LCOV_EXCL_START */
746 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
749 if (!source_file_path || !dest_file_path) {
750 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
756 fd = open(source_file_path, O_RDONLY);
758 SETTING_TRACE("file open failed: %s", source_file_path);
759 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
763 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
765 SETTING_TRACE("file creation failed: %s", dest_file_path);
767 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
770 while (read(fd, buf, sizeof(buf) - 1) > 0) {
771 write(fd2, buf, sizeof(buf) - 1);
777 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
778 SETTING_TRACE("chmod failed: %s", dest_file_path);
781 return SYSTEM_SETTINGS_ERROR_NONE;
785 /* LCOV_EXCL_START */
786 static int system_setting_remove_oldest_extended_wallpaper()
791 char *min_image_name = NULL;
792 unsigned int min_image_num = 0;
793 unsigned int temp_image_num = 0;
796 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
797 SETTING_TRACE("opendir error");
798 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
801 while ((dirp = readdir(dp))) {
802 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
805 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
806 != SYSTEM_SETTINGS_ERROR_NONE) {
807 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
810 if ((image_count == 0) || (min_image_num > temp_image_num)) {
811 min_image_num = temp_image_num;
812 min_image_name = dirp->d_name;
819 if (min_image_name) {
820 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
821 if (remove(buf) < 0) { /* remove oldest image */
822 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
826 return SYSTEM_SETTINGS_ERROR_NONE;
830 /* LCOV_EXCL_START */
831 static int system_setting_check_extended_wallpaper(const char *file_path)
835 if (!file_path || !strlen(file_path))
837 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
838 return (strstr(file_path, buffer) != NULL);
842 #define WALLPAPER_MAX_COUNT 10
844 /* LCOV_EXCL_START */
845 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
849 vconf_value = (char *)value;
851 bool isok = dl_is_supported_image_type_load(vconf_value);
854 SETTING_TRACE("path : %s is not supported file format", vconf_value);
855 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
857 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
860 /* error handling here */
861 if (_is_file_accessible(vconf_value) != 0)
862 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
864 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
865 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
869 #ifdef TIZEN_WEARABLE
870 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
873 unsigned int max_image_num = 0;
874 unsigned int temp_image_num = 0;
877 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
878 SETTING_TRACE("Setting - dir open error!");
879 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
882 /* Check a max number of wallpapers */
883 while ((dirp = readdir(dp))) {
884 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
887 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
888 != SYSTEM_SETTINGS_ERROR_NONE) {
891 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
894 if ((image_count == 0) || (max_image_num < temp_image_num)) {
895 max_image_num = temp_image_num;
903 /* Numbering rule: Gear is odd number */
904 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
907 char file_name_buffer[512];
908 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
909 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
911 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
912 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
913 != SYSTEM_SETTINGS_ERROR_NONE) {
914 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
917 /* remove oldest wallpaper */
918 if (image_count >= WALLPAPER_MAX_COUNT) {
919 if (system_setting_remove_oldest_extended_wallpaper()
920 != SYSTEM_SETTINGS_ERROR_NONE) {
921 remove(file_name_buffer);
922 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
926 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
927 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
930 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
931 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
932 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
935 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
936 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
941 return SYSTEM_SETTINGS_ERROR_NONE;
945 /* LCOV_EXCL_START */
946 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
950 vconf_value = (char *)value;
952 bool isok = dl_is_supported_image_type_load(vconf_value);
955 SETTING_TRACE("path : %s is not supported file format", vconf_value);
956 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
958 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
961 /* error handling here */
962 if (_is_file_accessible(vconf_value) != 0)
963 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
965 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
966 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
969 return SYSTEM_SETTINGS_ERROR_NONE;
973 /* LCOV_EXCL_START */
974 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
978 vconf_value = *(int **)value;
980 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
981 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
984 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
985 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
989 return SYSTEM_SETTINGS_ERROR_NONE;
995 /* LCOV_EXCL_START */
996 void *font_conf_doc_parse(char *doc_name, char *font_name)
999 xmlDocPtr doc = NULL;
1000 xmlNodePtr cur = NULL;
1001 xmlNodePtr cur2 = NULL;
1002 xmlNodePtr cur3 = NULL;
1003 xmlChar *key = NULL;
1005 doc = xmlParseFile(doc_name);
1007 cur = xmlDocGetRootElement(doc);
1015 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1021 cur = cur->xmlChildrenNode;
1023 bool is_changed = false;
1024 while (cur != NULL) {
1025 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1026 cur2 = cur->xmlChildrenNode;
1027 while (cur2 != NULL) {
1028 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1029 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1030 /* if name is not 'family', break */
1031 if (xmlStrcmp(name, (const xmlChar *)"family")) {
1039 cur3 = cur2->xmlChildrenNode;
1040 while (cur3 != NULL) {
1041 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1042 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1043 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1053 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1054 cur2 = cur->xmlChildrenNode;
1055 while (cur2 != NULL) {
1056 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1057 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1058 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1062 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1063 cur3 = cur2->xmlChildrenNode;
1064 while (cur3 != NULL) {
1065 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1066 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1067 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1091 /* LCOV_EXCL_STOP */
1093 /* LCOV_EXCL_START */
1094 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1096 SETTING_TRACE_BEGIN;
1097 char *font_name = NULL;
1098 font_name = (char *)value;
1100 /* get current font list */
1101 int is_found = dl_is_available_font(font_name);
1104 SETTING_TRACE("found font : %s ", font_name);
1106 SETTING_TRACE(" NOT found font : %s ", font_name);
1107 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1110 bool bsave = dl_font_config_set(font_name);
1113 SETTING_TRACE(" font type save error by font_config_set() ");
1114 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1116 SETTING_TRACE(" save OK - font_config_set() ");
1119 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1121 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1126 dl_font_config_set_notification();
1129 vconf_value = (char *)value;
1131 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1132 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1134 return SYSTEM_SETTINGS_ERROR_NONE;
1136 /* LCOV_EXCL_STOP */
1138 /* LCOV_EXCL_START */
1139 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1141 SETTING_TRACE_BEGIN;
1143 vconf_value = (bool *)value;
1144 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1145 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1147 return SYSTEM_SETTINGS_ERROR_NONE;
1149 /* LCOV_EXCL_STOP */
1151 /* LCOV_EXCL_START */
1152 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1154 SETTING_TRACE_BEGIN;
1156 vconf_value = (bool *)value;
1157 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1158 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1160 return SYSTEM_SETTINGS_ERROR_NONE;
1163 /* LCOV_EXCL_STOP */
1165 /* LCOV_EXCL_START */
1166 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1168 SETTING_TRACE_BEGIN;
1170 vconf_value = (bool *)value;
1171 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1172 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1175 return SYSTEM_SETTINGS_ERROR_NONE;
1177 /* LCOV_EXCL_STOP */
1179 /* LCOV_EXCL_START */
1180 static int category_func(const char *name, void *user_data)
1182 SETTING_TRACE_BEGIN;
1183 static char *category = "lock-screen";
1184 if (name && !strcmp(name, category)) {
1185 SETTING_TRACE(" SAME ");
1188 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1194 /* LCOV_EXCL_STOP */
1198 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1202 /* LCOV_EXCL_START */
1203 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1205 SETTING_TRACE_BEGIN;
1207 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
1210 pkgmgrinfo_appinfo_h handle;
1211 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1212 if (r != PMINFO_R_OK) {
1213 SETTING_TRACE("*** pkginfo failed ");
1214 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1216 SETTING_TRACE("%x", handle);
1219 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1220 if (ret != PMINFO_R_OK) {
1221 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1222 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1225 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1226 /*----------------------------------------------------------------------------------- */
1228 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1229 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1232 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1233 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1235 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1236 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1239 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1240 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1241 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1244 return SYSTEM_SETTINGS_ERROR_NONE;
1246 /* LCOV_EXCL_STOP */
1248 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1251 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1253 SETTING_TRACE_BEGIN;
1254 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1257 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1259 SETTING_TRACE_BEGIN;
1260 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1263 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1265 SETTING_TRACE_BEGIN;
1266 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1269 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1271 SETTING_TRACE_BEGIN;
1272 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1275 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1277 SETTING_TRACE_BEGIN;
1278 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1281 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1283 SETTING_TRACE_BEGIN;
1284 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1287 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1289 SETTING_TRACE_BEGIN;
1290 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1293 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1295 SETTING_TRACE_BEGIN;
1296 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1299 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1301 SETTING_TRACE_BEGIN;
1302 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1305 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1307 SETTING_TRACE_BEGIN;
1308 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1311 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1313 SETTING_TRACE_BEGIN;
1314 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1317 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1319 SETTING_TRACE_BEGIN;
1320 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1323 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1325 SETTING_TRACE_BEGIN;
1326 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1329 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1331 SETTING_TRACE_BEGIN;
1332 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1335 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1337 SETTING_TRACE_BEGIN;
1338 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1341 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1343 SETTING_TRACE_BEGIN;
1344 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1349 * @todo need to add custom event notification method
1351 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1353 SETTING_TRACE_BEGIN;
1354 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1357 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1359 SETTING_TRACE_BEGIN;
1360 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1363 /* TODO : 2th argument, callback, is not in use. */
1364 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1366 SETTING_TRACE_BEGIN;
1367 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1370 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1372 SETTING_TRACE_BEGIN;
1373 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1376 /*//////////////////////////////////////////////////////////////////////////////////////// */
1377 /*--------------------------------------- */
1378 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1380 SETTING_TRACE_BEGIN;
1381 char *vconf_value = NULL;
1382 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1383 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1386 /* parsing validation */
1389 snprintf(arr, 20, "%s", vconf_value);
1391 *value = strdup(arr);
1395 return SYSTEM_SETTINGS_ERROR_NONE;
1398 /* LCOV_EXCL_START */
1399 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1401 SETTING_TRACE_BEGIN;
1402 char *vconf_value = NULL;
1403 vconf_value = (char *)value;
1405 char *ext = "UTF-8";
1408 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1410 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1411 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1413 return SYSTEM_SETTINGS_ERROR_NONE;
1415 /* LCOV_EXCL_STOP */
1417 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1419 SETTING_TRACE_BEGIN;
1420 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1423 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1425 SETTING_TRACE_BEGIN;
1426 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1430 /*--------------------------------------- */
1431 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1433 SETTING_TRACE_BEGIN;
1434 char *vconf_value = NULL;
1435 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1436 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1439 /* parsing validation */
1442 snprintf(arr, 20, "%s", vconf_value);
1444 *value = strdup(arr);
1447 return SYSTEM_SETTINGS_ERROR_NONE;
1450 /* LCOV_EXCL_START */
1451 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1453 SETTING_TRACE_BEGIN;
1454 char *vconf_value = NULL;
1455 vconf_value = (char *)value;
1457 char *ext = "UTF-8";
1460 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1462 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1463 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1465 return SYSTEM_SETTINGS_ERROR_NONE;
1467 /* LCOV_EXCL_STOP */
1469 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1471 SETTING_TRACE_BEGIN;
1472 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1473 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1476 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1478 SETTING_TRACE_BEGIN;
1479 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1482 /*--------------------------------------- */
1483 /* LCOV_EXCL_START */
1484 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1486 SETTING_TRACE_BEGIN;
1489 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1490 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1493 bool ret_value = true;
1494 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1496 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1499 *value = (void *)ret_value;
1501 return SYSTEM_SETTINGS_ERROR_NONE;
1503 /* LCOV_EXCL_STOP */
1505 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1507 SETTING_TRACE_BEGIN;
1510 vconf_value = (bool *)value;
1513 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1514 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1518 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1519 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1524 return SYSTEM_SETTINGS_ERROR_NONE;
1527 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1529 SETTING_TRACE_BEGIN;
1530 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1533 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1535 SETTING_TRACE_BEGIN;
1536 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1539 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1542 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1546 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1547 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1550 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1551 *value = strdup(&tzpath[20]);
1552 return SYSTEM_SETTINGS_ERROR_NONE;
1555 /* LCOV_EXCL_START */
1556 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1558 SETTING_TRACE_BEGIN;
1559 char *timezone_value = NULL;
1560 timezone_value = (char *)value;
1563 snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1565 int is_load = _is_file_accessible(tz_path);
1567 alarmmgr_set_timezone(tz_path);
1569 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1570 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1572 return SYSTEM_SETTINGS_ERROR_NONE;
1574 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1576 /* LCOV_EXCL_STOP */
1580 /* LCOV_EXCL_START */
1581 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1583 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1585 /* LCOV_EXCL_STOP */
1587 /* LCOV_EXCL_START */
1588 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1590 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1592 /* LCOV_EXCL_STOP */
1594 /* LCOV_EXCL_START */
1595 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1597 SETTING_TRACE_BEGIN;
1598 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1600 /* LCOV_EXCL_STOP */
1602 /* LCOV_EXCL_START */
1603 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1605 SETTING_TRACE_BEGIN;
1606 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1608 /* LCOV_EXCL_STOP */
1611 /* LCOV_EXCL_START */
1612 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1614 SETTING_TRACE_BEGIN;
1616 int ** val = (int**)value;
1617 cur_tick = time(NULL);
1619 /* struct tm * localtime = time (cur_tick); */
1620 /* printf("%s\n", ctime(&cur_tick); */
1621 return SYSTEM_SETTINGS_ERROR_NONE;
1624 /* LCOV_EXCL_STOP */
1626 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1628 SETTING_TRACE_BEGIN;
1629 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1632 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1634 SETTING_TRACE_BEGIN;
1635 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1640 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1641 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1643 SETTING_TRACE_BEGIN;
1646 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1647 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1649 *value = (void *)vconf_value;
1651 return SYSTEM_SETTINGS_ERROR_NONE;
1654 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1656 SETTING_TRACE_BEGIN;
1657 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1660 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1662 SETTING_TRACE_BEGIN;
1663 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1667 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1669 * a == false, b == false --> silent mode
1670 * a == true, b == false --> sound mode
1671 * a == false, b == true --> vibration mode
1673 /* LCOV_EXCL_START */
1674 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1676 SETTING_TRACE_BEGIN;
1681 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1682 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1685 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1686 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1689 if (sound_cond == false && vib_cond == false) {
1691 *value = (void *)vconf_value;
1693 vconf_value = false;
1694 *value = (void *)vconf_value;
1696 return SYSTEM_SETTINGS_ERROR_NONE;
1698 /* LCOV_EXCL_STOP */
1701 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1703 * a == false, b == false --> silent mode
1704 * a == true, b == false --> sound mode
1706 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1708 SETTING_TRACE_BEGIN;
1711 vconf_value = (bool *)value;
1713 bool vconf_sound = false;
1714 bool vconf_vib = false;
1717 vconf_sound = false;
1724 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1725 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1727 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1728 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1731 return SYSTEM_SETTINGS_ERROR_NONE;
1737 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1739 SETTING_TRACE_BEGIN;
1740 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1744 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1746 SETTING_TRACE_BEGIN;
1747 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1750 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1751 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1753 SETTING_TRACE_BEGIN;
1756 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1757 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1760 *value = (void *)vconf_value;
1764 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1766 SETTING_TRACE_BEGIN;
1767 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1770 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1772 SETTING_TRACE_BEGIN;
1773 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1777 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1778 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1782 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1783 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1785 *value = (void *)vconf_value;
1787 return SYSTEM_SETTINGS_ERROR_NONE;
1791 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1793 SETTING_TRACE_BEGIN;
1796 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1797 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1799 *value = (void *)vconf_value;
1801 return SYSTEM_SETTINGS_ERROR_NONE;
1804 /* LCOV_EXCL_START */
1805 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1807 SETTING_TRACE_BEGIN;
1809 vconf_value = (bool *)value;
1810 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1811 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1814 return SYSTEM_SETTINGS_ERROR_NONE;
1816 /* LCOV_EXCL_STOP */
1818 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1820 SETTING_TRACE_BEGIN;
1821 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1824 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1826 SETTING_TRACE_BEGIN;
1827 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1830 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1832 SETTING_TRACE_BEGIN;
1834 int ** val = (int**)value;
1836 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1837 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1839 **val = vconf_value;
1841 return SYSTEM_SETTINGS_ERROR_NONE;
1845 /* LCOV_EXCL_START */
1846 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1848 SETTING_TRACE_BEGIN;
1850 vconf_value = *(int **)value;
1852 if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1853 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1854 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1857 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1858 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1861 return SYSTEM_SETTINGS_ERROR_NONE;
1863 /* LCOV_EXCL_STOP */
1865 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1867 SETTING_TRACE_BEGIN;
1868 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
1871 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1873 SETTING_TRACE_BEGIN;
1874 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1877 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1879 SETTING_TRACE_BEGIN;
1880 char *vconf_value = NULL;
1881 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1882 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1885 *value = vconf_value;
1886 return SYSTEM_SETTINGS_ERROR_NONE;
1889 /* LCOV_EXCL_START */
1890 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1892 SETTING_TRACE_BEGIN;
1893 char *vconf_value = NULL;
1894 vconf_value = (char *)value;
1896 int is_load = _is_file_accessible(vconf_value);
1898 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1899 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1900 //SETTING_TRACE(" 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 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1905 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1908 return SYSTEM_SETTINGS_ERROR_NONE;
1910 /* LCOV_EXCL_STOP */
1912 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1914 SETTING_TRACE_BEGIN;
1915 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
1918 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1920 SETTING_TRACE_BEGIN;
1921 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1924 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1926 SETTING_TRACE_BEGIN;
1927 int ** val = (int**)value;
1930 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1931 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1933 **val = vconf_value;
1935 return SYSTEM_SETTINGS_ERROR_NONE;
1938 /* LCOV_EXCL_START */
1939 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1941 SETTING_TRACE_BEGIN;
1943 vconf_value = *(int **)value;
1945 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1946 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1949 return SYSTEM_SETTINGS_ERROR_NONE;
1951 /* LCOV_EXCL_STOP */
1953 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1955 SETTING_TRACE_BEGIN;
1956 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);
1959 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1961 SETTING_TRACE_BEGIN;
1962 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1965 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1967 SETTING_TRACE_BEGIN;
1968 char *vconf_value = NULL;
1969 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1970 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1973 *value = vconf_value;
1974 return SYSTEM_SETTINGS_ERROR_NONE;
1977 /* LCOV_EXCL_START */
1978 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1980 SETTING_TRACE_BEGIN;
1981 char *vconf_value = NULL;
1982 vconf_value = (char *)value;
1984 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1985 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1988 return SYSTEM_SETTINGS_ERROR_NONE;
1990 /* LCOV_EXCL_STOP */
1992 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1994 SETTING_TRACE_BEGIN;
1995 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1998 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
2000 SETTING_TRACE_BEGIN;
2001 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
2004 /*---------------------------------------------- */
2005 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2007 SETTING_TRACE_BEGIN;
2009 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
2010 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2012 *value = (void *)vconf_value;
2014 return SYSTEM_SETTINGS_ERROR_NONE;
2017 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2019 SETTING_TRACE_BEGIN;
2020 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
2023 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2025 SETTING_TRACE_BEGIN;
2026 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
2029 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2031 SETTING_TRACE_BEGIN;
2033 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2034 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2037 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2039 *value = (void *)bret;
2040 return SYSTEM_SETTINGS_ERROR_NONE;
2043 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2045 SETTING_TRACE_BEGIN;
2046 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
2049 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2051 SETTING_TRACE_BEGIN;
2052 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
2055 /* LCOV_EXCL_START */
2056 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2059 int ** val = (int**)value;
2061 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2062 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2064 **val = vconf_value;
2066 return SYSTEM_SETTINGS_ERROR_NONE;
2068 /* LCOV_EXCL_STOP */
2070 /* LCOV_EXCL_START */
2071 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2073 SETTING_TRACE_BEGIN;
2075 vconf_value = *(int **)value;
2077 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2078 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2081 return SYSTEM_SETTINGS_ERROR_NONE;
2083 /* LCOV_EXCL_STOP */
2085 /* LCOV_EXCL_START */
2086 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2088 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
2090 /* LCOV_EXCL_STOP */
2092 /* LCOV_EXCL_START */
2093 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2095 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
2097 /* LCOV_EXCL_STOP */
2099 //----------------------------------------------------------------------------------------------------------------------------
2101 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2103 int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2105 SETTING_TRACE_BEGIN;
2106 int optout_value = 0;
2107 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2108 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2111 if (optout_value == 1) {
2112 *value = strdup(DEFAULT_ADS_ID);
2113 return SYSTEM_SETTINGS_ERROR_NONE;
2116 char *vconf_value = NULL;
2117 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2118 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2121 *value = vconf_value;
2122 return SYSTEM_SETTINGS_ERROR_NONE;
2127 void make_ad_id(void)
2130 char uuid_unparsed[50] = {0};
2131 uuid_generate(uuid_value);
2132 uuid_unparse(uuid_value, uuid_unparsed);
2133 system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2136 /* LCOV_EXCL_START */
2137 int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2139 SETTING_TRACE_BEGIN;
2140 char *vconf_value = NULL;
2141 vconf_value = (char *)value;
2143 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
2144 SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
2145 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2148 return SYSTEM_SETTINGS_ERROR_NONE;
2150 /* LCOV_EXCL_STOP */
2152 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2154 SETTING_TRACE_BEGIN;
2155 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
2158 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2160 SETTING_TRACE_BEGIN;
2161 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);