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>
48 #include <system-setting-config.h>
50 #include <tzplatform_config.h>
55 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
56 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
58 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
59 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
60 #define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime"
63 #define __FREE(del, arg) do { \
65 del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
69 #define FREE(arg) __FREE(free, arg)
71 #ifdef SETTING_ARCH_64
72 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
74 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
77 int _is_file_accessible(const char *path);
79 static bool dl_is_supported_image_type_load(char *path);
80 static bool dl_font_config_set(char *font_name);
81 static char *dl_get_default_font_info();
82 static int dl_is_available_font(char *str);
83 static void dl_font_size_set();
84 static void dl_font_config_set_notification();
88 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
89 * @return the ringtone file path specified by user in normal case
90 * if it's not accessable, return the default ringtone path
92 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
96 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
97 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
100 /* check to see if it's accessable -> OK */
101 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
102 int is_load = _is_file_accessible(vconf_value);
104 *value = vconf_value;
105 } else { /* not zero on errro */
106 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
109 /**value = vconf_value; */
110 return SYSTEM_SETTINGS_ERROR_NONE;
114 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
118 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
119 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
122 /* check to see if it's accessable -> OK */
123 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
124 int is_load = _is_file_accessible(vconf_value);
126 *value = vconf_value;
127 } else { /* not zero on errro */
128 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
131 return SYSTEM_SETTINGS_ERROR_NONE;
135 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
139 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
140 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
142 *value = vconf_value;
143 return SYSTEM_SETTINGS_ERROR_NONE;
147 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
152 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
153 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
155 *value = vconf_value;
157 return SYSTEM_SETTINGS_ERROR_NONE;
161 /* [int] vconf GET */
162 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
166 int ** val = (int**)value;
168 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
169 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
173 return SYSTEM_SETTINGS_ERROR_NONE;
177 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
180 char *font_name = dl_get_default_font_info();
182 *value = (void *)font_name;
183 return SYSTEM_SETTINGS_ERROR_NONE;
185 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
189 /* [int] vconf GET */
190 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
193 char *font_name = NULL;
195 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, &font_name)) {
196 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
200 return SYSTEM_SETTINGS_ERROR_NONE;
204 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
209 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
210 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
212 *value = (void *)vconf_value;
214 return SYSTEM_SETTINGS_ERROR_NONE;
217 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
222 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
223 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
225 *value = (void *)vconf_value;
227 return SYSTEM_SETTINGS_ERROR_NONE;
230 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
235 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
236 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
238 *value = (void *)vconf_value;
240 return SYSTEM_SETTINGS_ERROR_NONE;
242 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
246 * get current lock scren app package name (string)
248 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
250 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
253 char *pkg_name = NULL;
255 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
257 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
258 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
261 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
262 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
266 return SYSTEM_SETTINGS_ERROR_NONE;
270 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
272 int _is_file_accessible(const char *path)
275 int ret = access(path , R_OK);
277 SETTING_TRACE("found the file %s", path);
280 /* error code : 13 */
281 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
288 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
289 // @todo move to CMake
290 #define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones"
292 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
293 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
296 static char* _get_json_file_path()
303 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
306 char* pathval = (char*)value;
310 JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
312 JsonParser *parser = ss_json_ringtone_load_from_data();
315 JsonNode *root = json_parser_get_root(parser);
319 int ret = SYSTEM_SETTINGS_ERROR_NONE;
320 if (false == ss_json_ringtone_contain(root, pathval)) {
321 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
322 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
323 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
324 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
325 SETTING_TRACE("pathval is : %s -- OK", pathval);
327 SETTING_TRACE("pathval is duplicated : %s", pathval);
328 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
329 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
330 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
334 g_object_unref(parser);
341 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
344 char* pathval = (char*)value;
347 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
349 JsonParser* parser = ss_json_ringtone_load_from_data();
351 JsonNode *root = json_parser_get_root(parser);
353 ss_json_ringtone_remove(root, JSONFILE, pathval);
354 //void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
356 ss_json_ringtone_print(root);
358 g_object_unref(parser);
362 return SYSTEM_SETTINGS_ERROR_NONE;
366 static int _compare_cb(const void *d1, const void *d2)
368 fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
369 fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
371 return strcmp(pNode1->media_name, pNode2->media_name);
375 * get the RINGTONE list
377 static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
381 Eina_List *filelist = NULL;
383 fileNodeInfo *node = NULL;
386 //-----------------------------------------------------------------------------------------------------------------
387 // 1. get the default ringtone list
388 //-----------------------------------------------------------------------------------------------------------------
389 int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
391 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
393 filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
395 EINA_LIST_FOREACH(filelist, l, node)
397 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
398 // @todo assert NULL check
401 snprintf(temp, 1024, "%s/%s", node->path, node->name);
402 char* path = strdup(temp);
403 bool ret = callback(idx, (void *)(path), data);
409 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
414 SETTING_TRACE("--> system_setting_data_iterator is NULL");
420 EINA_LIST_FOREACH(filelist, l, node)
424 FREE(node->media_name);
427 eina_list_free(filelist);
432 static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
438 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
440 JsonParser* parser = ss_json_ringtone_load_from_data();
443 JsonNode *root = json_parser_get_root(parser);
444 int size = json_array_get_length(json_node_get_array(root));
447 for (i = 0; i < size ; i++) {
448 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
449 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
450 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
451 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
453 char* path = strdup(pathval);
454 bool ret = callback(i, (void *)(path), data);
456 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
460 SETTING_TRACE("--> callback is NULL");
465 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)
469 _get_default_ringtones(key, data_type, callback, data);
470 //-----------------------------------------------------------------------------------------------------------------
471 // 2. get the USER ringtone list
472 //-----------------------------------------------------------------------------------------------------------------
473 _get_user_ringtones(key, data_type, callback, data);
475 return SYSTEM_SETTINGS_ERROR_NONE;
479 /* LCOV_EXCL_START */
480 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
484 vconf_value = (char *)value;
486 int ret = _is_file_accessible(vconf_value);
488 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
489 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
492 /* @todo add a common ret_handler */
496 return SYSTEM_SETTINGS_ERROR_NONE;
501 /* LCOV_EXCL_START */
502 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
506 vconf_value = (char *)value;
508 int ret = _is_file_accessible(vconf_value);
510 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
511 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
514 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
515 /* @todo add a common ret_handler */
519 return SYSTEM_SETTINGS_ERROR_NONE;
523 /* LCOV_EXCL_START */
524 static bool dl_is_supported_image_type_load(char *path)
529 bool (*image_type_check)(char *path);
531 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
533 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
537 image_type_check = dlsym(handle, "__is_supported_image_type_load");
538 if ((error = dlerror()) != NULL) {
539 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
544 ret = image_type_check(path);
551 /* LCOV_EXCL_START */
552 static int dl_is_available_font(char *str)
557 int (*check_available_font)(char *font_name);
559 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
561 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
565 check_available_font = dlsym(handle, "__is_available_font");
566 if ((error = dlerror()) != NULL) {
567 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
572 ret = check_available_font(str);
579 /* LCOV_EXCL_START */
580 static void dl_font_size_set()
584 void (*set_font_size)();
586 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
588 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
592 set_font_size = dlsym(handle, "__font_size_set");
593 if ((error = dlerror()) != NULL) {
594 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
606 /* LCOV_EXCL_START */
607 static void dl_font_config_set_notification()
611 void (*set_font_nodification)();
613 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
615 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
619 set_font_nodification = dlsym(handle, "font_config_set_notification");
620 if ((error = dlerror()) != NULL) {
621 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
626 set_font_nodification();
633 /* LCOV_EXCL_START */
634 static bool dl_font_config_set(char *font_name)
639 bool (*check_font_type)(char *font_name);
641 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
643 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
647 check_font_type = dlsym(handle, "font_config_set");
648 if ((error = dlerror()) != NULL) {
649 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
654 ret = check_font_type(font_name);
661 /* LCOV_EXCL_START */
662 static char *dl_get_default_font_info()
667 char *(*get_font_info)();
669 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
671 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
675 get_font_info = dlsym(handle, "_get_default_font");
677 if ((error = dlerror()) != NULL) {
678 SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so.0.1.0");
683 ret = get_font_info();
690 /* LCOV_EXCL_START */
691 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
692 bool __is_supported_image_type_by_ext(char *file_path)
696 regmatch_t str[2048 + 1];
698 if (!file_path) return false;
701 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
702 SETTING_TRACE("regular expresstion fail");
707 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
708 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
711 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
717 #ifdef TIZEN_WEARABLE
718 /* LCOV_EXCL_START */
719 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
723 const char *find_str = "extended_wallpaper_";
726 if (!(ch = strstr(file_path, find_str))) {
727 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
729 strncpy(buffer, file_path, ch - file_path);
730 buffer[ch - file_path] = 0;
731 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
733 if (!isdigit(buffer[0])) {
734 SETTING_TRACE("%s is not number", buffer);
735 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
740 return SYSTEM_SETTINGS_ERROR_NONE;
744 /* LCOV_EXCL_START */
745 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
748 if (!source_file_path || !dest_file_path) {
749 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
755 fd = open(source_file_path, O_RDONLY);
757 SETTING_TRACE("file open failed: %s", source_file_path);
758 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
762 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
764 SETTING_TRACE("file creation failed: %s", dest_file_path);
766 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
769 while (read(fd, buf, sizeof(buf) - 1) > 0) {
770 write(fd2, buf, sizeof(buf) - 1);
776 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
777 SETTING_TRACE("chmod failed: %s", dest_file_path);
780 return SYSTEM_SETTINGS_ERROR_NONE;
784 /* LCOV_EXCL_START */
785 static int system_setting_remove_oldest_extended_wallpaper()
790 char *min_image_name = NULL;
791 unsigned int min_image_num = 0;
792 unsigned int temp_image_num = 0;
795 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
796 SETTING_TRACE("opendir error");
797 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
800 while ((dirp = readdir(dp))) {
801 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
804 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
805 != SYSTEM_SETTINGS_ERROR_NONE) {
806 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
809 if ((image_count == 0) || (min_image_num > temp_image_num)) {
810 min_image_num = temp_image_num;
811 min_image_name = dirp->d_name;
818 if (min_image_name) {
819 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
820 if (remove(buf) < 0) { /* remove oldest image */
821 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
825 return SYSTEM_SETTINGS_ERROR_NONE;
829 /* LCOV_EXCL_START */
830 static int system_setting_check_extended_wallpaper(const char *file_path)
834 if (!file_path || !strlen(file_path))
836 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
837 return (strstr(file_path, buffer) != NULL);
841 #define WALLPAPER_MAX_COUNT 10
843 /* LCOV_EXCL_START */
844 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
848 vconf_value = (char *)value;
850 bool isok = dl_is_supported_image_type_load(vconf_value);
853 SETTING_TRACE("path : %s is not supported file format", vconf_value);
854 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
856 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
859 /* error handling here */
860 if (_is_file_accessible(vconf_value) != 0)
861 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
863 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
864 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
868 #ifdef TIZEN_WEARABLE
869 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
872 unsigned int max_image_num = 0;
873 unsigned int temp_image_num = 0;
876 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
877 SETTING_TRACE("Setting - dir open error!");
878 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
881 /* Check a max number of wallpapers */
882 while ((dirp = readdir(dp))) {
883 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
886 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
887 != SYSTEM_SETTINGS_ERROR_NONE) {
890 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
893 if ((image_count == 0) || (max_image_num < temp_image_num)) {
894 max_image_num = temp_image_num;
902 /* Numbering rule: Gear is odd number */
903 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
906 char file_name_buffer[512];
907 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
908 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
910 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
911 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
912 != SYSTEM_SETTINGS_ERROR_NONE) {
913 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
916 /* remove oldest wallpaper */
917 if (image_count >= WALLPAPER_MAX_COUNT) {
918 if (system_setting_remove_oldest_extended_wallpaper()
919 != SYSTEM_SETTINGS_ERROR_NONE) {
920 remove(file_name_buffer);
921 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
925 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
926 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
929 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
930 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
931 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
934 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
935 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
940 return SYSTEM_SETTINGS_ERROR_NONE;
944 /* LCOV_EXCL_START */
945 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
949 vconf_value = (char *)value;
951 bool isok = dl_is_supported_image_type_load(vconf_value);
954 SETTING_TRACE("path : %s is not supported file format", vconf_value);
955 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
957 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
960 /* error handling here */
961 if (_is_file_accessible(vconf_value) != 0)
962 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
964 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
965 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
968 return SYSTEM_SETTINGS_ERROR_NONE;
972 /* LCOV_EXCL_START */
973 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
977 vconf_value = *(int **)value;
979 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
980 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
983 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
984 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
988 return SYSTEM_SETTINGS_ERROR_NONE;
994 /* LCOV_EXCL_START */
995 void *font_conf_doc_parse(char *doc_name, char *font_name)
998 xmlDocPtr doc = NULL;
999 xmlNodePtr cur = NULL;
1000 xmlNodePtr cur2 = NULL;
1001 xmlNodePtr cur3 = NULL;
1002 xmlChar *key = NULL;
1004 doc = xmlParseFile(doc_name);
1006 cur = xmlDocGetRootElement(doc);
1014 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1020 cur = cur->xmlChildrenNode;
1022 bool is_changed = false;
1023 while (cur != NULL) {
1024 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1025 cur2 = cur->xmlChildrenNode;
1026 while (cur2 != NULL) {
1027 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1028 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1029 /* if name is not 'family', break */
1030 if (xmlStrcmp(name, (const xmlChar *)"family")) {
1038 cur3 = cur2->xmlChildrenNode;
1039 while (cur3 != NULL) {
1040 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1041 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1042 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1052 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1053 cur2 = cur->xmlChildrenNode;
1054 while (cur2 != NULL) {
1055 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1056 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1057 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1061 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1062 cur3 = cur2->xmlChildrenNode;
1063 while (cur3 != NULL) {
1064 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1065 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1066 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1090 /* LCOV_EXCL_STOP */
1092 /* LCOV_EXCL_START */
1093 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1095 SETTING_TRACE_BEGIN;
1096 char *font_name = NULL;
1097 font_name = (char *)value;
1099 /* get current font list */
1100 int is_found = dl_is_available_font(font_name);
1103 SETTING_TRACE("found font : %s ", font_name);
1105 SETTING_TRACE(" NOT found font : %s ", font_name);
1106 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1109 bool bsave = dl_font_config_set(font_name);
1112 SETTING_TRACE(" font type save error by font_config_set() ");
1113 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1115 SETTING_TRACE(" save OK - font_config_set() ");
1118 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1120 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1125 dl_font_config_set_notification();
1128 vconf_value = (char *)value;
1130 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1131 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1133 return SYSTEM_SETTINGS_ERROR_NONE;
1135 /* LCOV_EXCL_STOP */
1137 /* LCOV_EXCL_START */
1138 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1140 SETTING_TRACE_BEGIN;
1142 vconf_value = (bool *)value;
1143 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1144 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1146 return SYSTEM_SETTINGS_ERROR_NONE;
1148 /* LCOV_EXCL_STOP */
1150 /* LCOV_EXCL_START */
1151 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1153 SETTING_TRACE_BEGIN;
1155 vconf_value = (bool *)value;
1156 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1157 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1159 return SYSTEM_SETTINGS_ERROR_NONE;
1162 /* LCOV_EXCL_STOP */
1164 /* LCOV_EXCL_START */
1165 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1167 SETTING_TRACE_BEGIN;
1169 vconf_value = (bool *)value;
1170 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1171 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1174 return SYSTEM_SETTINGS_ERROR_NONE;
1176 /* LCOV_EXCL_STOP */
1178 /* LCOV_EXCL_START */
1179 static int category_func(const char *name, void *user_data)
1181 SETTING_TRACE_BEGIN;
1182 static char *category = "lock-screen";
1183 if (name && !strcmp(name, category)) {
1184 SETTING_TRACE(" SAME ");
1187 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1193 /* LCOV_EXCL_STOP */
1197 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1201 /* LCOV_EXCL_START */
1202 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1204 SETTING_TRACE_BEGIN;
1206 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
1209 pkgmgrinfo_appinfo_h handle;
1210 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1211 if (r != PMINFO_R_OK) {
1212 SETTING_TRACE("*** pkginfo failed ");
1213 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1215 SETTING_TRACE("%x", handle);
1218 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1219 if (ret != PMINFO_R_OK) {
1220 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1221 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1224 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1225 /*----------------------------------------------------------------------------------- */
1227 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1228 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1231 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1232 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1234 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1235 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1238 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1239 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1240 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1243 return SYSTEM_SETTINGS_ERROR_NONE;
1245 /* LCOV_EXCL_STOP */
1247 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1250 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1252 SETTING_TRACE_BEGIN;
1253 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1256 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1258 SETTING_TRACE_BEGIN;
1259 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1262 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1264 SETTING_TRACE_BEGIN;
1265 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1268 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1270 SETTING_TRACE_BEGIN;
1271 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1274 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1276 SETTING_TRACE_BEGIN;
1277 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1280 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1282 SETTING_TRACE_BEGIN;
1283 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1286 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1288 SETTING_TRACE_BEGIN;
1289 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1292 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1294 SETTING_TRACE_BEGIN;
1295 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1298 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1300 SETTING_TRACE_BEGIN;
1301 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1304 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1306 SETTING_TRACE_BEGIN;
1307 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1310 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1312 SETTING_TRACE_BEGIN;
1313 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1316 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1318 SETTING_TRACE_BEGIN;
1319 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1322 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1324 SETTING_TRACE_BEGIN;
1325 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1328 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1330 SETTING_TRACE_BEGIN;
1331 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1334 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1336 SETTING_TRACE_BEGIN;
1337 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1340 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1342 SETTING_TRACE_BEGIN;
1343 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1348 * @todo need to add custom event notification method
1350 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1352 SETTING_TRACE_BEGIN;
1353 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1356 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1358 SETTING_TRACE_BEGIN;
1359 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1362 /* TODO : 2th argument, callback, is not in use. */
1363 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1365 SETTING_TRACE_BEGIN;
1366 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1369 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1371 SETTING_TRACE_BEGIN;
1372 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1375 /*//////////////////////////////////////////////////////////////////////////////////////// */
1376 /*--------------------------------------- */
1377 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1379 SETTING_TRACE_BEGIN;
1380 char *vconf_value = NULL;
1381 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1382 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1385 /* parsing validation */
1388 snprintf(arr, 20, "%s", vconf_value);
1390 *value = strdup(arr);
1394 return SYSTEM_SETTINGS_ERROR_NONE;
1397 /* LCOV_EXCL_START */
1398 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1400 SETTING_TRACE_BEGIN;
1401 char *vconf_value = NULL;
1402 vconf_value = (char *)value;
1404 char *ext = "UTF-8";
1407 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1409 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1410 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1412 return SYSTEM_SETTINGS_ERROR_NONE;
1414 /* LCOV_EXCL_STOP */
1416 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1418 SETTING_TRACE_BEGIN;
1419 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1422 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1424 SETTING_TRACE_BEGIN;
1425 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1429 /*--------------------------------------- */
1430 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1432 SETTING_TRACE_BEGIN;
1433 char *vconf_value = NULL;
1434 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1435 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1438 /* parsing validation */
1441 snprintf(arr, 20, "%s", vconf_value);
1443 *value = strdup(arr);
1446 return SYSTEM_SETTINGS_ERROR_NONE;
1449 /* LCOV_EXCL_START */
1450 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1452 SETTING_TRACE_BEGIN;
1453 char *vconf_value = NULL;
1454 vconf_value = (char *)value;
1456 char *ext = "UTF-8";
1459 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1461 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1462 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1464 return SYSTEM_SETTINGS_ERROR_NONE;
1466 /* LCOV_EXCL_STOP */
1468 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1470 SETTING_TRACE_BEGIN;
1471 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1472 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1475 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1477 SETTING_TRACE_BEGIN;
1478 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1481 /*--------------------------------------- */
1482 /* LCOV_EXCL_START */
1483 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1485 SETTING_TRACE_BEGIN;
1488 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1489 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1492 bool ret_value = true;
1493 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1495 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1498 *value = (void *)ret_value;
1500 return SYSTEM_SETTINGS_ERROR_NONE;
1502 /* LCOV_EXCL_STOP */
1504 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1506 SETTING_TRACE_BEGIN;
1509 vconf_value = (bool *)value;
1512 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1513 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1517 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1518 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1523 return SYSTEM_SETTINGS_ERROR_NONE;
1526 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1528 SETTING_TRACE_BEGIN;
1529 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1532 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1534 SETTING_TRACE_BEGIN;
1535 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1538 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1541 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1545 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1546 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1549 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1550 *value = strdup(&tzpath[20]);
1551 return SYSTEM_SETTINGS_ERROR_NONE;
1554 /* LCOV_EXCL_START */
1555 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1557 SETTING_TRACE_BEGIN;
1558 char *timezone_value = NULL;
1559 timezone_value = (char *)value;
1562 snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1564 int is_load = _is_file_accessible(tz_path);
1566 alarmmgr_set_timezone(tz_path);
1568 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1569 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1571 return SYSTEM_SETTINGS_ERROR_NONE;
1573 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1575 /* LCOV_EXCL_STOP */
1579 /* LCOV_EXCL_START */
1580 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1582 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1584 /* LCOV_EXCL_STOP */
1586 /* LCOV_EXCL_START */
1587 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1589 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1591 /* LCOV_EXCL_STOP */
1593 /* LCOV_EXCL_START */
1594 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1596 SETTING_TRACE_BEGIN;
1597 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1599 /* LCOV_EXCL_STOP */
1601 /* LCOV_EXCL_START */
1602 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1604 SETTING_TRACE_BEGIN;
1605 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1607 /* LCOV_EXCL_STOP */
1610 /* LCOV_EXCL_START */
1611 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1613 SETTING_TRACE_BEGIN;
1615 int ** val = (int**)value;
1616 cur_tick = time(NULL);
1618 /* struct tm * localtime = time (cur_tick); */
1619 /* printf("%s\n", ctime(&cur_tick); */
1620 return SYSTEM_SETTINGS_ERROR_NONE;
1623 /* LCOV_EXCL_STOP */
1625 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1627 SETTING_TRACE_BEGIN;
1628 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1631 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1633 SETTING_TRACE_BEGIN;
1634 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1639 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1640 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1642 SETTING_TRACE_BEGIN;
1645 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1646 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1648 *value = (void *)vconf_value;
1650 return SYSTEM_SETTINGS_ERROR_NONE;
1653 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1655 SETTING_TRACE_BEGIN;
1656 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1659 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1661 SETTING_TRACE_BEGIN;
1662 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1666 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1668 * a == false, b == false --> silent mode
1669 * a == true, b == false --> sound mode
1670 * a == false, b == true --> vibration mode
1672 /* LCOV_EXCL_START */
1673 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1675 SETTING_TRACE_BEGIN;
1680 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1681 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1684 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1685 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1688 if (sound_cond == false && vib_cond == false) {
1690 *value = (void *)vconf_value;
1692 vconf_value = false;
1693 *value = (void *)vconf_value;
1695 return SYSTEM_SETTINGS_ERROR_NONE;
1697 /* LCOV_EXCL_STOP */
1700 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1702 * a == false, b == false --> silent mode
1703 * a == true, b == false --> sound mode
1705 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1707 SETTING_TRACE_BEGIN;
1710 vconf_value = (bool *)value;
1712 bool vconf_sound = false;
1713 bool vconf_vib = false;
1716 vconf_sound = false;
1723 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1724 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1726 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1727 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1730 return SYSTEM_SETTINGS_ERROR_NONE;
1736 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1738 SETTING_TRACE_BEGIN;
1739 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1743 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1745 SETTING_TRACE_BEGIN;
1746 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1749 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1750 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1752 SETTING_TRACE_BEGIN;
1755 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1756 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1759 *value = (void *)vconf_value;
1763 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1765 SETTING_TRACE_BEGIN;
1766 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1769 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1771 SETTING_TRACE_BEGIN;
1772 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1776 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1777 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1781 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1782 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1784 *value = (void *)vconf_value;
1786 return SYSTEM_SETTINGS_ERROR_NONE;
1790 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1792 SETTING_TRACE_BEGIN;
1795 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1796 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1798 *value = (void *)vconf_value;
1800 return SYSTEM_SETTINGS_ERROR_NONE;
1803 /* LCOV_EXCL_START */
1804 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1806 SETTING_TRACE_BEGIN;
1808 vconf_value = (bool *)value;
1809 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1810 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1813 return SYSTEM_SETTINGS_ERROR_NONE;
1815 /* LCOV_EXCL_STOP */
1817 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1819 SETTING_TRACE_BEGIN;
1820 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1823 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1825 SETTING_TRACE_BEGIN;
1826 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1829 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1831 SETTING_TRACE_BEGIN;
1833 int ** val = (int**)value;
1835 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1836 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1838 **val = vconf_value;
1840 return SYSTEM_SETTINGS_ERROR_NONE;
1844 /* LCOV_EXCL_START */
1845 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1847 SETTING_TRACE_BEGIN;
1849 vconf_value = *(int **)value;
1851 if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1852 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1853 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1856 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1857 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1860 return SYSTEM_SETTINGS_ERROR_NONE;
1862 /* LCOV_EXCL_STOP */
1864 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1866 SETTING_TRACE_BEGIN;
1867 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
1870 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1872 SETTING_TRACE_BEGIN;
1873 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1876 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1878 SETTING_TRACE_BEGIN;
1879 char *vconf_value = NULL;
1880 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1881 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1884 *value = vconf_value;
1885 return SYSTEM_SETTINGS_ERROR_NONE;
1888 /* LCOV_EXCL_START */
1889 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1891 SETTING_TRACE_BEGIN;
1892 char *vconf_value = NULL;
1893 vconf_value = (char *)value;
1895 int is_load = _is_file_accessible(vconf_value);
1897 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1898 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1899 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1900 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1903 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1904 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1907 return SYSTEM_SETTINGS_ERROR_NONE;
1909 /* LCOV_EXCL_STOP */
1911 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1913 SETTING_TRACE_BEGIN;
1914 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
1917 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1919 SETTING_TRACE_BEGIN;
1920 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1923 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1925 SETTING_TRACE_BEGIN;
1926 int ** val = (int**)value;
1929 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1930 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1932 **val = vconf_value;
1934 return SYSTEM_SETTINGS_ERROR_NONE;
1937 /* LCOV_EXCL_START */
1938 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1940 SETTING_TRACE_BEGIN;
1942 vconf_value = *(int **)value;
1944 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1945 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1948 return SYSTEM_SETTINGS_ERROR_NONE;
1950 /* LCOV_EXCL_STOP */
1952 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1954 SETTING_TRACE_BEGIN;
1955 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);
1958 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1960 SETTING_TRACE_BEGIN;
1961 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1964 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1966 SETTING_TRACE_BEGIN;
1967 char *vconf_value = NULL;
1968 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1969 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1972 *value = vconf_value;
1973 return SYSTEM_SETTINGS_ERROR_NONE;
1976 /* LCOV_EXCL_START */
1977 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1979 SETTING_TRACE_BEGIN;
1980 char *vconf_value = NULL;
1981 vconf_value = (char *)value;
1983 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1984 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1987 return SYSTEM_SETTINGS_ERROR_NONE;
1989 /* LCOV_EXCL_STOP */
1991 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1993 SETTING_TRACE_BEGIN;
1994 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1997 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1999 SETTING_TRACE_BEGIN;
2000 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
2003 /*---------------------------------------------- */
2004 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2006 SETTING_TRACE_BEGIN;
2008 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
2009 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2011 *value = (void *)vconf_value;
2013 return SYSTEM_SETTINGS_ERROR_NONE;
2016 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2018 SETTING_TRACE_BEGIN;
2019 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
2022 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2024 SETTING_TRACE_BEGIN;
2025 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
2028 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2030 SETTING_TRACE_BEGIN;
2032 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2033 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2036 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2038 *value = (void *)bret;
2039 return SYSTEM_SETTINGS_ERROR_NONE;
2042 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2044 SETTING_TRACE_BEGIN;
2045 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
2048 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2050 SETTING_TRACE_BEGIN;
2051 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
2054 /* LCOV_EXCL_START */
2055 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2058 int ** val = (int**)value;
2060 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2061 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2063 **val = vconf_value;
2065 return SYSTEM_SETTINGS_ERROR_NONE;
2067 /* LCOV_EXCL_STOP */
2069 /* LCOV_EXCL_START */
2070 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2072 SETTING_TRACE_BEGIN;
2074 vconf_value = *(int **)value;
2076 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2077 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2080 return SYSTEM_SETTINGS_ERROR_NONE;
2082 /* LCOV_EXCL_STOP */
2084 /* LCOV_EXCL_START */
2085 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2087 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
2089 /* LCOV_EXCL_STOP */
2091 /* LCOV_EXCL_START */
2092 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2094 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
2096 /* LCOV_EXCL_STOP */
2098 //----------------------------------------------------------------------------------------------------------------------------
2100 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2102 int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2104 SETTING_TRACE_BEGIN;
2105 int optout_value = 0;
2106 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2107 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2110 if (optout_value == 1) {
2111 *value = strdup(DEFAULT_ADS_ID);
2112 return SYSTEM_SETTINGS_ERROR_NONE;
2115 char *vconf_value = NULL;
2116 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2117 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2120 *value = vconf_value;
2121 return SYSTEM_SETTINGS_ERROR_NONE;
2126 void make_ad_id(void)
2129 char uuid_unparsed[50] = {0};
2130 uuid_generate(uuid_value);
2131 uuid_unparse(uuid_value, uuid_unparsed);
2132 system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2135 /* LCOV_EXCL_START */
2136 int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2138 SETTING_TRACE_BEGIN;
2139 char *vconf_value = NULL;
2140 vconf_value = (char *)value;
2142 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
2143 SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
2144 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2147 return SYSTEM_SETTINGS_ERROR_NONE;
2149 /* LCOV_EXCL_STOP */
2151 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2153 SETTING_TRACE_BEGIN;
2154 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
2157 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2159 SETTING_TRACE_BEGIN;
2160 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);