2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
25 #include <sys/types.h>
35 #include <libxml/xmlmemory.h>
36 #include <libxml/parser.h>
38 #include <fontconfig/fontconfig.h>
42 #include <pkgmgr-info.h>
44 #include <system_settings.h>
45 #include <system_settings_private.h>
47 #include <tzplatform_config.h>
50 #include <efl_assist.h>
53 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
54 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
56 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
57 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
58 #define SETTING_TZONE_SYMLINK_PATH "/etc/localtime"
61 int _is_file_accessible(const char *path);
63 static bool dl_is_supported_image_type_load(char *path);
64 static bool dl_font_config_set(char *font_name);
65 static char *dl_get_font_info(char *str);
66 static int dl_is_available_font(char *str);
67 static void dl_font_size_set();
68 static void dl_font_config_set_notification();
72 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
73 * @return the ringtone file path specified by user in normal case
74 * if it's not accessable, return the default ringtone path
76 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
80 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
81 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
84 /* check to see if it's accessable -> OK */
85 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
86 int is_load = _is_file_accessible(vconf_value);
89 } else { /* not zero on errro */
90 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
93 /**value = vconf_value; */
94 return SYSTEM_SETTINGS_ERROR_NONE;
98 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
102 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
103 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
106 /* check to see if it's accessable -> OK */
107 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
108 int is_load = _is_file_accessible(vconf_value);
110 *value = vconf_value;
111 } else { /* not zero on errro */
112 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
115 return SYSTEM_SETTINGS_ERROR_NONE;
119 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
123 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
124 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
126 *value = vconf_value;
127 return SYSTEM_SETTINGS_ERROR_NONE;
131 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
136 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
137 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
139 *value = vconf_value;
141 return SYSTEM_SETTINGS_ERROR_NONE;
145 /* [int] vconf GET */
146 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
151 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
152 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
154 *value = (void *)vconf_value;
156 return SYSTEM_SETTINGS_ERROR_NONE;
160 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
163 char *font_name = dl_get_font_info("default");
165 *value = (void *)font_name;
166 return SYSTEM_SETTINGS_ERROR_NONE;
168 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
172 /* [int] vconf GET */
173 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
176 char *font_name = dl_get_font_info("cur");
177 *value = (void *)font_name;
179 return SYSTEM_SETTINGS_ERROR_NONE;
183 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
188 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
189 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
191 *value = (void *)vconf_value;
193 return SYSTEM_SETTINGS_ERROR_NONE;
196 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
201 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
202 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
204 *value = (void *)vconf_value;
206 return SYSTEM_SETTINGS_ERROR_NONE;
209 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
214 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
215 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
217 *value = (void *)vconf_value;
219 return SYSTEM_SETTINGS_ERROR_NONE;
221 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
225 * get current lock scren app package name (string)
227 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
229 /* LCOV_EXCL_START */
230 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
233 char *pkg_name = NULL;
235 system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
237 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
238 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
241 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
242 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
246 return SYSTEM_SETTINGS_ERROR_NONE;
251 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
253 int _is_file_accessible(const char *path)
256 int ret = access(path , R_OK);
258 SETTING_TRACE("found the file %s", path);
261 /* error code : 13 */
262 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
267 /* LCOV_EXCL_START */
268 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
272 vconf_value = (char *)value;
274 int ret = _is_file_accessible(vconf_value);
276 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
277 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
280 /* @todo add a common ret_handler */
284 return SYSTEM_SETTINGS_ERROR_NONE;
289 /* LCOV_EXCL_START */
290 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
294 vconf_value = (char *)value;
296 int ret = _is_file_accessible(vconf_value);
298 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
299 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
302 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
303 /* @todo add a common ret_handler */
307 return SYSTEM_SETTINGS_ERROR_NONE;
311 /* LCOV_EXCL_START */
312 static bool dl_is_supported_image_type_load(char *path)
317 bool (*image_type_check)(char *path);
319 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
321 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
325 image_type_check = dlsym(handle, "__is_supported_image_type_load");
326 if ((error = dlerror()) != NULL) {
327 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
332 ret = image_type_check(path);
339 /* LCOV_EXCL_START */
340 static int dl_is_available_font(char *str)
345 int (*check_available_font)(char *font_name);
347 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
349 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
353 check_available_font = dlsym(handle, "__is_available_font");
354 if ((error = dlerror()) != NULL) {
355 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
360 ret = check_available_font(str);
367 /* LCOV_EXCL_START */
368 static void dl_font_size_set()
372 void (*set_font_size)();
374 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
376 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
380 set_font_size = dlsym(handle, "__font_size_set");
381 if ((error = dlerror()) != NULL) {
382 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
394 /* LCOV_EXCL_START */
395 static void dl_font_config_set_notification()
399 void (*set_font_nodification)();
401 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
403 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
407 set_font_nodification = dlsym(handle, "font_config_set_notification");
408 if ((error = dlerror()) != NULL) {
409 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
414 set_font_nodification();
421 /* LCOV_EXCL_START */
422 static bool dl_font_config_set(char *font_name)
427 bool (*check_font_type)(char *font_name);
429 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
431 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
435 check_font_type = dlsym(handle, "font_config_set");
436 if ((error = dlerror()) != NULL) {
437 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
442 ret = check_font_type(font_name);
449 /* LCOV_EXCL_START */
450 static char *dl_get_font_info(char *str)
455 char *(*get_font_info)();
457 handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0", RTLD_LAZY);
459 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
463 if (strcmp(str, "cur") == 0)
464 get_font_info = dlsym(handle, "_get_cur_font");
466 get_font_info = dlsym(handle, "_get_default_font");
468 if ((error = dlerror()) != NULL) {
469 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
474 ret = get_font_info();
481 /* LCOV_EXCL_START */
482 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
483 bool __is_supported_image_type_by_ext(char *file_path)
487 regmatch_t str[2048 + 1];
489 if (!file_path) return false;
492 if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
493 SETTING_TRACE("regular expresstion fail");
498 if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
499 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
502 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
508 #ifdef TIZEN_WEARABLE
509 /* LCOV_EXCL_START */
510 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
514 const char *find_str = "extended_wallpaper_";
517 if (!(ch = strstr(file_path, find_str))) {
518 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
520 strncpy(buffer, file_path, ch - file_path);
521 buffer[ch - file_path] = 0;
522 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
524 if (!isdigit(buffer[0])) {
525 SETTING_TRACE("%s is not number", buffer);
526 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
531 return SYSTEM_SETTINGS_ERROR_NONE;
535 /* LCOV_EXCL_START */
536 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
539 if (!source_file_path || !dest_file_path) {
540 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
546 fd = open(source_file_path, O_RDONLY);
548 SETTING_TRACE("file open failed: %s", source_file_path);
549 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
553 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
555 SETTING_TRACE("file creation failed: %s", dest_file_path);
557 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
560 while (read(fd, buf, sizeof(buf) - 1) > 0) {
561 write(fd2, buf, sizeof(buf) - 1);
567 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
568 SETTING_TRACE("chmod failed: %s", dest_file_path);
571 return SYSTEM_SETTINGS_ERROR_NONE;
575 /* LCOV_EXCL_START */
576 static int system_setting_remove_oldest_extended_wallpaper()
581 char *min_image_name = NULL;
582 unsigned int min_image_num = 0;
583 unsigned int temp_image_num = 0;
586 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
587 SETTING_TRACE("opendir error");
588 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
591 while ((dirp = readdir(dp))) {
592 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
595 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
596 != SYSTEM_SETTINGS_ERROR_NONE) {
597 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
600 if ((image_count == 0) || (min_image_num > temp_image_num)) {
601 min_image_num = temp_image_num;
602 min_image_name = dirp->d_name;
609 if (min_image_name) {
610 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
611 if (remove(buf) < 0) { /* remove oldest image */
612 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
616 return SYSTEM_SETTINGS_ERROR_NONE;
620 /* LCOV_EXCL_START */
621 static int system_setting_check_extended_wallpaper(const char *file_path)
625 if (!file_path || !strlen(file_path))
627 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
628 return (strstr(file_path, buffer) != NULL);
632 #define WALLPAPER_MAX_COUNT 10
634 /* LCOV_EXCL_START */
635 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
639 vconf_value = (char *)value;
641 bool isok = dl_is_supported_image_type_load(vconf_value);
644 SETTING_TRACE("path : %s is not supported file format", vconf_value);
645 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
647 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
650 /* error handling here */
651 if (_is_file_accessible(vconf_value) != 0)
652 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
654 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
655 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
659 #ifdef TIZEN_WEARABLE
660 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
663 unsigned int max_image_num = 0;
664 unsigned int temp_image_num = 0;
667 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
668 SETTING_TRACE("Setting - dir open error!");
669 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
672 /* Check a max number of wallpapers */
673 while ((dirp = readdir(dp))) {
674 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
677 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
678 != SYSTEM_SETTINGS_ERROR_NONE) {
681 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
684 if ((image_count == 0) || (max_image_num < temp_image_num)) {
685 max_image_num = temp_image_num;
693 /* Numbering rule: Gear is odd number */
694 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
697 char file_name_buffer[512];
698 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
699 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
701 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
702 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
703 != SYSTEM_SETTINGS_ERROR_NONE) {
704 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
707 /* remove oldest wallpaper */
708 if (image_count >= WALLPAPER_MAX_COUNT) {
709 if (system_setting_remove_oldest_extended_wallpaper()
710 != SYSTEM_SETTINGS_ERROR_NONE) {
711 remove(file_name_buffer);
712 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
716 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
717 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
720 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
721 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
722 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
725 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
726 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
731 return SYSTEM_SETTINGS_ERROR_NONE;
735 /* LCOV_EXCL_START */
736 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
740 vconf_value = (char *)value;
742 bool isok = dl_is_supported_image_type_load(vconf_value);
745 SETTING_TRACE("path : %s is not supported file format", vconf_value);
746 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
748 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
751 /* error handling here */
752 if (_is_file_accessible(vconf_value) != 0)
753 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
755 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
756 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
759 return SYSTEM_SETTINGS_ERROR_NONE;
763 /* LCOV_EXCL_START */
764 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
768 vconf_value = (int *)value;
770 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
771 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
774 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
775 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
779 return SYSTEM_SETTINGS_ERROR_NONE;
785 /* LCOV_EXCL_START */
786 void *font_conf_doc_parse(char *doc_name, char *font_name)
789 xmlDocPtr doc = NULL;
790 xmlNodePtr cur = NULL;
791 xmlNodePtr cur2 = NULL;
792 xmlNodePtr cur3 = NULL;
795 doc = xmlParseFile(doc_name);
797 cur = xmlDocGetRootElement(doc);
805 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
811 cur = cur->xmlChildrenNode;
813 bool is_changed = false;
814 while (cur != NULL) {
815 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
816 cur2 = cur->xmlChildrenNode;
817 while (cur2 != NULL) {
818 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
819 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
820 /* if name is not 'family', break */
821 if (xmlStrcmp(name, (const xmlChar *)"family")) {
829 cur3 = cur2->xmlChildrenNode;
830 while (cur3 != NULL) {
831 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
832 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
833 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
843 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
844 cur2 = cur->xmlChildrenNode;
845 while (cur2 != NULL) {
846 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
847 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
848 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
852 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
853 cur3 = cur2->xmlChildrenNode;
854 while (cur3 != NULL) {
855 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
856 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
857 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
883 /* LCOV_EXCL_START */
884 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
887 char *font_name = NULL;
888 font_name = (char *)value;
890 /* get current font list */
891 int is_found = dl_is_available_font(font_name);
894 SETTING_TRACE("found font : %s ", font_name);
896 SETTING_TRACE(" NOT found font : %s ", font_name);
897 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
900 bool bsave = dl_font_config_set(font_name);
903 SETTING_TRACE(" font type save error by font_config_set() ");
904 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
906 SETTING_TRACE(" save OK - font_config_set() ");
909 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
911 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
916 dl_font_config_set_notification();
919 vconf_value = (char *)value;
921 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
922 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
924 return SYSTEM_SETTINGS_ERROR_NONE;
928 /* LCOV_EXCL_START */
929 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
933 vconf_value = (bool *)value;
934 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
935 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
937 return SYSTEM_SETTINGS_ERROR_NONE;
941 /* LCOV_EXCL_START */
942 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
946 vconf_value = (bool *)value;
947 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
948 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
950 return SYSTEM_SETTINGS_ERROR_NONE;
955 /* LCOV_EXCL_START */
956 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
960 vconf_value = (bool *)value;
961 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
962 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
965 return SYSTEM_SETTINGS_ERROR_NONE;
969 /* LCOV_EXCL_START */
970 static int category_func(const char *name, void *user_data)
973 static char *category = "lock-screen";
974 if (name && !strcmp(name, category)) {
975 SETTING_TRACE(" SAME ");
978 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
988 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
992 /* LCOV_EXCL_START */
993 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
997 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
1000 pkgmgrinfo_appinfo_h handle;
1001 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1002 if (r != PMINFO_R_OK) {
1003 SETTING_TRACE("*** pkginfo failed ");
1004 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1006 SETTING_TRACE("%x", handle);
1009 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1010 if (ret != PMINFO_R_OK) {
1011 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1012 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1015 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1016 /*----------------------------------------------------------------------------------- */
1018 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1019 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1022 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1023 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1025 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1026 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1029 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1030 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1031 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1034 return SYSTEM_SETTINGS_ERROR_NONE;
1036 /* LCOV_EXCL_STOP */
1038 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1041 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1043 SETTING_TRACE_BEGIN;
1044 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1047 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1049 SETTING_TRACE_BEGIN;
1050 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1053 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1055 SETTING_TRACE_BEGIN;
1056 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1059 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1061 SETTING_TRACE_BEGIN;
1062 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1065 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1067 SETTING_TRACE_BEGIN;
1068 return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1071 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1073 SETTING_TRACE_BEGIN;
1074 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1077 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1079 SETTING_TRACE_BEGIN;
1080 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1083 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1085 SETTING_TRACE_BEGIN;
1086 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1089 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1091 SETTING_TRACE_BEGIN;
1092 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1095 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1097 SETTING_TRACE_BEGIN;
1098 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1101 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1103 SETTING_TRACE_BEGIN;
1104 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1107 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1109 SETTING_TRACE_BEGIN;
1110 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1113 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1115 SETTING_TRACE_BEGIN;
1116 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1119 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1121 SETTING_TRACE_BEGIN;
1122 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1125 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1127 SETTING_TRACE_BEGIN;
1128 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1131 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1133 SETTING_TRACE_BEGIN;
1134 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1139 * @todo need to add custom event notification method
1141 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1143 SETTING_TRACE_BEGIN;
1144 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1147 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1149 SETTING_TRACE_BEGIN;
1150 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1153 /* TODO : 2th argument, callback, is not in use. */
1154 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1156 SETTING_TRACE_BEGIN;
1157 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1160 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1162 SETTING_TRACE_BEGIN;
1163 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1166 /*//////////////////////////////////////////////////////////////////////////////////////// */
1167 /*--------------------------------------- */
1168 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1170 SETTING_TRACE_BEGIN;
1171 char *vconf_value = NULL;
1172 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1173 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1176 /* parsing validation */
1179 snprintf(arr, 20, "%s", vconf_value);
1181 *value = strdup(arr);
1185 return SYSTEM_SETTINGS_ERROR_NONE;
1188 /* LCOV_EXCL_START */
1189 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1191 SETTING_TRACE_BEGIN;
1192 char *vconf_value = NULL;
1193 vconf_value = (char *)value;
1195 char *ext = "UTF-8";
1198 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1200 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1201 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1203 return SYSTEM_SETTINGS_ERROR_NONE;
1205 /* LCOV_EXCL_STOP */
1207 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1209 SETTING_TRACE_BEGIN;
1210 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1213 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1215 SETTING_TRACE_BEGIN;
1216 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1220 /*--------------------------------------- */
1221 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1223 SETTING_TRACE_BEGIN;
1224 char *vconf_value = NULL;
1225 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1226 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1229 /* parsing validation */
1232 snprintf(arr, 20, "%s", vconf_value);
1234 *value = strdup(arr);
1237 return SYSTEM_SETTINGS_ERROR_NONE;
1240 /* LCOV_EXCL_START */
1241 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1243 SETTING_TRACE_BEGIN;
1244 char *vconf_value = NULL;
1245 vconf_value = (char *)value;
1247 char *ext = "UTF-8";
1250 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1252 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1253 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1255 return SYSTEM_SETTINGS_ERROR_NONE;
1257 /* LCOV_EXCL_STOP */
1259 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1261 SETTING_TRACE_BEGIN;
1262 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1263 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1266 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1268 SETTING_TRACE_BEGIN;
1269 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1272 /*--------------------------------------- */
1273 /* LCOV_EXCL_START */
1274 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1276 SETTING_TRACE_BEGIN;
1279 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1280 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1283 bool ret_value = true;
1284 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1286 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1289 *value = (void *)ret_value;
1291 return SYSTEM_SETTINGS_ERROR_NONE;
1293 /* LCOV_EXCL_STOP */
1295 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1297 SETTING_TRACE_BEGIN;
1300 vconf_value = (bool *)value;
1303 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1304 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1308 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1309 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1314 return SYSTEM_SETTINGS_ERROR_NONE;
1317 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1319 SETTING_TRACE_BEGIN;
1320 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1323 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1325 SETTING_TRACE_BEGIN;
1326 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1329 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1331 SETTING_TRACE_BEGIN;
1332 *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1333 return SYSTEM_SETTINGS_ERROR_NONE;
1336 /* LCOV_EXCL_START */
1337 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1339 SETTING_TRACE_BEGIN;
1340 char *vconf_value = NULL;
1341 vconf_value = (char *)value;
1344 snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", vconf_value);
1346 int is_load = _is_file_accessible(tz_path);
1348 alarmmgr_set_timezone(tz_path);
1350 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, vconf_value)) {
1351 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1353 return SYSTEM_SETTINGS_ERROR_NONE;
1355 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1357 /* LCOV_EXCL_STOP */
1361 /* LCOV_EXCL_START */
1362 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1364 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1366 /* LCOV_EXCL_STOP */
1368 /* LCOV_EXCL_START */
1369 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1371 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1373 /* LCOV_EXCL_STOP */
1375 /* LCOV_EXCL_START */
1376 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1378 SETTING_TRACE_BEGIN;
1379 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1381 /* LCOV_EXCL_STOP */
1383 /* LCOV_EXCL_START */
1384 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1386 SETTING_TRACE_BEGIN;
1387 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1389 /* LCOV_EXCL_STOP */
1392 /* LCOV_EXCL_START */
1393 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1395 SETTING_TRACE_BEGIN;
1397 cur_tick = time(NULL);
1398 *value = (void *)cur_tick;
1399 /* struct tm * localtime = time (cur_tick); */
1400 /* printf("%s\n", ctime(&cur_tick); */
1401 return SYSTEM_SETTINGS_ERROR_NONE;
1404 /* LCOV_EXCL_STOP */
1406 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1408 SETTING_TRACE_BEGIN;
1409 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1412 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1414 SETTING_TRACE_BEGIN;
1415 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1420 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1421 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1423 SETTING_TRACE_BEGIN;
1426 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1427 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1429 *value = (void *)vconf_value;
1431 return SYSTEM_SETTINGS_ERROR_NONE;
1434 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1436 SETTING_TRACE_BEGIN;
1437 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1440 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1442 SETTING_TRACE_BEGIN;
1443 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1447 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1449 * a == false, b == false --> silent mode
1450 * a == true, b == false --> sound mode
1451 * a == false, b == true --> vibration mode
1453 /* LCOV_EXCL_START */
1454 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1456 SETTING_TRACE_BEGIN;
1461 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1462 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1465 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1466 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1469 if (sound_cond == false && vib_cond == false) {
1471 *value = (void *)vconf_value;
1473 vconf_value = false;
1474 *value = (void *)vconf_value;
1476 return SYSTEM_SETTINGS_ERROR_NONE;
1478 /* LCOV_EXCL_STOP */
1481 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1483 * a == false, b == false --> silent mode
1484 * a == true, b == false --> sound mode
1486 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1488 SETTING_TRACE_BEGIN;
1491 vconf_value = (bool *)value;
1493 bool vconf_sound = false;
1494 bool vconf_vib = false;
1497 vconf_sound = false;
1504 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1505 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1507 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1508 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1511 return SYSTEM_SETTINGS_ERROR_NONE;
1517 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1519 SETTING_TRACE_BEGIN;
1520 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1524 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1526 SETTING_TRACE_BEGIN;
1527 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1530 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1531 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1533 SETTING_TRACE_BEGIN;
1536 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1537 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1540 *value = (void *)vconf_value;
1544 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1546 SETTING_TRACE_BEGIN;
1547 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1550 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1552 SETTING_TRACE_BEGIN;
1553 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1557 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1558 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1562 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1563 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1565 *value = (void *)vconf_value;
1567 return SYSTEM_SETTINGS_ERROR_NONE;
1571 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1573 SETTING_TRACE_BEGIN;
1576 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1577 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1579 *value = (void *)vconf_value;
1581 return SYSTEM_SETTINGS_ERROR_NONE;
1584 /* LCOV_EXCL_START */
1585 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1587 SETTING_TRACE_BEGIN;
1589 vconf_value = (bool *)value;
1590 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1591 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1594 return SYSTEM_SETTINGS_ERROR_NONE;
1596 /* LCOV_EXCL_STOP */
1598 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1600 SETTING_TRACE_BEGIN;
1601 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1604 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1606 SETTING_TRACE_BEGIN;
1607 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1610 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1612 SETTING_TRACE_BEGIN;
1615 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1616 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1618 *value = (void *)vconf_value;
1620 return SYSTEM_SETTINGS_ERROR_NONE;
1624 /* LCOV_EXCL_START */
1625 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1627 SETTING_TRACE_BEGIN;
1629 vconf_value = (int *)value;
1631 if (!(*vconf_value > 0 && *vconf_value < 600)) {
1632 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1633 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1636 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1637 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1640 return SYSTEM_SETTINGS_ERROR_NONE;
1642 /* LCOV_EXCL_STOP */
1644 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1646 SETTING_TRACE_BEGIN;
1647 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1650 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1652 SETTING_TRACE_BEGIN;
1653 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1656 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1658 SETTING_TRACE_BEGIN;
1659 char *vconf_value = NULL;
1660 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1661 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1664 *value = vconf_value;
1665 return SYSTEM_SETTINGS_ERROR_NONE;
1668 /* LCOV_EXCL_START */
1669 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1671 SETTING_TRACE_BEGIN;
1672 char *vconf_value = NULL;
1673 vconf_value = (char *)value;
1675 int is_load = _is_file_accessible(vconf_value);
1677 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1678 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1681 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1684 return SYSTEM_SETTINGS_ERROR_NONE;
1686 /* LCOV_EXCL_STOP */
1688 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1690 SETTING_TRACE_BEGIN;
1691 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1694 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1696 SETTING_TRACE_BEGIN;
1697 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1700 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1702 SETTING_TRACE_BEGIN;
1705 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1706 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1708 *value = (void *)vconf_value;
1710 return SYSTEM_SETTINGS_ERROR_NONE;
1713 /* LCOV_EXCL_START */
1714 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1716 SETTING_TRACE_BEGIN;
1718 vconf_value = (int *)value;
1720 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1721 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1724 return SYSTEM_SETTINGS_ERROR_NONE;
1726 /* LCOV_EXCL_STOP */
1728 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1730 SETTING_TRACE_BEGIN;
1731 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);
1734 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1736 SETTING_TRACE_BEGIN;
1737 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1740 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1742 SETTING_TRACE_BEGIN;
1743 char *vconf_value = NULL;
1744 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1745 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1748 *value = vconf_value;
1749 return SYSTEM_SETTINGS_ERROR_NONE;
1752 /* LCOV_EXCL_START */
1753 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1755 SETTING_TRACE_BEGIN;
1756 char *vconf_value = NULL;
1757 vconf_value = (char *)value;
1759 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1760 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1763 return SYSTEM_SETTINGS_ERROR_NONE;
1765 /* LCOV_EXCL_STOP */
1767 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1769 SETTING_TRACE_BEGIN;
1770 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1773 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1775 SETTING_TRACE_BEGIN;
1776 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1779 /*---------------------------------------------- */
1780 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1782 SETTING_TRACE_BEGIN;
1784 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1785 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1787 *value = (void *)vconf_value;
1789 return SYSTEM_SETTINGS_ERROR_NONE;
1792 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1794 SETTING_TRACE_BEGIN;
1795 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1798 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1800 SETTING_TRACE_BEGIN;
1801 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1804 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1806 SETTING_TRACE_BEGIN;
1808 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1809 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1812 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1814 *value = (void *)bret;
1815 return SYSTEM_SETTINGS_ERROR_NONE;
1818 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1820 SETTING_TRACE_BEGIN;
1821 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1824 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1826 SETTING_TRACE_BEGIN;
1827 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1830 /* LCOV_EXCL_START */
1831 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1835 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1836 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1838 *value = (void *)vconf_value;
1840 return SYSTEM_SETTINGS_ERROR_NONE;
1842 /* LCOV_EXCL_STOP */
1844 /* LCOV_EXCL_START */
1845 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1847 SETTING_TRACE_BEGIN;
1849 vconf_value = (int *)value;
1851 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1852 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1855 return SYSTEM_SETTINGS_ERROR_NONE;
1857 /* LCOV_EXCL_STOP */
1859 /* LCOV_EXCL_START */
1860 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1862 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1864 /* LCOV_EXCL_STOP */
1866 /* LCOV_EXCL_START */
1867 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1869 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
1871 /* LCOV_EXCL_STOP */