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>
40 #include <pkgmgr-info.h>
42 #include <system_settings.h>
43 #include <system_settings_private.h>
45 #include <tzplatform_config.h>
48 #include <efl_assist.h>
51 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
52 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
54 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
55 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
56 #define SETTING_TZONE_SYMLINK_PATH "/etc/localtime"
59 int _is_file_accessible(const char *path);
61 bool dl_is_supported_image_type_load(char *path);
62 bool dl_font_config_set(char *font_name);
63 char *dl_get_font_info(char *str);
64 int *dl_is_available_font(char *str);
65 void dl_font_size_set();
66 void dl_font_config_set_notification();
70 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
71 * @return the ringtone file path specified by user in normal case
72 * if it's not accessable, return the default ringtone path
74 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
78 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
79 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
82 /* check to see if it's accessable -> OK */
83 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
84 int is_load = _is_file_accessible(vconf_value);
87 } else { /* not zero on errro */
88 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
91 /**value = vconf_value; */
92 return SYSTEM_SETTINGS_ERROR_NONE;
96 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
100 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
101 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
104 /* check to see if it's accessable -> OK */
105 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
106 int is_load = _is_file_accessible(vconf_value);
108 *value = vconf_value;
109 } else { /* not zero on errro */
110 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
113 return SYSTEM_SETTINGS_ERROR_NONE;
117 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
121 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
122 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
124 *value = vconf_value;
125 return SYSTEM_SETTINGS_ERROR_NONE;
129 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
134 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
135 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
137 *value = vconf_value;
139 return SYSTEM_SETTINGS_ERROR_NONE;
143 /* [int] vconf GET */
144 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
149 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
150 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
152 *value = (void *)vconf_value;
154 return SYSTEM_SETTINGS_ERROR_NONE;
158 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
161 char *font_name = dl_get_font_info("default");
163 *value = (void *)font_name;
164 return SYSTEM_SETTINGS_ERROR_NONE;
166 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
170 /* [int] vconf GET */
171 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
174 char *font_name = dl_get_font_info("cur");
175 *value = (void *)font_name;
177 return SYSTEM_SETTINGS_ERROR_NONE;
181 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
186 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
187 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
189 *value = (void *)vconf_value;
191 return SYSTEM_SETTINGS_ERROR_NONE;
194 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
199 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
200 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
202 *value = (void *)vconf_value;
204 return SYSTEM_SETTINGS_ERROR_NONE;
207 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
212 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
213 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
215 *value = (void *)vconf_value;
217 return SYSTEM_SETTINGS_ERROR_NONE;
219 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
223 * get current lock scren app package name (string)
225 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
227 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
230 char *pkg_name = NULL;
232 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
234 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
235 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
238 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
239 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
243 return SYSTEM_SETTINGS_ERROR_NONE;
247 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
249 int _is_file_accessible(const char *path)
252 int ret = access(path , R_OK);
254 SETTING_TRACE("found the file %s", path);
257 /* error code : 13 */
258 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
263 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
267 vconf_value = (char *)value;
269 int ret = _is_file_accessible(vconf_value);
271 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
272 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
275 /* @todo add a common ret_handler */
279 return SYSTEM_SETTINGS_ERROR_NONE;
283 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
287 vconf_value = (char *)value;
289 int ret = _is_file_accessible(vconf_value);
291 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
292 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
295 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
296 /* @todo add a common ret_handler */
300 return SYSTEM_SETTINGS_ERROR_NONE;
303 bool dl_is_supported_image_type_load(char *path)
308 bool (*image_type_check)(char *path);
310 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
313 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
317 image_type_check = dlsym(handle, "__is_supported_image_type_load");
318 if((error = dlerror()) != NULL) {
319 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
322 ret = image_type_check(path);
327 int *dl_is_available_font(char *str)
332 int (*check_available_font)(char *font_name);
334 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
337 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
341 check_available_font = dlsym(handle, "_is_available_font");
342 if((error = dlerror()) != NULL) {
343 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
346 ret = check_available_font(str);
351 void dl_font_size_set()
355 void (*set_font_size)();
357 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
360 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
364 set_font_size = dlsym(handle, "__font_size_set");
365 if((error = dlerror()) != NULL) {
366 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
374 void dl_font_config_set_notification()
378 void (*set_font_nodification)();
380 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
383 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
387 set_font_nodification = dlsym(handle, "font_config_set_notification");
388 if((error = dlerror()) != NULL) {
389 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
392 set_font_nodification();
397 bool dl_font_config_set(char *font_name)
402 bool (*check_font_type)(char *font_name);
404 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
407 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
411 check_font_type = dlsym(handle, "font_config_set");
412 if((error = dlerror()) != NULL) {
413 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
416 ret = check_font_type(font_name);
421 char *dl_get_font_info(char *str)
426 char *(*get_font_info)();
428 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
431 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
435 if(strcmp(str,"cur") == 0)
436 get_font_info = dlsym(handle, "_get_cur_font");
438 get_font_info = dlsym(handle, "_get_default_font");
440 if((error = dlerror()) != NULL) {
441 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
444 ret = get_font_info();
449 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
450 bool __is_supported_image_type_by_ext(char *file_path)
454 regmatch_t str[2048 + 1];
456 if (!file_path) return false;
459 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
460 SETTING_TRACE("regular expresstion fail");
465 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
466 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
469 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
474 #ifdef TIZEN_WEARABLE
475 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
479 const char *find_str = "extended_wallpaper_";
482 if (!(ch = strstr(file_path, find_str))) {
483 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
485 strncpy(buffer, file_path, ch - file_path);
486 buffer[ch - file_path] = 0;
487 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
489 if (!isdigit(buffer[0])) {
490 SETTING_TRACE("%s is not number", buffer);
491 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
496 return SYSTEM_SETTINGS_ERROR_NONE;
499 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
502 if (!source_file_path || !dest_file_path) {
503 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
509 fd = open(source_file_path, O_RDONLY);
511 SETTING_TRACE("file open failed: %s", source_file_path);
512 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
516 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
518 SETTING_TRACE("file creation failed: %s", dest_file_path);
520 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
523 while (read(fd, buf, sizeof(buf) - 1) > 0) {
524 write(fd2, buf, sizeof(buf) - 1);
530 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
531 SETTING_TRACE("chmod failed: %s", dest_file_path);
534 return SYSTEM_SETTINGS_ERROR_NONE;
537 static int system_setting_remove_oldest_extended_wallpaper()
542 char *min_image_name = NULL;
543 unsigned int min_image_num = 0;
544 unsigned int temp_image_num = 0;
547 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
548 SETTING_TRACE("opendir error");
549 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
552 while ((dirp = readdir(dp))) {
553 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
556 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
557 != SYSTEM_SETTINGS_ERROR_NONE) {
558 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
561 if ((image_count == 0) || (min_image_num > temp_image_num)) {
562 min_image_num = temp_image_num;
563 min_image_name = dirp->d_name;
570 if (min_image_name) {
571 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
572 if (remove(buf) < 0) { /* remove oldest image */
573 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
577 return SYSTEM_SETTINGS_ERROR_NONE;
580 static int system_setting_check_extended_wallpaper(const char *file_path)
584 if (!file_path || !strlen(file_path))
586 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
587 return (strstr(file_path, buffer) != NULL);
590 #define WALLPAPER_MAX_COUNT 10
593 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
597 vconf_value = (char *)value;
599 bool isok = dl_is_supported_image_type_load(vconf_value);
602 SETTING_TRACE("path : %s is not supported file format", vconf_value);
603 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
605 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
608 /* error handling here */
609 if (_is_file_accessible(vconf_value) != 0)
610 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
612 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
613 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
617 #ifdef TIZEN_WEARABLE
618 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
621 unsigned int max_image_num = 0;
622 unsigned int temp_image_num = 0;
625 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
626 SETTING_TRACE("Setting - dir open error!");
627 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
630 /* Check a max number of wallpapers */
631 while ((dirp = readdir(dp))) {
632 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
635 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
636 != SYSTEM_SETTINGS_ERROR_NONE) {
639 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
642 if ((image_count == 0) || (max_image_num < temp_image_num)) {
643 max_image_num = temp_image_num;
651 /* Numbering rule: Gear is odd number */
652 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
655 char file_name_buffer[512];
656 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
657 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
659 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
660 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
661 != SYSTEM_SETTINGS_ERROR_NONE) {
662 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
665 /* remove oldest wallpaper */
666 if (image_count >= WALLPAPER_MAX_COUNT) {
667 if (system_setting_remove_oldest_extended_wallpaper()
668 != SYSTEM_SETTINGS_ERROR_NONE) {
669 remove(file_name_buffer);
670 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
674 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
675 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
678 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
679 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
680 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
683 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
684 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
689 return SYSTEM_SETTINGS_ERROR_NONE;
692 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
696 vconf_value = (char *)value;
698 bool isok = dl_is_supported_image_type_load(vconf_value);
701 SETTING_TRACE("path : %s is not supported file format", vconf_value);
702 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
704 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
707 /* error handling here */
708 if (_is_file_accessible(vconf_value) != 0)
709 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
711 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
712 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
715 return SYSTEM_SETTINGS_ERROR_NONE;
718 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
722 vconf_value = (int *)value;
724 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
725 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
728 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
729 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
733 return SYSTEM_SETTINGS_ERROR_NONE;
738 void *font_conf_doc_parse(char *doc_name, char *font_name)
741 xmlDocPtr doc = NULL;
742 xmlNodePtr cur = NULL;
743 xmlNodePtr cur2 = NULL;
744 xmlNodePtr cur3 = NULL;
747 doc = xmlParseFile(doc_name);
749 cur = xmlDocGetRootElement(doc);
757 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
763 cur = cur->xmlChildrenNode;
765 bool is_changed = false;
766 while (cur != NULL) {
767 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
768 cur2 = cur->xmlChildrenNode;
769 while (cur2 != NULL) {
770 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
771 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
772 /* if name is not 'family', break */
773 if (xmlStrcmp(name, (const xmlChar *)"family")) {
781 cur3 = cur2->xmlChildrenNode;
782 while (cur3 != NULL) {
783 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
784 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
785 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
795 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
796 cur2 = cur->xmlChildrenNode;
797 while (cur2 != NULL) {
798 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
799 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
800 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
804 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
805 cur3 = cur2->xmlChildrenNode;
806 while (cur3 != NULL) {
807 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
808 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
809 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
834 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
837 char *font_name = NULL;
838 font_name = (char *)value;
840 /* get current font list */
841 int is_found = dl_is_available_font(font_name);
844 SETTING_TRACE("found font : %s ", font_name);
846 SETTING_TRACE(" NOT found font : %s ", font_name);
847 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
850 bool bsave = dl_font_config_set(font_name);
853 SETTING_TRACE(" font type save error by font_config_set() ");
854 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
856 SETTING_TRACE(" save OK - font_config_set() ");
859 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
861 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
866 dl_font_config_set_notification();
869 vconf_value = (char *)value;
871 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
872 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
874 return SYSTEM_SETTINGS_ERROR_NONE;
877 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
881 vconf_value = (bool *)value;
882 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
883 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
885 return SYSTEM_SETTINGS_ERROR_NONE;
888 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
892 vconf_value = (bool *)value;
893 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
894 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
896 return SYSTEM_SETTINGS_ERROR_NONE;
900 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
904 vconf_value = (bool *)value;
905 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
906 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
909 return SYSTEM_SETTINGS_ERROR_NONE;
912 static int category_func(const char *name, void *user_data)
915 static char *category = "lock-screen";
916 if (name && !strcmp(name, category)) {
917 SETTING_TRACE(" SAME ");
920 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
929 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
932 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
936 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
939 pkgmgrinfo_appinfo_h handle;
940 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
941 if (r != PMINFO_R_OK) {
942 SETTING_TRACE("*** pkginfo failed ");
943 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
945 SETTING_TRACE("%x", handle);
948 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
949 if (ret != PMINFO_R_OK) {
950 pkgmgrinfo_appinfo_destroy_appinfo(handle);
951 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
954 pkgmgrinfo_appinfo_destroy_appinfo(handle);
955 /*----------------------------------------------------------------------------------- */
957 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
958 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
961 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
962 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
964 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
965 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
968 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
969 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
970 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
973 return SYSTEM_SETTINGS_ERROR_NONE;
976 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
979 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
982 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
985 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
988 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
991 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
994 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
997 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1000 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1003 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1005 SETTING_TRACE_BEGIN;
1006 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1009 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1011 SETTING_TRACE_BEGIN;
1012 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1015 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1017 SETTING_TRACE_BEGIN;
1018 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1021 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1023 SETTING_TRACE_BEGIN;
1024 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1027 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1029 SETTING_TRACE_BEGIN;
1030 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1033 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1035 SETTING_TRACE_BEGIN;
1036 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1039 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1041 SETTING_TRACE_BEGIN;
1042 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1045 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1047 SETTING_TRACE_BEGIN;
1048 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1051 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1053 SETTING_TRACE_BEGIN;
1054 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1057 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1059 SETTING_TRACE_BEGIN;
1060 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1063 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1065 SETTING_TRACE_BEGIN;
1066 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1069 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1071 SETTING_TRACE_BEGIN;
1072 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1077 * @todo need to add custom event notification method
1079 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1081 SETTING_TRACE_BEGIN;
1082 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1085 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1087 SETTING_TRACE_BEGIN;
1088 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1091 /* TODO : 2th argument, callback, is not in use. */
1092 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1094 SETTING_TRACE_BEGIN;
1095 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1098 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1100 SETTING_TRACE_BEGIN;
1101 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1104 /*//////////////////////////////////////////////////////////////////////////////////////// */
1105 /*--------------------------------------- */
1106 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1108 SETTING_TRACE_BEGIN;
1109 char *vconf_value = NULL;
1110 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1111 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1114 /* parsing validation */
1117 snprintf(arr, 20, "%s", vconf_value);
1119 *value = strdup(arr);
1123 return SYSTEM_SETTINGS_ERROR_NONE;
1126 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1128 SETTING_TRACE_BEGIN;
1129 char *vconf_value = NULL;
1130 vconf_value = (char *)value;
1132 char *ext = "UTF-8";
1135 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1137 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1138 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1140 return SYSTEM_SETTINGS_ERROR_NONE;
1143 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1145 SETTING_TRACE_BEGIN;
1146 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1149 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1151 SETTING_TRACE_BEGIN;
1152 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1156 /*--------------------------------------- */
1157 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1159 SETTING_TRACE_BEGIN;
1160 char *vconf_value = NULL;
1161 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1162 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1165 /* parsing validation */
1168 snprintf(arr, 20, "%s", vconf_value);
1170 *value = strdup(arr);
1173 return SYSTEM_SETTINGS_ERROR_NONE;
1176 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1178 SETTING_TRACE_BEGIN;
1179 char *vconf_value = NULL;
1180 vconf_value = (char *)value;
1182 char *ext = "UTF-8";
1185 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1187 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1188 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1190 return SYSTEM_SETTINGS_ERROR_NONE;
1193 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1195 SETTING_TRACE_BEGIN;
1196 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1197 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1200 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1202 SETTING_TRACE_BEGIN;
1203 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1206 /*--------------------------------------- */
1207 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1209 SETTING_TRACE_BEGIN;
1212 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1213 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1216 bool ret_value = true;
1217 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1219 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1222 *value = (void *)ret_value;
1224 return SYSTEM_SETTINGS_ERROR_NONE;
1227 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1229 SETTING_TRACE_BEGIN;
1232 vconf_value = (bool *)value;
1235 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1236 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1240 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1241 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1246 return SYSTEM_SETTINGS_ERROR_NONE;
1249 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1251 SETTING_TRACE_BEGIN;
1252 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1255 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1257 SETTING_TRACE_BEGIN;
1258 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1261 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1263 SETTING_TRACE_BEGIN;
1266 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
1270 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1271 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1273 /* "/usr/share/zoneinfo/Asia/Seoul" */
1274 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1275 *value = strdup(&tzpath[20]);
1277 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1279 return SYSTEM_SETTINGS_ERROR_NONE;
1282 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1284 SETTING_TRACE_BEGIN;
1285 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1288 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1290 SETTING_TRACE_BEGIN;
1291 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1295 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1297 SETTING_TRACE_BEGIN;
1299 cur_tick = time(NULL);
1300 *value = (void *)cur_tick;
1301 /* struct tm * localtime = time (cur_tick); */
1302 /* printf("%s\n", ctime(&cur_tick); */
1303 return SYSTEM_SETTINGS_ERROR_NONE;
1307 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1309 SETTING_TRACE_BEGIN;
1310 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1313 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1315 SETTING_TRACE_BEGIN;
1316 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1321 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1322 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1324 SETTING_TRACE_BEGIN;
1327 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1328 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1330 *value = (void *)vconf_value;
1332 return SYSTEM_SETTINGS_ERROR_NONE;
1335 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1337 SETTING_TRACE_BEGIN;
1338 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1341 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1343 SETTING_TRACE_BEGIN;
1344 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1348 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1350 * a == false, b == false --> silent mode
1351 * a == true, b == false --> sound mode
1352 * a == false, b == true --> vibration mode
1354 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1356 SETTING_TRACE_BEGIN;
1361 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1362 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1365 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1366 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1369 if (sound_cond == false && vib_cond == false) {
1371 *value = (void *)vconf_value;
1373 vconf_value = false;
1374 *value = (void *)vconf_value;
1376 return SYSTEM_SETTINGS_ERROR_NONE;
1380 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1382 * a == false, b == false --> silent mode
1383 * a == true, b == false --> sound mode
1385 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1387 SETTING_TRACE_BEGIN;
1390 vconf_value = (bool *)value;
1392 bool vconf_sound = false;
1393 bool vconf_vib = false;
1396 vconf_sound = false;
1403 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1404 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1406 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1407 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1410 return SYSTEM_SETTINGS_ERROR_NONE;
1416 int system_setting_set_changed_callback_sound_silent_mode(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_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1423 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1425 SETTING_TRACE_BEGIN;
1426 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1429 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1430 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1432 SETTING_TRACE_BEGIN;
1435 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1436 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1439 *value = (void *)vconf_value;
1443 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1445 SETTING_TRACE_BEGIN;
1446 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1449 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1451 SETTING_TRACE_BEGIN;
1452 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1456 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1457 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1461 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1462 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1464 *value = (void *)vconf_value;
1466 return SYSTEM_SETTINGS_ERROR_NONE;
1470 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1472 SETTING_TRACE_BEGIN;
1475 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1476 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1478 *value = (void *)vconf_value;
1480 return SYSTEM_SETTINGS_ERROR_NONE;
1483 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1485 SETTING_TRACE_BEGIN;
1487 vconf_value = (bool *)value;
1488 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1489 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1492 return SYSTEM_SETTINGS_ERROR_NONE;
1495 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1497 SETTING_TRACE_BEGIN;
1498 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1501 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1503 SETTING_TRACE_BEGIN;
1504 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1507 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1509 SETTING_TRACE_BEGIN;
1512 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1513 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1515 *value = (void *)vconf_value;
1517 return SYSTEM_SETTINGS_ERROR_NONE;
1521 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1523 SETTING_TRACE_BEGIN;
1525 vconf_value = (int *)value;
1527 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1528 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1529 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1532 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1533 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1536 return SYSTEM_SETTINGS_ERROR_NONE;
1539 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1541 SETTING_TRACE_BEGIN;
1542 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1545 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1547 SETTING_TRACE_BEGIN;
1548 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1551 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1553 SETTING_TRACE_BEGIN;
1554 char *vconf_value = NULL;
1555 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1556 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1559 *value = vconf_value;
1560 return SYSTEM_SETTINGS_ERROR_NONE;
1563 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1565 SETTING_TRACE_BEGIN;
1566 char *vconf_value = NULL;
1567 vconf_value = (char *)value;
1569 int is_load = _is_file_accessible(vconf_value);
1571 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1572 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1575 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1578 return SYSTEM_SETTINGS_ERROR_NONE;
1581 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1583 SETTING_TRACE_BEGIN;
1584 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1587 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1589 SETTING_TRACE_BEGIN;
1590 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1593 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1595 SETTING_TRACE_BEGIN;
1598 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1599 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1601 *value = (void *)vconf_value;
1603 return SYSTEM_SETTINGS_ERROR_NONE;
1606 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1608 SETTING_TRACE_BEGIN;
1610 vconf_value = (int *)value;
1612 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1613 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1616 return SYSTEM_SETTINGS_ERROR_NONE;
1619 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1621 SETTING_TRACE_BEGIN;
1622 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);
1625 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1627 SETTING_TRACE_BEGIN;
1628 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1631 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1633 SETTING_TRACE_BEGIN;
1634 char *vconf_value = NULL;
1635 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1636 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1639 *value = vconf_value;
1640 return SYSTEM_SETTINGS_ERROR_NONE;
1643 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1645 SETTING_TRACE_BEGIN;
1646 char *vconf_value = NULL;
1647 vconf_value = (char *)value;
1649 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1650 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1653 return SYSTEM_SETTINGS_ERROR_NONE;
1656 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1658 SETTING_TRACE_BEGIN;
1659 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1662 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1664 SETTING_TRACE_BEGIN;
1665 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1668 /*---------------------------------------------- */
1669 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1671 SETTING_TRACE_BEGIN;
1673 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1674 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1676 *value = (void *)vconf_value;
1678 return SYSTEM_SETTINGS_ERROR_NONE;
1681 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1683 SETTING_TRACE_BEGIN;
1684 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1687 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1689 SETTING_TRACE_BEGIN;
1690 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1693 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1695 SETTING_TRACE_BEGIN;
1697 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1698 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1701 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1703 *value = (void *)bret;
1704 return SYSTEM_SETTINGS_ERROR_NONE;
1707 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1709 SETTING_TRACE_BEGIN;
1710 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1713 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1715 SETTING_TRACE_BEGIN;
1716 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1719 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1723 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1724 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1726 *value = (void *)vconf_value;
1728 return SYSTEM_SETTINGS_ERROR_NONE;
1731 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1733 SETTING_TRACE_BEGIN;
1735 vconf_value = (int *)value;
1737 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1738 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1741 return SYSTEM_SETTINGS_ERROR_NONE;
1744 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1746 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1749 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1751 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);