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);
312 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
316 image_type_check = dlsym(handle, "__is_supported_image_type_load");
317 if ((error = dlerror()) != NULL) {
318 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
323 ret = image_type_check(path);
329 int dl_is_available_font(char *str)
334 int (*check_available_font)(char *font_name);
336 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
338 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
342 check_available_font = dlsym(handle, "_is_available_font");
343 if ((error = dlerror()) != NULL) {
344 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
349 ret = check_available_font(str);
355 void dl_font_size_set()
359 void (*set_font_size)();
361 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
363 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
367 set_font_size = dlsym(handle, "__font_size_set");
368 if ((error = dlerror()) != NULL) {
369 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
380 void dl_font_config_set_notification()
384 void (*set_font_nodification)();
386 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
388 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
392 set_font_nodification = dlsym(handle, "font_config_set_notification");
393 if ((error = dlerror()) != NULL) {
394 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
399 set_font_nodification();
405 bool dl_font_config_set(char *font_name)
410 bool (*check_font_type)(char *font_name);
412 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
414 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
418 check_font_type = dlsym(handle, "font_config_set");
419 if ((error = dlerror()) != NULL) {
420 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
425 ret = check_font_type(font_name);
431 char *dl_get_font_info(char *str)
436 char *(*get_font_info)();
438 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
440 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
444 if (strcmp(str, "cur") == 0)
445 get_font_info = dlsym(handle, "_get_cur_font");
447 get_font_info = dlsym(handle, "_get_default_font");
449 if ((error = dlerror()) != NULL) {
450 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
455 ret = get_font_info();
461 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
462 bool __is_supported_image_type_by_ext(char *file_path)
466 regmatch_t str[2048 + 1];
468 if (!file_path) return false;
471 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
472 SETTING_TRACE("regular expresstion fail");
477 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
478 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
481 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
486 #ifdef TIZEN_WEARABLE
487 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
491 const char *find_str = "extended_wallpaper_";
494 if (!(ch = strstr(file_path, find_str))) {
495 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
497 strncpy(buffer, file_path, ch - file_path);
498 buffer[ch - file_path] = 0;
499 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
501 if (!isdigit(buffer[0])) {
502 SETTING_TRACE("%s is not number", buffer);
503 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
508 return SYSTEM_SETTINGS_ERROR_NONE;
511 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
514 if (!source_file_path || !dest_file_path) {
515 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
521 fd = open(source_file_path, O_RDONLY);
523 SETTING_TRACE("file open failed: %s", source_file_path);
524 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
528 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
530 SETTING_TRACE("file creation failed: %s", dest_file_path);
532 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
535 while (read(fd, buf, sizeof(buf) - 1) > 0) {
536 write(fd2, buf, sizeof(buf) - 1);
542 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
543 SETTING_TRACE("chmod failed: %s", dest_file_path);
546 return SYSTEM_SETTINGS_ERROR_NONE;
549 static int system_setting_remove_oldest_extended_wallpaper()
554 char *min_image_name = NULL;
555 unsigned int min_image_num = 0;
556 unsigned int temp_image_num = 0;
559 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
560 SETTING_TRACE("opendir error");
561 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
564 while ((dirp = readdir(dp))) {
565 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
568 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
569 != SYSTEM_SETTINGS_ERROR_NONE) {
570 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
573 if ((image_count == 0) || (min_image_num > temp_image_num)) {
574 min_image_num = temp_image_num;
575 min_image_name = dirp->d_name;
582 if (min_image_name) {
583 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
584 if (remove(buf) < 0) { /* remove oldest image */
585 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
589 return SYSTEM_SETTINGS_ERROR_NONE;
592 static int system_setting_check_extended_wallpaper(const char *file_path)
596 if (!file_path || !strlen(file_path))
598 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
599 return (strstr(file_path, buffer) != NULL);
602 #define WALLPAPER_MAX_COUNT 10
605 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
609 vconf_value = (char *)value;
611 bool isok = dl_is_supported_image_type_load(vconf_value);
614 SETTING_TRACE("path : %s is not supported file format", vconf_value);
615 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
617 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
620 /* error handling here */
621 if (_is_file_accessible(vconf_value) != 0)
622 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
624 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
625 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
629 #ifdef TIZEN_WEARABLE
630 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
633 unsigned int max_image_num = 0;
634 unsigned int temp_image_num = 0;
637 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
638 SETTING_TRACE("Setting - dir open error!");
639 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
642 /* Check a max number of wallpapers */
643 while ((dirp = readdir(dp))) {
644 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
647 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
648 != SYSTEM_SETTINGS_ERROR_NONE) {
651 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
654 if ((image_count == 0) || (max_image_num < temp_image_num)) {
655 max_image_num = temp_image_num;
663 /* Numbering rule: Gear is odd number */
664 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
667 char file_name_buffer[512];
668 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
669 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
671 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
672 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
673 != SYSTEM_SETTINGS_ERROR_NONE) {
674 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
677 /* remove oldest wallpaper */
678 if (image_count >= WALLPAPER_MAX_COUNT) {
679 if (system_setting_remove_oldest_extended_wallpaper()
680 != SYSTEM_SETTINGS_ERROR_NONE) {
681 remove(file_name_buffer);
682 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
686 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
687 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
690 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
691 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
692 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
695 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
696 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
701 return SYSTEM_SETTINGS_ERROR_NONE;
704 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
708 vconf_value = (char *)value;
710 bool isok = dl_is_supported_image_type_load(vconf_value);
713 SETTING_TRACE("path : %s is not supported file format", vconf_value);
714 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
716 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
719 /* error handling here */
720 if (_is_file_accessible(vconf_value) != 0)
721 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
723 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
724 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
727 return SYSTEM_SETTINGS_ERROR_NONE;
730 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
734 vconf_value = (int *)value;
736 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
737 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
740 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
741 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
745 return SYSTEM_SETTINGS_ERROR_NONE;
750 void *font_conf_doc_parse(char *doc_name, char *font_name)
753 xmlDocPtr doc = NULL;
754 xmlNodePtr cur = NULL;
755 xmlNodePtr cur2 = NULL;
756 xmlNodePtr cur3 = NULL;
759 doc = xmlParseFile(doc_name);
761 cur = xmlDocGetRootElement(doc);
769 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
775 cur = cur->xmlChildrenNode;
777 bool is_changed = false;
778 while (cur != NULL) {
779 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
780 cur2 = cur->xmlChildrenNode;
781 while (cur2 != NULL) {
782 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
783 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
784 /* if name is not 'family', break */
785 if (xmlStrcmp(name, (const xmlChar *)"family")) {
793 cur3 = cur2->xmlChildrenNode;
794 while (cur3 != NULL) {
795 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
796 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
797 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
807 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
808 cur2 = cur->xmlChildrenNode;
809 while (cur2 != NULL) {
810 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
811 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
812 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
816 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
817 cur3 = cur2->xmlChildrenNode;
818 while (cur3 != NULL) {
819 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
820 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
821 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
846 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
849 char *font_name = NULL;
850 font_name = (char *)value;
852 /* get current font list */
853 int is_found = dl_is_available_font(font_name);
856 SETTING_TRACE("found font : %s ", font_name);
858 SETTING_TRACE(" NOT found font : %s ", font_name);
859 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
862 bool bsave = dl_font_config_set(font_name);
865 SETTING_TRACE(" font type save error by font_config_set() ");
866 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
868 SETTING_TRACE(" save OK - font_config_set() ");
871 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
873 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
878 dl_font_config_set_notification();
881 vconf_value = (char *)value;
883 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
884 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
886 return SYSTEM_SETTINGS_ERROR_NONE;
889 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
893 vconf_value = (bool *)value;
894 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
895 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
897 return SYSTEM_SETTINGS_ERROR_NONE;
900 int system_setting_set_usb_debugging_option(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_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
906 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
908 return SYSTEM_SETTINGS_ERROR_NONE;
912 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
916 vconf_value = (bool *)value;
917 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
918 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
921 return SYSTEM_SETTINGS_ERROR_NONE;
924 static int category_func(const char *name, void *user_data)
927 static char *category = "lock-screen";
928 if (name && !strcmp(name, category)) {
929 SETTING_TRACE(" SAME ");
932 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
941 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
944 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
948 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
951 pkgmgrinfo_appinfo_h handle;
952 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
953 if (r != PMINFO_R_OK) {
954 SETTING_TRACE("*** pkginfo failed ");
955 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
957 SETTING_TRACE("%x", handle);
960 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
961 if (ret != PMINFO_R_OK) {
962 pkgmgrinfo_appinfo_destroy_appinfo(handle);
963 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
966 pkgmgrinfo_appinfo_destroy_appinfo(handle);
967 /*----------------------------------------------------------------------------------- */
969 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
970 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
973 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
974 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
976 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
977 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
980 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
981 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
982 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
985 return SYSTEM_SETTINGS_ERROR_NONE;
988 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
991 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
994 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
997 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1000 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1003 int system_setting_set_changed_callback_email_alert_ringtone(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_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1009 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1011 SETTING_TRACE_BEGIN;
1012 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1015 int system_setting_set_changed_callback_wallpaper_home_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_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1021 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1023 SETTING_TRACE_BEGIN;
1024 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1027 int system_setting_set_changed_callback_wallpaper_lock_screen(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_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1033 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1035 SETTING_TRACE_BEGIN;
1036 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1039 int system_setting_set_changed_callback_font_size(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_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1045 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1047 SETTING_TRACE_BEGIN;
1048 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1051 int system_setting_set_changed_callback_usb_debugging_option(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_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1057 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1059 SETTING_TRACE_BEGIN;
1060 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1063 int system_setting_set_changed_callback_3g_data_network(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_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1069 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1071 SETTING_TRACE_BEGIN;
1072 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1075 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1077 SETTING_TRACE_BEGIN;
1078 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1081 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1083 SETTING_TRACE_BEGIN;
1084 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1089 * @todo need to add custom event notification method
1091 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1093 SETTING_TRACE_BEGIN;
1094 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1097 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1099 SETTING_TRACE_BEGIN;
1100 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1103 /* TODO : 2th argument, callback, is not in use. */
1104 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1106 SETTING_TRACE_BEGIN;
1107 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1110 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1112 SETTING_TRACE_BEGIN;
1113 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1116 /*//////////////////////////////////////////////////////////////////////////////////////// */
1117 /*--------------------------------------- */
1118 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1120 SETTING_TRACE_BEGIN;
1121 char *vconf_value = NULL;
1122 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1123 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1126 /* parsing validation */
1129 snprintf(arr, 20, "%s", vconf_value);
1131 *value = strdup(arr);
1135 return SYSTEM_SETTINGS_ERROR_NONE;
1138 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1140 SETTING_TRACE_BEGIN;
1141 char *vconf_value = NULL;
1142 vconf_value = (char *)value;
1144 char *ext = "UTF-8";
1147 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1149 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1150 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1152 return SYSTEM_SETTINGS_ERROR_NONE;
1155 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1157 SETTING_TRACE_BEGIN;
1158 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1161 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1163 SETTING_TRACE_BEGIN;
1164 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1168 /*--------------------------------------- */
1169 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1171 SETTING_TRACE_BEGIN;
1172 char *vconf_value = NULL;
1173 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1174 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1177 /* parsing validation */
1180 snprintf(arr, 20, "%s", vconf_value);
1182 *value = strdup(arr);
1185 return SYSTEM_SETTINGS_ERROR_NONE;
1188 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1190 SETTING_TRACE_BEGIN;
1191 char *vconf_value = NULL;
1192 vconf_value = (char *)value;
1194 char *ext = "UTF-8";
1197 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1199 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1200 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1202 return SYSTEM_SETTINGS_ERROR_NONE;
1205 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1207 SETTING_TRACE_BEGIN;
1208 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1209 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1212 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1214 SETTING_TRACE_BEGIN;
1215 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1218 /*--------------------------------------- */
1219 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1221 SETTING_TRACE_BEGIN;
1224 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1225 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1228 bool ret_value = true;
1229 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1231 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1234 *value = (void *)ret_value;
1236 return SYSTEM_SETTINGS_ERROR_NONE;
1239 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1241 SETTING_TRACE_BEGIN;
1244 vconf_value = (bool *)value;
1247 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1248 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1252 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1253 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1258 return SYSTEM_SETTINGS_ERROR_NONE;
1261 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1263 SETTING_TRACE_BEGIN;
1264 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1267 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1269 SETTING_TRACE_BEGIN;
1270 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1273 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1275 SETTING_TRACE_BEGIN;
1278 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
1282 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1283 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1285 /* "/usr/share/zoneinfo/Asia/Seoul" */
1286 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1287 *value = strdup(&tzpath[20]);
1289 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1291 return SYSTEM_SETTINGS_ERROR_NONE;
1294 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1296 SETTING_TRACE_BEGIN;
1297 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1300 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1302 SETTING_TRACE_BEGIN;
1303 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1307 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1309 SETTING_TRACE_BEGIN;
1311 cur_tick = time(NULL);
1312 *value = (void *)cur_tick;
1313 /* struct tm * localtime = time (cur_tick); */
1314 /* printf("%s\n", ctime(&cur_tick); */
1315 return SYSTEM_SETTINGS_ERROR_NONE;
1319 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1321 SETTING_TRACE_BEGIN;
1322 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1325 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1327 SETTING_TRACE_BEGIN;
1328 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1333 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1334 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1336 SETTING_TRACE_BEGIN;
1339 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1340 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1342 *value = (void *)vconf_value;
1344 return SYSTEM_SETTINGS_ERROR_NONE;
1347 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1349 SETTING_TRACE_BEGIN;
1350 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1353 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1355 SETTING_TRACE_BEGIN;
1356 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1360 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1362 * a == false, b == false --> silent mode
1363 * a == true, b == false --> sound mode
1364 * a == false, b == true --> vibration mode
1366 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1368 SETTING_TRACE_BEGIN;
1373 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1374 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1377 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1378 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1381 if (sound_cond == false && vib_cond == false) {
1383 *value = (void *)vconf_value;
1385 vconf_value = false;
1386 *value = (void *)vconf_value;
1388 return SYSTEM_SETTINGS_ERROR_NONE;
1392 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1394 * a == false, b == false --> silent mode
1395 * a == true, b == false --> sound mode
1397 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1399 SETTING_TRACE_BEGIN;
1402 vconf_value = (bool *)value;
1404 bool vconf_sound = false;
1405 bool vconf_vib = false;
1408 vconf_sound = false;
1415 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1416 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1418 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1419 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1422 return SYSTEM_SETTINGS_ERROR_NONE;
1428 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1430 SETTING_TRACE_BEGIN;
1431 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1435 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1437 SETTING_TRACE_BEGIN;
1438 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1441 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1442 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1444 SETTING_TRACE_BEGIN;
1447 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1448 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1451 *value = (void *)vconf_value;
1455 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1457 SETTING_TRACE_BEGIN;
1458 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1461 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1463 SETTING_TRACE_BEGIN;
1464 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1468 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1469 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1473 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1474 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1476 *value = (void *)vconf_value;
1478 return SYSTEM_SETTINGS_ERROR_NONE;
1482 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1484 SETTING_TRACE_BEGIN;
1487 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1488 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1490 *value = (void *)vconf_value;
1492 return SYSTEM_SETTINGS_ERROR_NONE;
1495 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1497 SETTING_TRACE_BEGIN;
1499 vconf_value = (bool *)value;
1500 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1501 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1504 return SYSTEM_SETTINGS_ERROR_NONE;
1507 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1509 SETTING_TRACE_BEGIN;
1510 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1513 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1515 SETTING_TRACE_BEGIN;
1516 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1519 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1521 SETTING_TRACE_BEGIN;
1524 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1525 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1527 *value = (void *)vconf_value;
1529 return SYSTEM_SETTINGS_ERROR_NONE;
1533 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1535 SETTING_TRACE_BEGIN;
1537 vconf_value = (int *)value;
1539 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1540 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1541 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1544 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1545 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1548 return SYSTEM_SETTINGS_ERROR_NONE;
1551 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1553 SETTING_TRACE_BEGIN;
1554 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1557 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1559 SETTING_TRACE_BEGIN;
1560 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1563 int system_setting_get_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 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1568 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1571 *value = vconf_value;
1572 return SYSTEM_SETTINGS_ERROR_NONE;
1575 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1577 SETTING_TRACE_BEGIN;
1578 char *vconf_value = NULL;
1579 vconf_value = (char *)value;
1581 int is_load = _is_file_accessible(vconf_value);
1583 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1584 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1587 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1590 return SYSTEM_SETTINGS_ERROR_NONE;
1593 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1595 SETTING_TRACE_BEGIN;
1596 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1599 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1601 SETTING_TRACE_BEGIN;
1602 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1605 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1607 SETTING_TRACE_BEGIN;
1610 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1611 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1613 *value = (void *)vconf_value;
1615 return SYSTEM_SETTINGS_ERROR_NONE;
1618 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1620 SETTING_TRACE_BEGIN;
1622 vconf_value = (int *)value;
1624 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1625 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1628 return SYSTEM_SETTINGS_ERROR_NONE;
1631 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1633 SETTING_TRACE_BEGIN;
1634 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);
1637 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1639 SETTING_TRACE_BEGIN;
1640 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1643 int system_setting_get_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 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1648 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1651 *value = vconf_value;
1652 return SYSTEM_SETTINGS_ERROR_NONE;
1655 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1657 SETTING_TRACE_BEGIN;
1658 char *vconf_value = NULL;
1659 vconf_value = (char *)value;
1661 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1662 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1665 return SYSTEM_SETTINGS_ERROR_NONE;
1668 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1670 SETTING_TRACE_BEGIN;
1671 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1674 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1676 SETTING_TRACE_BEGIN;
1677 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1680 /*---------------------------------------------- */
1681 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1683 SETTING_TRACE_BEGIN;
1685 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1686 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1688 *value = (void *)vconf_value;
1690 return SYSTEM_SETTINGS_ERROR_NONE;
1693 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1695 SETTING_TRACE_BEGIN;
1696 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1699 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1701 SETTING_TRACE_BEGIN;
1702 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1705 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1707 SETTING_TRACE_BEGIN;
1709 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1710 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1713 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1715 *value = (void *)bret;
1716 return SYSTEM_SETTINGS_ERROR_NONE;
1719 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1721 SETTING_TRACE_BEGIN;
1722 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1725 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1727 SETTING_TRACE_BEGIN;
1728 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1731 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1735 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1736 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1738 *value = (void *)vconf_value;
1740 return SYSTEM_SETTINGS_ERROR_NONE;
1743 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1745 SETTING_TRACE_BEGIN;
1747 vconf_value = (int *)value;
1749 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1750 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1753 return SYSTEM_SETTINGS_ERROR_NONE;
1756 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1758 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1761 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1763 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);