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 __is_available_font 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_size_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_notification 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;
1276 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1277 return SYSTEM_SETTINGS_ERROR_NONE;
1280 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1282 SETTING_TRACE_BEGIN;
1283 char *vconf_value = NULL;
1284 vconf_value = (char *)value;
1287 sprintf( tz_path, "/usr/share/zoneinfo/%s", vconf_value);
1289 int is_load = _is_file_accessible(tz_path);
1291 int ret = alarmmgr_set_timezone(tz_path);
1293 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
1294 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1296 return SYSTEM_SETTINGS_ERROR_NONE;
1298 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1303 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1305 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1308 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1310 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1313 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1315 SETTING_TRACE_BEGIN;
1316 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1319 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1321 SETTING_TRACE_BEGIN;
1322 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1326 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1328 SETTING_TRACE_BEGIN;
1330 cur_tick = time(NULL);
1331 *value = (void *)cur_tick;
1332 /* struct tm * localtime = time (cur_tick); */
1333 /* printf("%s\n", ctime(&cur_tick); */
1334 return SYSTEM_SETTINGS_ERROR_NONE;
1338 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1340 SETTING_TRACE_BEGIN;
1341 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1344 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1346 SETTING_TRACE_BEGIN;
1347 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1352 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1353 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1355 SETTING_TRACE_BEGIN;
1358 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1359 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1361 *value = (void *)vconf_value;
1363 return SYSTEM_SETTINGS_ERROR_NONE;
1366 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1368 SETTING_TRACE_BEGIN;
1369 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1372 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1374 SETTING_TRACE_BEGIN;
1375 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1379 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1381 * a == false, b == false --> silent mode
1382 * a == true, b == false --> sound mode
1383 * a == false, b == true --> vibration mode
1385 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1387 SETTING_TRACE_BEGIN;
1392 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1393 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1396 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1397 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1400 if (sound_cond == false && vib_cond == false) {
1402 *value = (void *)vconf_value;
1404 vconf_value = false;
1405 *value = (void *)vconf_value;
1407 return SYSTEM_SETTINGS_ERROR_NONE;
1411 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1413 * a == false, b == false --> silent mode
1414 * a == true, b == false --> sound mode
1416 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1418 SETTING_TRACE_BEGIN;
1421 vconf_value = (bool *)value;
1423 bool vconf_sound = false;
1424 bool vconf_vib = false;
1427 vconf_sound = false;
1434 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1435 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1437 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1438 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1441 return SYSTEM_SETTINGS_ERROR_NONE;
1447 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1449 SETTING_TRACE_BEGIN;
1450 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1454 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1456 SETTING_TRACE_BEGIN;
1457 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1460 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1461 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1463 SETTING_TRACE_BEGIN;
1466 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1467 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1470 *value = (void *)vconf_value;
1474 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1476 SETTING_TRACE_BEGIN;
1477 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1480 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1482 SETTING_TRACE_BEGIN;
1483 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1487 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1488 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1492 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1493 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1495 *value = (void *)vconf_value;
1497 return SYSTEM_SETTINGS_ERROR_NONE;
1501 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1503 SETTING_TRACE_BEGIN;
1506 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1507 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1509 *value = (void *)vconf_value;
1511 return SYSTEM_SETTINGS_ERROR_NONE;
1514 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1516 SETTING_TRACE_BEGIN;
1518 vconf_value = (bool *)value;
1519 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1520 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1523 return SYSTEM_SETTINGS_ERROR_NONE;
1526 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1528 SETTING_TRACE_BEGIN;
1529 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1532 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1534 SETTING_TRACE_BEGIN;
1535 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1538 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1540 SETTING_TRACE_BEGIN;
1543 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1544 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1546 *value = (void *)vconf_value;
1548 return SYSTEM_SETTINGS_ERROR_NONE;
1552 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1554 SETTING_TRACE_BEGIN;
1556 vconf_value = (int *)value;
1558 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1559 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1560 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1563 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1564 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1567 return SYSTEM_SETTINGS_ERROR_NONE;
1570 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1572 SETTING_TRACE_BEGIN;
1573 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1576 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1578 SETTING_TRACE_BEGIN;
1579 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1582 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1584 SETTING_TRACE_BEGIN;
1585 char *vconf_value = NULL;
1586 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1587 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1590 *value = vconf_value;
1591 return SYSTEM_SETTINGS_ERROR_NONE;
1594 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1596 SETTING_TRACE_BEGIN;
1597 char *vconf_value = NULL;
1598 vconf_value = (char *)value;
1600 int is_load = _is_file_accessible(vconf_value);
1602 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1603 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1606 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1609 return SYSTEM_SETTINGS_ERROR_NONE;
1612 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1614 SETTING_TRACE_BEGIN;
1615 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1618 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1620 SETTING_TRACE_BEGIN;
1621 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1624 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1626 SETTING_TRACE_BEGIN;
1629 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1630 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1632 *value = (void *)vconf_value;
1634 return SYSTEM_SETTINGS_ERROR_NONE;
1637 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1639 SETTING_TRACE_BEGIN;
1641 vconf_value = (int *)value;
1643 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1644 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1647 return SYSTEM_SETTINGS_ERROR_NONE;
1650 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1652 SETTING_TRACE_BEGIN;
1653 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);
1656 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1658 SETTING_TRACE_BEGIN;
1659 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1662 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1664 SETTING_TRACE_BEGIN;
1665 char *vconf_value = NULL;
1666 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1667 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1670 *value = vconf_value;
1671 return SYSTEM_SETTINGS_ERROR_NONE;
1674 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1676 SETTING_TRACE_BEGIN;
1677 char *vconf_value = NULL;
1678 vconf_value = (char *)value;
1680 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1681 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1684 return SYSTEM_SETTINGS_ERROR_NONE;
1687 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1689 SETTING_TRACE_BEGIN;
1690 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1693 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1695 SETTING_TRACE_BEGIN;
1696 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1699 /*---------------------------------------------- */
1700 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1702 SETTING_TRACE_BEGIN;
1704 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1705 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1707 *value = (void *)vconf_value;
1709 return SYSTEM_SETTINGS_ERROR_NONE;
1712 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1714 SETTING_TRACE_BEGIN;
1715 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1718 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1720 SETTING_TRACE_BEGIN;
1721 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1724 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1726 SETTING_TRACE_BEGIN;
1728 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1729 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1732 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1734 *value = (void *)bret;
1735 return SYSTEM_SETTINGS_ERROR_NONE;
1738 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1740 SETTING_TRACE_BEGIN;
1741 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1744 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1746 SETTING_TRACE_BEGIN;
1747 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1750 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1754 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1755 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1757 *value = (void *)vconf_value;
1759 return SYSTEM_SETTINGS_ERROR_NONE;
1762 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1764 SETTING_TRACE_BEGIN;
1766 vconf_value = (int *)value;
1768 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1769 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1772 return SYSTEM_SETTINGS_ERROR_NONE;
1775 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1777 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1780 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1782 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);