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>
35 #include <libxml/xmlmemory.h>
36 #include <libxml/parser.h>
38 #include <fontconfig/fontconfig.h>
42 #include <pkgmgr-info.h>
44 #include <system_settings.h>
45 #include <system_settings_private.h>
47 #include <tzplatform_config.h>
50 #include <efl_assist.h>
53 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
54 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
56 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
57 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
58 #define SETTING_TZONE_SYMLINK_PATH "/etc/localtime"
61 int _is_file_accessible(const char *path);
63 bool dl_is_supported_image_type_load(char *path);
64 bool dl_font_config_set(char *font_name);
65 char *dl_get_font_info(char *str);
66 int dl_is_available_font(char *str);
67 void dl_font_size_set();
68 void dl_font_config_set_notification();
72 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
73 * @return the ringtone file path specified by user in normal case
74 * if it's not accessable, return the default ringtone path
76 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
80 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
81 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
84 /* check to see if it's accessable -> OK */
85 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
86 int is_load = _is_file_accessible(vconf_value);
89 } else { /* not zero on errro */
90 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
93 /**value = vconf_value; */
94 return SYSTEM_SETTINGS_ERROR_NONE;
98 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
102 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
103 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
106 /* check to see if it's accessable -> OK */
107 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
108 int is_load = _is_file_accessible(vconf_value);
110 *value = vconf_value;
111 } else { /* not zero on errro */
112 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
115 return SYSTEM_SETTINGS_ERROR_NONE;
119 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
123 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
124 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
126 *value = vconf_value;
127 return SYSTEM_SETTINGS_ERROR_NONE;
131 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
136 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
137 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
139 *value = vconf_value;
141 return SYSTEM_SETTINGS_ERROR_NONE;
145 /* [int] vconf GET */
146 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
151 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
152 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
154 *value = (void *)vconf_value;
156 return SYSTEM_SETTINGS_ERROR_NONE;
160 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
163 char *font_name = dl_get_font_info("default");
165 *value = (void *)font_name;
166 return SYSTEM_SETTINGS_ERROR_NONE;
168 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
172 /* [int] vconf GET */
173 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
176 char *font_name = dl_get_font_info("cur");
177 *value = (void *)font_name;
179 return SYSTEM_SETTINGS_ERROR_NONE;
183 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
188 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
189 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
191 *value = (void *)vconf_value;
193 return SYSTEM_SETTINGS_ERROR_NONE;
196 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
201 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
202 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
204 *value = (void *)vconf_value;
206 return SYSTEM_SETTINGS_ERROR_NONE;
209 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
214 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
215 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
217 *value = (void *)vconf_value;
219 return SYSTEM_SETTINGS_ERROR_NONE;
221 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
225 * get current lock scren app package name (string)
227 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
229 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
232 char *pkg_name = NULL;
234 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
236 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
237 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
240 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
241 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
245 return SYSTEM_SETTINGS_ERROR_NONE;
249 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
251 int _is_file_accessible(const char *path)
254 int ret = access(path , R_OK);
256 SETTING_TRACE("found the file %s", path);
259 /* error code : 13 */
260 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
265 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
269 vconf_value = (char *)value;
271 int ret = _is_file_accessible(vconf_value);
273 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
274 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
277 /* @todo add a common ret_handler */
281 return SYSTEM_SETTINGS_ERROR_NONE;
285 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
289 vconf_value = (char *)value;
291 int ret = _is_file_accessible(vconf_value);
293 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
294 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
297 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
298 /* @todo add a common ret_handler */
302 return SYSTEM_SETTINGS_ERROR_NONE;
305 bool dl_is_supported_image_type_load(char *path)
310 bool (*image_type_check)(char *path);
312 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
314 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
318 image_type_check = dlsym(handle, "__is_supported_image_type_load");
319 if ((error = dlerror()) != NULL) {
320 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
325 ret = image_type_check(path);
331 int dl_is_available_font(char *str)
336 int (*check_available_font)(char *font_name);
338 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
340 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
344 check_available_font = dlsym(handle, "__is_available_font");
345 if ((error = dlerror()) != NULL) {
346 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
351 ret = check_available_font(str);
357 void dl_font_size_set()
361 void (*set_font_size)();
363 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
365 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
369 set_font_size = dlsym(handle, "__font_size_set");
370 if ((error = dlerror()) != NULL) {
371 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
382 void dl_font_config_set_notification()
386 void (*set_font_nodification)();
388 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
390 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
394 set_font_nodification = dlsym(handle, "font_config_set_notification");
395 if ((error = dlerror()) != NULL) {
396 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
401 set_font_nodification();
407 bool dl_font_config_set(char *font_name)
412 bool (*check_font_type)(char *font_name);
414 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
416 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
420 check_font_type = dlsym(handle, "font_config_set");
421 if ((error = dlerror()) != NULL) {
422 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
427 ret = check_font_type(font_name);
433 char *dl_get_font_info(char *str)
438 char *(*get_font_info)();
440 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
442 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
446 if (strcmp(str, "cur") == 0)
447 get_font_info = dlsym(handle, "_get_cur_font");
449 get_font_info = dlsym(handle, "_get_default_font");
451 if ((error = dlerror()) != NULL) {
452 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
457 ret = get_font_info();
463 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
464 bool __is_supported_image_type_by_ext(char *file_path)
468 regmatch_t str[2048 + 1];
470 if (!file_path) return false;
473 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
474 SETTING_TRACE("regular expresstion fail");
479 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
480 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
483 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
488 #ifdef TIZEN_WEARABLE
489 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
493 const char *find_str = "extended_wallpaper_";
496 if (!(ch = strstr(file_path, find_str))) {
497 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
499 strncpy(buffer, file_path, ch - file_path);
500 buffer[ch - file_path] = 0;
501 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
503 if (!isdigit(buffer[0])) {
504 SETTING_TRACE("%s is not number", buffer);
505 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
510 return SYSTEM_SETTINGS_ERROR_NONE;
513 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
516 if (!source_file_path || !dest_file_path) {
517 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
523 fd = open(source_file_path, O_RDONLY);
525 SETTING_TRACE("file open failed: %s", source_file_path);
526 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
530 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
532 SETTING_TRACE("file creation failed: %s", dest_file_path);
534 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
537 while (read(fd, buf, sizeof(buf) - 1) > 0) {
538 write(fd2, buf, sizeof(buf) - 1);
544 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
545 SETTING_TRACE("chmod failed: %s", dest_file_path);
548 return SYSTEM_SETTINGS_ERROR_NONE;
551 static int system_setting_remove_oldest_extended_wallpaper()
556 char *min_image_name = NULL;
557 unsigned int min_image_num = 0;
558 unsigned int temp_image_num = 0;
561 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
562 SETTING_TRACE("opendir error");
563 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
566 while ((dirp = readdir(dp))) {
567 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
570 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
571 != SYSTEM_SETTINGS_ERROR_NONE) {
572 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
575 if ((image_count == 0) || (min_image_num > temp_image_num)) {
576 min_image_num = temp_image_num;
577 min_image_name = dirp->d_name;
584 if (min_image_name) {
585 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
586 if (remove(buf) < 0) { /* remove oldest image */
587 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
591 return SYSTEM_SETTINGS_ERROR_NONE;
594 static int system_setting_check_extended_wallpaper(const char *file_path)
598 if (!file_path || !strlen(file_path))
600 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
601 return (strstr(file_path, buffer) != NULL);
604 #define WALLPAPER_MAX_COUNT 10
607 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
611 vconf_value = (char *)value;
613 bool isok = dl_is_supported_image_type_load(vconf_value);
616 SETTING_TRACE("path : %s is not supported file format", vconf_value);
617 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
619 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
622 /* error handling here */
623 if (_is_file_accessible(vconf_value) != 0)
624 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
626 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
627 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
631 #ifdef TIZEN_WEARABLE
632 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
635 unsigned int max_image_num = 0;
636 unsigned int temp_image_num = 0;
639 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
640 SETTING_TRACE("Setting - dir open error!");
641 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
644 /* Check a max number of wallpapers */
645 while ((dirp = readdir(dp))) {
646 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
649 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
650 != SYSTEM_SETTINGS_ERROR_NONE) {
653 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
656 if ((image_count == 0) || (max_image_num < temp_image_num)) {
657 max_image_num = temp_image_num;
665 /* Numbering rule: Gear is odd number */
666 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
669 char file_name_buffer[512];
670 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
671 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
673 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
674 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
675 != SYSTEM_SETTINGS_ERROR_NONE) {
676 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
679 /* remove oldest wallpaper */
680 if (image_count >= WALLPAPER_MAX_COUNT) {
681 if (system_setting_remove_oldest_extended_wallpaper()
682 != SYSTEM_SETTINGS_ERROR_NONE) {
683 remove(file_name_buffer);
684 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
688 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
689 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
692 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
693 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
694 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
697 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
698 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
703 return SYSTEM_SETTINGS_ERROR_NONE;
706 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
710 vconf_value = (char *)value;
712 bool isok = dl_is_supported_image_type_load(vconf_value);
715 SETTING_TRACE("path : %s is not supported file format", vconf_value);
716 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
718 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
721 /* error handling here */
722 if (_is_file_accessible(vconf_value) != 0)
723 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
725 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
726 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
729 return SYSTEM_SETTINGS_ERROR_NONE;
732 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
736 vconf_value = (int *)value;
738 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
739 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
742 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
743 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
747 return SYSTEM_SETTINGS_ERROR_NONE;
752 void *font_conf_doc_parse(char *doc_name, char *font_name)
755 xmlDocPtr doc = NULL;
756 xmlNodePtr cur = NULL;
757 xmlNodePtr cur2 = NULL;
758 xmlNodePtr cur3 = NULL;
761 doc = xmlParseFile(doc_name);
763 cur = xmlDocGetRootElement(doc);
771 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
777 cur = cur->xmlChildrenNode;
779 bool is_changed = false;
780 while (cur != NULL) {
781 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
782 cur2 = cur->xmlChildrenNode;
783 while (cur2 != NULL) {
784 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
785 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
786 /* if name is not 'family', break */
787 if (xmlStrcmp(name, (const xmlChar *)"family")) {
795 cur3 = cur2->xmlChildrenNode;
796 while (cur3 != NULL) {
797 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
798 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
799 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
809 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
810 cur2 = cur->xmlChildrenNode;
811 while (cur2 != NULL) {
812 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
813 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
814 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
818 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
819 cur3 = cur2->xmlChildrenNode;
820 while (cur3 != NULL) {
821 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
822 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
823 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
848 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
851 char *font_name = NULL;
852 font_name = (char *)value;
854 /* get current font list */
855 int is_found = dl_is_available_font(font_name);
858 SETTING_TRACE("found font : %s ", font_name);
860 SETTING_TRACE(" NOT found font : %s ", font_name);
861 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
864 bool bsave = dl_font_config_set(font_name);
867 SETTING_TRACE(" font type save error by font_config_set() ");
868 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
870 SETTING_TRACE(" save OK - font_config_set() ");
873 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
875 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
880 dl_font_config_set_notification();
883 vconf_value = (char *)value;
885 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
886 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
888 return SYSTEM_SETTINGS_ERROR_NONE;
891 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
895 vconf_value = (bool *)value;
896 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
897 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
899 return SYSTEM_SETTINGS_ERROR_NONE;
902 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
906 vconf_value = (bool *)value;
907 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
908 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
910 return SYSTEM_SETTINGS_ERROR_NONE;
914 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
918 vconf_value = (bool *)value;
919 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
920 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
923 return SYSTEM_SETTINGS_ERROR_NONE;
926 static int category_func(const char *name, void *user_data)
929 static char *category = "lock-screen";
930 if (name && !strcmp(name, category)) {
931 SETTING_TRACE(" SAME ");
934 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
943 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
946 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
950 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
953 pkgmgrinfo_appinfo_h handle;
954 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
955 if (r != PMINFO_R_OK) {
956 SETTING_TRACE("*** pkginfo failed ");
957 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
959 SETTING_TRACE("%x", handle);
962 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
963 if (ret != PMINFO_R_OK) {
964 pkgmgrinfo_appinfo_destroy_appinfo(handle);
965 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
968 pkgmgrinfo_appinfo_destroy_appinfo(handle);
969 /*----------------------------------------------------------------------------------- */
971 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
972 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
975 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
976 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
978 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
979 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
982 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
983 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
984 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
987 return SYSTEM_SETTINGS_ERROR_NONE;
990 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
993 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
996 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
999 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1001 SETTING_TRACE_BEGIN;
1002 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1005 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1007 SETTING_TRACE_BEGIN;
1008 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1011 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1013 SETTING_TRACE_BEGIN;
1014 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1017 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1019 SETTING_TRACE_BEGIN;
1020 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1023 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1025 SETTING_TRACE_BEGIN;
1026 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1029 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1031 SETTING_TRACE_BEGIN;
1032 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1035 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1037 SETTING_TRACE_BEGIN;
1038 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1041 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1043 SETTING_TRACE_BEGIN;
1044 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1047 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1049 SETTING_TRACE_BEGIN;
1050 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1053 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1055 SETTING_TRACE_BEGIN;
1056 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1059 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1061 SETTING_TRACE_BEGIN;
1062 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1065 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1067 SETTING_TRACE_BEGIN;
1068 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1071 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1073 SETTING_TRACE_BEGIN;
1074 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1077 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1079 SETTING_TRACE_BEGIN;
1080 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1083 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1085 SETTING_TRACE_BEGIN;
1086 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1091 * @todo need to add custom event notification method
1093 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1095 SETTING_TRACE_BEGIN;
1096 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1099 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1101 SETTING_TRACE_BEGIN;
1102 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1105 /* TODO : 2th argument, callback, is not in use. */
1106 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1108 SETTING_TRACE_BEGIN;
1109 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1112 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1114 SETTING_TRACE_BEGIN;
1115 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1118 /*//////////////////////////////////////////////////////////////////////////////////////// */
1119 /*--------------------------------------- */
1120 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1122 SETTING_TRACE_BEGIN;
1123 char *vconf_value = NULL;
1124 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1125 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1128 /* parsing validation */
1131 snprintf(arr, 20, "%s", vconf_value);
1133 *value = strdup(arr);
1137 return SYSTEM_SETTINGS_ERROR_NONE;
1140 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1142 SETTING_TRACE_BEGIN;
1143 char *vconf_value = NULL;
1144 vconf_value = (char *)value;
1146 char *ext = "UTF-8";
1149 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1151 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1152 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1154 return SYSTEM_SETTINGS_ERROR_NONE;
1157 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1159 SETTING_TRACE_BEGIN;
1160 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1163 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1165 SETTING_TRACE_BEGIN;
1166 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1170 /*--------------------------------------- */
1171 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1173 SETTING_TRACE_BEGIN;
1174 char *vconf_value = NULL;
1175 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1176 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1179 /* parsing validation */
1182 snprintf(arr, 20, "%s", vconf_value);
1184 *value = strdup(arr);
1187 return SYSTEM_SETTINGS_ERROR_NONE;
1190 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1192 SETTING_TRACE_BEGIN;
1193 char *vconf_value = NULL;
1194 vconf_value = (char *)value;
1196 char *ext = "UTF-8";
1199 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1201 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1202 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1204 return SYSTEM_SETTINGS_ERROR_NONE;
1207 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1209 SETTING_TRACE_BEGIN;
1210 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1211 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1214 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1216 SETTING_TRACE_BEGIN;
1217 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1220 /*--------------------------------------- */
1221 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1223 SETTING_TRACE_BEGIN;
1226 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1227 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1230 bool ret_value = true;
1231 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1233 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1236 *value = (void *)ret_value;
1238 return SYSTEM_SETTINGS_ERROR_NONE;
1241 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1243 SETTING_TRACE_BEGIN;
1246 vconf_value = (bool *)value;
1249 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1250 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1254 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1255 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1260 return SYSTEM_SETTINGS_ERROR_NONE;
1263 int system_setting_set_changed_callback_locale_timeformat_24hour(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_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1269 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1271 SETTING_TRACE_BEGIN;
1272 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1275 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1277 SETTING_TRACE_BEGIN;
1278 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1279 return SYSTEM_SETTINGS_ERROR_NONE;
1282 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1284 SETTING_TRACE_BEGIN;
1285 char *vconf_value = NULL;
1286 vconf_value = (char *)value;
1289 sprintf(tz_path, "/usr/share/zoneinfo/%s", vconf_value);
1291 int is_load = _is_file_accessible(tz_path);
1293 alarmmgr_set_timezone(tz_path);
1295 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
1296 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1298 return SYSTEM_SETTINGS_ERROR_NONE;
1300 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1305 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1307 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1310 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1312 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1315 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1317 SETTING_TRACE_BEGIN;
1318 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1321 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1323 SETTING_TRACE_BEGIN;
1324 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1328 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1330 SETTING_TRACE_BEGIN;
1332 cur_tick = time(NULL);
1333 *value = (void *)cur_tick;
1334 /* struct tm * localtime = time (cur_tick); */
1335 /* printf("%s\n", ctime(&cur_tick); */
1336 return SYSTEM_SETTINGS_ERROR_NONE;
1340 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1342 SETTING_TRACE_BEGIN;
1343 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1346 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1348 SETTING_TRACE_BEGIN;
1349 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1354 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1355 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1357 SETTING_TRACE_BEGIN;
1360 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1361 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1363 *value = (void *)vconf_value;
1365 return SYSTEM_SETTINGS_ERROR_NONE;
1368 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1370 SETTING_TRACE_BEGIN;
1371 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1374 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1376 SETTING_TRACE_BEGIN;
1377 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1381 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1383 * a == false, b == false --> silent mode
1384 * a == true, b == false --> sound mode
1385 * a == false, b == true --> vibration mode
1387 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1389 SETTING_TRACE_BEGIN;
1394 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1395 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1398 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1399 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1402 if (sound_cond == false && vib_cond == false) {
1404 *value = (void *)vconf_value;
1406 vconf_value = false;
1407 *value = (void *)vconf_value;
1409 return SYSTEM_SETTINGS_ERROR_NONE;
1413 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1415 * a == false, b == false --> silent mode
1416 * a == true, b == false --> sound mode
1418 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1420 SETTING_TRACE_BEGIN;
1423 vconf_value = (bool *)value;
1425 bool vconf_sound = false;
1426 bool vconf_vib = false;
1429 vconf_sound = false;
1436 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1437 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1439 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1440 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1443 return SYSTEM_SETTINGS_ERROR_NONE;
1449 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1451 SETTING_TRACE_BEGIN;
1452 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1456 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1458 SETTING_TRACE_BEGIN;
1459 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1462 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1463 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1465 SETTING_TRACE_BEGIN;
1468 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1469 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1472 *value = (void *)vconf_value;
1476 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1478 SETTING_TRACE_BEGIN;
1479 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1482 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1484 SETTING_TRACE_BEGIN;
1485 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1489 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1490 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1494 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1495 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1497 *value = (void *)vconf_value;
1499 return SYSTEM_SETTINGS_ERROR_NONE;
1503 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1505 SETTING_TRACE_BEGIN;
1508 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1509 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1511 *value = (void *)vconf_value;
1513 return SYSTEM_SETTINGS_ERROR_NONE;
1516 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1518 SETTING_TRACE_BEGIN;
1520 vconf_value = (bool *)value;
1521 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1522 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1525 return SYSTEM_SETTINGS_ERROR_NONE;
1528 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1530 SETTING_TRACE_BEGIN;
1531 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1534 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1536 SETTING_TRACE_BEGIN;
1537 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1540 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1542 SETTING_TRACE_BEGIN;
1545 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1546 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1548 *value = (void *)vconf_value;
1550 return SYSTEM_SETTINGS_ERROR_NONE;
1554 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1556 SETTING_TRACE_BEGIN;
1558 vconf_value = (int *)value;
1560 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1561 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1562 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1565 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1566 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1569 return SYSTEM_SETTINGS_ERROR_NONE;
1572 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1574 SETTING_TRACE_BEGIN;
1575 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1578 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1580 SETTING_TRACE_BEGIN;
1581 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1584 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1586 SETTING_TRACE_BEGIN;
1587 char *vconf_value = NULL;
1588 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1589 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1592 *value = vconf_value;
1593 return SYSTEM_SETTINGS_ERROR_NONE;
1596 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1598 SETTING_TRACE_BEGIN;
1599 char *vconf_value = NULL;
1600 vconf_value = (char *)value;
1602 int is_load = _is_file_accessible(vconf_value);
1604 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1605 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1608 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1611 return SYSTEM_SETTINGS_ERROR_NONE;
1614 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1616 SETTING_TRACE_BEGIN;
1617 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1620 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1622 SETTING_TRACE_BEGIN;
1623 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1626 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1628 SETTING_TRACE_BEGIN;
1631 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1632 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1634 *value = (void *)vconf_value;
1636 return SYSTEM_SETTINGS_ERROR_NONE;
1639 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1641 SETTING_TRACE_BEGIN;
1643 vconf_value = (int *)value;
1645 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1646 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1649 return SYSTEM_SETTINGS_ERROR_NONE;
1652 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1654 SETTING_TRACE_BEGIN;
1655 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);
1658 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1660 SETTING_TRACE_BEGIN;
1661 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1664 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1666 SETTING_TRACE_BEGIN;
1667 char *vconf_value = NULL;
1668 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1669 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1672 *value = vconf_value;
1673 return SYSTEM_SETTINGS_ERROR_NONE;
1676 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1678 SETTING_TRACE_BEGIN;
1679 char *vconf_value = NULL;
1680 vconf_value = (char *)value;
1682 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1683 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1686 return SYSTEM_SETTINGS_ERROR_NONE;
1689 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1691 SETTING_TRACE_BEGIN;
1692 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1695 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1697 SETTING_TRACE_BEGIN;
1698 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1701 /*---------------------------------------------- */
1702 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1704 SETTING_TRACE_BEGIN;
1706 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1707 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1709 *value = (void *)vconf_value;
1711 return SYSTEM_SETTINGS_ERROR_NONE;
1714 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1716 SETTING_TRACE_BEGIN;
1717 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1720 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1722 SETTING_TRACE_BEGIN;
1723 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1726 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1728 SETTING_TRACE_BEGIN;
1730 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1731 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1734 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1736 *value = (void *)bret;
1737 return SYSTEM_SETTINGS_ERROR_NONE;
1740 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1742 SETTING_TRACE_BEGIN;
1743 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1746 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1748 SETTING_TRACE_BEGIN;
1749 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1752 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1756 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1757 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1759 *value = (void *)vconf_value;
1761 return SYSTEM_SETTINGS_ERROR_NONE;
1764 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1766 SETTING_TRACE_BEGIN;
1768 vconf_value = (int *)value;
1770 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1771 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1774 return SYSTEM_SETTINGS_ERROR_NONE;
1777 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1779 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1782 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1784 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);