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");
321 ret = image_type_check(path);
326 int dl_is_available_font(char *str)
331 int (*check_available_font)(char *font_name);
333 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
335 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
339 check_available_font = dlsym(handle, "_is_available_font");
340 if ((error = dlerror()) != NULL) {
341 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
344 ret = check_available_font(str);
349 void dl_font_size_set()
353 void (*set_font_size)();
355 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
357 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
361 set_font_size = dlsym(handle, "__font_size_set");
362 if ((error = dlerror()) != NULL) {
363 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
371 void dl_font_config_set_notification()
375 void (*set_font_nodification)();
377 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
379 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
383 set_font_nodification = dlsym(handle, "font_config_set_notification");
384 if ((error = dlerror()) != NULL) {
385 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
388 set_font_nodification();
393 bool dl_font_config_set(char *font_name)
398 bool (*check_font_type)(char *font_name);
400 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
402 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
406 check_font_type = dlsym(handle, "font_config_set");
407 if ((error = dlerror()) != NULL) {
408 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
411 ret = check_font_type(font_name);
416 char *dl_get_font_info(char *str)
421 char *(*get_font_info)();
423 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
425 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
429 if (strcmp(str, "cur") == 0)
430 get_font_info = dlsym(handle, "_get_cur_font");
432 get_font_info = dlsym(handle, "_get_default_font");
434 if ((error = dlerror()) != NULL) {
435 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
438 ret = get_font_info();
443 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
444 bool __is_supported_image_type_by_ext(char *file_path)
448 regmatch_t str[2048 + 1];
450 if (!file_path) return false;
453 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
454 SETTING_TRACE("regular expresstion fail");
459 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
460 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
463 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
468 #ifdef TIZEN_WEARABLE
469 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
473 const char *find_str = "extended_wallpaper_";
476 if (!(ch = strstr(file_path, find_str))) {
477 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
479 strncpy(buffer, file_path, ch - file_path);
480 buffer[ch - file_path] = 0;
481 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
483 if (!isdigit(buffer[0])) {
484 SETTING_TRACE("%s is not number", buffer);
485 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
490 return SYSTEM_SETTINGS_ERROR_NONE;
493 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
496 if (!source_file_path || !dest_file_path) {
497 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
503 fd = open(source_file_path, O_RDONLY);
505 SETTING_TRACE("file open failed: %s", source_file_path);
506 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
510 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
512 SETTING_TRACE("file creation failed: %s", dest_file_path);
514 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
517 while (read(fd, buf, sizeof(buf) - 1) > 0) {
518 write(fd2, buf, sizeof(buf) - 1);
524 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
525 SETTING_TRACE("chmod failed: %s", dest_file_path);
528 return SYSTEM_SETTINGS_ERROR_NONE;
531 static int system_setting_remove_oldest_extended_wallpaper()
536 char *min_image_name = NULL;
537 unsigned int min_image_num = 0;
538 unsigned int temp_image_num = 0;
541 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
542 SETTING_TRACE("opendir error");
543 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
546 while ((dirp = readdir(dp))) {
547 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
550 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
551 != SYSTEM_SETTINGS_ERROR_NONE) {
552 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
555 if ((image_count == 0) || (min_image_num > temp_image_num)) {
556 min_image_num = temp_image_num;
557 min_image_name = dirp->d_name;
564 if (min_image_name) {
565 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
566 if (remove(buf) < 0) { /* remove oldest image */
567 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
571 return SYSTEM_SETTINGS_ERROR_NONE;
574 static int system_setting_check_extended_wallpaper(const char *file_path)
578 if (!file_path || !strlen(file_path))
580 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
581 return (strstr(file_path, buffer) != NULL);
584 #define WALLPAPER_MAX_COUNT 10
587 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
591 vconf_value = (char *)value;
593 bool isok = dl_is_supported_image_type_load(vconf_value);
596 SETTING_TRACE("path : %s is not supported file format", vconf_value);
597 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
599 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
602 /* error handling here */
603 if (_is_file_accessible(vconf_value) != 0)
604 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
606 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
607 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
611 #ifdef TIZEN_WEARABLE
612 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
615 unsigned int max_image_num = 0;
616 unsigned int temp_image_num = 0;
619 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
620 SETTING_TRACE("Setting - dir open error!");
621 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
624 /* Check a max number of wallpapers */
625 while ((dirp = readdir(dp))) {
626 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
629 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
630 != SYSTEM_SETTINGS_ERROR_NONE) {
633 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
636 if ((image_count == 0) || (max_image_num < temp_image_num)) {
637 max_image_num = temp_image_num;
645 /* Numbering rule: Gear is odd number */
646 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
649 char file_name_buffer[512];
650 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
651 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
653 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
654 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
655 != SYSTEM_SETTINGS_ERROR_NONE) {
656 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
659 /* remove oldest wallpaper */
660 if (image_count >= WALLPAPER_MAX_COUNT) {
661 if (system_setting_remove_oldest_extended_wallpaper()
662 != SYSTEM_SETTINGS_ERROR_NONE) {
663 remove(file_name_buffer);
664 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
668 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
669 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
672 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
673 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
674 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
677 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
678 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
683 return SYSTEM_SETTINGS_ERROR_NONE;
686 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
690 vconf_value = (char *)value;
692 bool isok = dl_is_supported_image_type_load(vconf_value);
695 SETTING_TRACE("path : %s is not supported file format", vconf_value);
696 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
698 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
701 /* error handling here */
702 if (_is_file_accessible(vconf_value) != 0)
703 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
705 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
706 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
709 return SYSTEM_SETTINGS_ERROR_NONE;
712 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
716 vconf_value = (int *)value;
718 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
719 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
722 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
723 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
727 return SYSTEM_SETTINGS_ERROR_NONE;
732 void *font_conf_doc_parse(char *doc_name, char *font_name)
735 xmlDocPtr doc = NULL;
736 xmlNodePtr cur = NULL;
737 xmlNodePtr cur2 = NULL;
738 xmlNodePtr cur3 = NULL;
741 doc = xmlParseFile(doc_name);
743 cur = xmlDocGetRootElement(doc);
751 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
757 cur = cur->xmlChildrenNode;
759 bool is_changed = false;
760 while (cur != NULL) {
761 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
762 cur2 = cur->xmlChildrenNode;
763 while (cur2 != NULL) {
764 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
765 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
766 /* if name is not 'family', break */
767 if (xmlStrcmp(name, (const xmlChar *)"family")) {
775 cur3 = cur2->xmlChildrenNode;
776 while (cur3 != NULL) {
777 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
778 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
779 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
789 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
790 cur2 = cur->xmlChildrenNode;
791 while (cur2 != NULL) {
792 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
793 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
794 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
798 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
799 cur3 = cur2->xmlChildrenNode;
800 while (cur3 != NULL) {
801 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
802 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
803 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
828 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
831 char *font_name = NULL;
832 font_name = (char *)value;
834 /* get current font list */
835 int is_found = dl_is_available_font(font_name);
838 SETTING_TRACE("found font : %s ", font_name);
840 SETTING_TRACE(" NOT found font : %s ", font_name);
841 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
844 bool bsave = dl_font_config_set(font_name);
847 SETTING_TRACE(" font type save error by font_config_set() ");
848 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
850 SETTING_TRACE(" save OK - font_config_set() ");
853 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
855 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
860 dl_font_config_set_notification();
863 vconf_value = (char *)value;
865 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
866 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
868 return SYSTEM_SETTINGS_ERROR_NONE;
871 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
875 vconf_value = (bool *)value;
876 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
877 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
879 return SYSTEM_SETTINGS_ERROR_NONE;
882 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
886 vconf_value = (bool *)value;
887 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
888 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
890 return SYSTEM_SETTINGS_ERROR_NONE;
894 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
898 vconf_value = (bool *)value;
899 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
900 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
903 return SYSTEM_SETTINGS_ERROR_NONE;
906 static int category_func(const char *name, void *user_data)
909 static char *category = "lock-screen";
910 if (name && !strcmp(name, category)) {
911 SETTING_TRACE(" SAME ");
914 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
923 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
926 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
930 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
933 pkgmgrinfo_appinfo_h handle;
934 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
935 if (r != PMINFO_R_OK) {
936 SETTING_TRACE("*** pkginfo failed ");
937 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
939 SETTING_TRACE("%x", handle);
942 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
943 if (ret != PMINFO_R_OK) {
944 pkgmgrinfo_appinfo_destroy_appinfo(handle);
945 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
948 pkgmgrinfo_appinfo_destroy_appinfo(handle);
949 /*----------------------------------------------------------------------------------- */
951 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
952 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
955 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
956 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
958 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
959 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
962 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
963 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
964 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
967 return SYSTEM_SETTINGS_ERROR_NONE;
970 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
973 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
976 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
979 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
982 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
985 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
988 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
991 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
994 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
997 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1000 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1003 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1005 SETTING_TRACE_BEGIN;
1006 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1009 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1011 SETTING_TRACE_BEGIN;
1012 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1015 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1017 SETTING_TRACE_BEGIN;
1018 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1021 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1023 SETTING_TRACE_BEGIN;
1024 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1027 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1029 SETTING_TRACE_BEGIN;
1030 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1033 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1035 SETTING_TRACE_BEGIN;
1036 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1039 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1041 SETTING_TRACE_BEGIN;
1042 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1045 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1047 SETTING_TRACE_BEGIN;
1048 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1051 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1053 SETTING_TRACE_BEGIN;
1054 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1057 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1059 SETTING_TRACE_BEGIN;
1060 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1063 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1065 SETTING_TRACE_BEGIN;
1066 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1071 * @todo need to add custom event notification method
1073 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1075 SETTING_TRACE_BEGIN;
1076 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1079 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1081 SETTING_TRACE_BEGIN;
1082 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1085 /* TODO : 2th argument, callback, is not in use. */
1086 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1088 SETTING_TRACE_BEGIN;
1089 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1092 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1094 SETTING_TRACE_BEGIN;
1095 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1098 /*//////////////////////////////////////////////////////////////////////////////////////// */
1099 /*--------------------------------------- */
1100 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1102 SETTING_TRACE_BEGIN;
1103 char *vconf_value = NULL;
1104 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1105 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1108 /* parsing validation */
1111 snprintf(arr, 20, "%s", vconf_value);
1113 *value = strdup(arr);
1117 return SYSTEM_SETTINGS_ERROR_NONE;
1120 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1122 SETTING_TRACE_BEGIN;
1123 char *vconf_value = NULL;
1124 vconf_value = (char *)value;
1126 char *ext = "UTF-8";
1129 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1131 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1132 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1134 return SYSTEM_SETTINGS_ERROR_NONE;
1137 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1139 SETTING_TRACE_BEGIN;
1140 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1143 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1145 SETTING_TRACE_BEGIN;
1146 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1150 /*--------------------------------------- */
1151 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1153 SETTING_TRACE_BEGIN;
1154 char *vconf_value = NULL;
1155 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1156 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1159 /* parsing validation */
1162 snprintf(arr, 20, "%s", vconf_value);
1164 *value = strdup(arr);
1167 return SYSTEM_SETTINGS_ERROR_NONE;
1170 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1172 SETTING_TRACE_BEGIN;
1173 char *vconf_value = NULL;
1174 vconf_value = (char *)value;
1176 char *ext = "UTF-8";
1179 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1181 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1182 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1184 return SYSTEM_SETTINGS_ERROR_NONE;
1187 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1189 SETTING_TRACE_BEGIN;
1190 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1191 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1194 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1196 SETTING_TRACE_BEGIN;
1197 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1200 /*--------------------------------------- */
1201 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1203 SETTING_TRACE_BEGIN;
1206 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1207 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1210 bool ret_value = true;
1211 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1213 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1216 *value = (void *)ret_value;
1218 return SYSTEM_SETTINGS_ERROR_NONE;
1221 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1223 SETTING_TRACE_BEGIN;
1226 vconf_value = (bool *)value;
1229 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1230 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1234 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1235 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1240 return SYSTEM_SETTINGS_ERROR_NONE;
1243 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1245 SETTING_TRACE_BEGIN;
1246 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1249 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1251 SETTING_TRACE_BEGIN;
1252 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1255 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1257 SETTING_TRACE_BEGIN;
1260 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
1264 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1265 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1267 /* "/usr/share/zoneinfo/Asia/Seoul" */
1268 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1269 *value = strdup(&tzpath[20]);
1271 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1273 return SYSTEM_SETTINGS_ERROR_NONE;
1276 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1278 SETTING_TRACE_BEGIN;
1279 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1282 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1284 SETTING_TRACE_BEGIN;
1285 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1289 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1291 SETTING_TRACE_BEGIN;
1293 cur_tick = time(NULL);
1294 *value = (void *)cur_tick;
1295 /* struct tm * localtime = time (cur_tick); */
1296 /* printf("%s\n", ctime(&cur_tick); */
1297 return SYSTEM_SETTINGS_ERROR_NONE;
1301 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1303 SETTING_TRACE_BEGIN;
1304 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1307 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1309 SETTING_TRACE_BEGIN;
1310 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1315 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1316 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1318 SETTING_TRACE_BEGIN;
1321 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1322 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1324 *value = (void *)vconf_value;
1326 return SYSTEM_SETTINGS_ERROR_NONE;
1329 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1331 SETTING_TRACE_BEGIN;
1332 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1335 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1337 SETTING_TRACE_BEGIN;
1338 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1342 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1344 * a == false, b == false --> silent mode
1345 * a == true, b == false --> sound mode
1346 * a == false, b == true --> vibration mode
1348 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1350 SETTING_TRACE_BEGIN;
1355 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1356 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1359 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1360 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1363 if (sound_cond == false && vib_cond == false) {
1365 *value = (void *)vconf_value;
1367 vconf_value = false;
1368 *value = (void *)vconf_value;
1370 return SYSTEM_SETTINGS_ERROR_NONE;
1374 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1376 * a == false, b == false --> silent mode
1377 * a == true, b == false --> sound mode
1379 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1381 SETTING_TRACE_BEGIN;
1384 vconf_value = (bool *)value;
1386 bool vconf_sound = false;
1387 bool vconf_vib = false;
1390 vconf_sound = false;
1397 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1398 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1400 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1401 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1404 return SYSTEM_SETTINGS_ERROR_NONE;
1410 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1412 SETTING_TRACE_BEGIN;
1413 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1417 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1419 SETTING_TRACE_BEGIN;
1420 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1423 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1424 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1426 SETTING_TRACE_BEGIN;
1429 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1430 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1433 *value = (void *)vconf_value;
1437 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1439 SETTING_TRACE_BEGIN;
1440 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1443 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1445 SETTING_TRACE_BEGIN;
1446 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1450 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1451 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1455 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1456 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1458 *value = (void *)vconf_value;
1460 return SYSTEM_SETTINGS_ERROR_NONE;
1464 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1466 SETTING_TRACE_BEGIN;
1469 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1470 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1472 *value = (void *)vconf_value;
1474 return SYSTEM_SETTINGS_ERROR_NONE;
1477 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1479 SETTING_TRACE_BEGIN;
1481 vconf_value = (bool *)value;
1482 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1483 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1486 return SYSTEM_SETTINGS_ERROR_NONE;
1489 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1491 SETTING_TRACE_BEGIN;
1492 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1495 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1497 SETTING_TRACE_BEGIN;
1498 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1501 int system_setting_get_screen_backlight_time(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_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1507 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1509 *value = (void *)vconf_value;
1511 return SYSTEM_SETTINGS_ERROR_NONE;
1515 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1517 SETTING_TRACE_BEGIN;
1519 vconf_value = (int *)value;
1521 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1522 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1523 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1526 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1527 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1530 return SYSTEM_SETTINGS_ERROR_NONE;
1533 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1535 SETTING_TRACE_BEGIN;
1536 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1539 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1541 SETTING_TRACE_BEGIN;
1542 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1545 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1547 SETTING_TRACE_BEGIN;
1548 char *vconf_value = NULL;
1549 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1550 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1553 *value = vconf_value;
1554 return SYSTEM_SETTINGS_ERROR_NONE;
1557 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1559 SETTING_TRACE_BEGIN;
1560 char *vconf_value = NULL;
1561 vconf_value = (char *)value;
1563 int is_load = _is_file_accessible(vconf_value);
1565 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1566 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1569 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1572 return SYSTEM_SETTINGS_ERROR_NONE;
1575 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1577 SETTING_TRACE_BEGIN;
1578 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1581 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1583 SETTING_TRACE_BEGIN;
1584 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1587 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1589 SETTING_TRACE_BEGIN;
1592 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1593 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1595 *value = (void *)vconf_value;
1597 return SYSTEM_SETTINGS_ERROR_NONE;
1600 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1602 SETTING_TRACE_BEGIN;
1604 vconf_value = (int *)value;
1606 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1607 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1610 return SYSTEM_SETTINGS_ERROR_NONE;
1613 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1615 SETTING_TRACE_BEGIN;
1616 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);
1619 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1621 SETTING_TRACE_BEGIN;
1622 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1625 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1627 SETTING_TRACE_BEGIN;
1628 char *vconf_value = NULL;
1629 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1630 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1633 *value = vconf_value;
1634 return SYSTEM_SETTINGS_ERROR_NONE;
1637 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1639 SETTING_TRACE_BEGIN;
1640 char *vconf_value = NULL;
1641 vconf_value = (char *)value;
1643 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1644 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1647 return SYSTEM_SETTINGS_ERROR_NONE;
1650 int system_setting_set_changed_callback_device_name(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_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1656 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1658 SETTING_TRACE_BEGIN;
1659 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1662 /*---------------------------------------------- */
1663 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1665 SETTING_TRACE_BEGIN;
1667 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1668 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1670 *value = (void *)vconf_value;
1672 return SYSTEM_SETTINGS_ERROR_NONE;
1675 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1677 SETTING_TRACE_BEGIN;
1678 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1681 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1683 SETTING_TRACE_BEGIN;
1684 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1687 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1689 SETTING_TRACE_BEGIN;
1691 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1692 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1695 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1697 *value = (void *)bret;
1698 return SYSTEM_SETTINGS_ERROR_NONE;
1701 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1703 SETTING_TRACE_BEGIN;
1704 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1707 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1709 SETTING_TRACE_BEGIN;
1710 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1713 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1717 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1718 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1720 *value = (void *)vconf_value;
1722 return SYSTEM_SETTINGS_ERROR_NONE;
1725 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1727 SETTING_TRACE_BEGIN;
1729 vconf_value = (int *)value;
1731 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1732 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1735 return SYSTEM_SETTINGS_ERROR_NONE;
1738 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1740 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1743 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1745 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);