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>
36 #include <libxml/xmlmemory.h>
37 #include <libxml/parser.h>
39 #include <fontconfig/fontconfig.h>
41 #include <pkgmgr-info.h>
42 #include <package_manager.h>
43 #include <app_manager.h>
45 #include <system_settings.h>
46 #include <system_settings_private.h>
47 #include <system_settings_ringtones.h>
48 #include <system_settings_json.h>
50 #include <system-setting-config.h>
52 #include <tzplatform_config.h>
55 #include <system_info.h>
57 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
58 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
60 #define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/"
61 #define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale"
62 #define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime"
65 #define __FREE(del, arg) do { \
67 del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
71 #define FREE(arg) __FREE(free, arg)
73 #ifdef SETTING_ARCH_64
74 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
76 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
79 int _is_file_accessible(const char *path);
81 static bool dl_is_supported_image_type_load(char *path);
82 static bool dl_font_config_set(char *font_name);
83 static char *dl_get_default_font_info();
84 static int dl_is_available_font(char *str);
85 static void dl_font_size_set();
86 static void dl_font_config_set_notification();
89 * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
90 * @return the ringtone file path specified by user in normal case
91 * if it's not accessable, return the default ringtone path
93 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, void **value)
97 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
98 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
101 /* check to see if it's accessable -> OK */
102 /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
103 int is_load = _is_file_accessible(vconf_value);
105 *value = vconf_value;
106 } else { /* not zero on errro */
107 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
110 /**value = vconf_value; */
111 return SYSTEM_SETTINGS_ERROR_NONE;
115 int system_setting_get_email_alert_ringtone(system_settings_key_e key, void **value)
119 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
120 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
123 /* check to see if it's accessable -> OK */
124 /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
125 int is_load = _is_file_accessible(vconf_value);
127 *value = vconf_value;
128 } else { /* not zero on errro */
129 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
132 return SYSTEM_SETTINGS_ERROR_NONE;
136 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, void **value)
140 if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
141 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
143 *value = vconf_value;
144 return SYSTEM_SETTINGS_ERROR_NONE;
148 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, void **value)
153 if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
154 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
156 *value = vconf_value;
158 return SYSTEM_SETTINGS_ERROR_NONE;
162 /* [int] vconf GET */
163 int system_setting_get_font_size(system_settings_key_e key, void **value)
167 int ** val = (int**)value;
169 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
170 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
174 return SYSTEM_SETTINGS_ERROR_NONE;
178 int system_setting_get_default_font_type(system_settings_key_e key, void **value)
181 char *font_name = dl_get_default_font_info();
183 *value = (void *)font_name;
184 return SYSTEM_SETTINGS_ERROR_NONE;
186 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
190 /* [int] vconf GET */
191 int system_setting_get_font_type(system_settings_key_e key, void **value)
194 char *font_name = NULL;
196 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, &font_name)) {
197 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
201 return SYSTEM_SETTINGS_ERROR_NONE;
205 int system_setting_get_motion_activation(system_settings_key_e key, void **value)
210 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
211 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
213 *value = (void *)vconf_value;
215 return SYSTEM_SETTINGS_ERROR_NONE;
218 int system_setting_get_usb_debugging_option(system_settings_key_e key, void **value)
223 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
224 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
226 *value = (void *)vconf_value;
228 return SYSTEM_SETTINGS_ERROR_NONE;
231 int system_setting_get_3g_data_network(system_settings_key_e key, void **value)
236 if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
237 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
239 *value = (void *)vconf_value;
241 return SYSTEM_SETTINGS_ERROR_NONE;
243 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
247 * get current lock scren app package name (string)
249 * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
251 int system_setting_get_lockscreen_app(system_settings_key_e key, void **value)
254 char *pkg_name = NULL;
256 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
257 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
260 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
261 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
264 if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
265 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
269 return SYSTEM_SETTINGS_ERROR_NONE;
273 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
275 int _is_file_accessible(const char *path)
278 int ret = access(path , R_OK);
280 SETTING_TRACE("found the file %s", path);
283 /* error code : 13 */
284 SETTING_TRACE("found the file %s --- error code : %d ", path, errno);
291 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
292 // @todo move to CMake
293 #define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones"
295 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
296 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
299 static char* _get_json_file_path()
306 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value)
309 char* pathval = (char*)value;
310 char* dnameval = NULL;
311 char* baseval = NULL;
315 JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
317 JsonParser *parser = ss_json_ringtone_load_from_data();
320 JsonNode *root = json_parser_get_root(parser);
324 int ret = SYSTEM_SETTINGS_ERROR_NONE;
325 if (false == ss_json_ringtone_contain(root, pathval)) {
326 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
327 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
328 SETTING_TRACE("pathval is : %s -- OK", pathval);
330 SETTING_TRACE("pathval is duplicated : %s", pathval);
331 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
334 dnameval = strdup(pathval);
335 baseval = strdup(pathval);
336 if (dnameval && baseval) {
337 SETTING_TRACE("---> dirname is : %s ", dirname(dnameval));
338 SETTING_TRACE("---> basename is : %s ", basename(baseval));
344 g_object_unref(parser);
351 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value)
354 char* pathval = (char*)value;
357 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
359 JsonParser* parser = ss_json_ringtone_load_from_data();
361 JsonNode *root = json_parser_get_root(parser);
363 ss_json_ringtone_remove(root, JSONFILE, pathval);
364 //void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del)
366 ss_json_ringtone_print(root);
368 g_object_unref(parser);
372 return SYSTEM_SETTINGS_ERROR_NONE;
376 /* LCOV_EXCL_START */
377 static int _compare_cb(const void *d1, const void *d2)
379 fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
380 fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
382 return strcmp(pNode1->media_name, pNode2->media_name);
387 * get the RINGTONE list
389 static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
393 Eina_List *filelist = NULL;
395 fileNodeInfo *node = NULL;
398 //-----------------------------------------------------------------------------------------------------------------
399 // 1. get the default ringtone list
400 //-----------------------------------------------------------------------------------------------------------------
401 int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
403 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
405 filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
407 EINA_LIST_FOREACH(filelist, l, node)
409 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
410 // @todo assert NULL check
413 snprintf(temp, 1024, "%s/%s", node->path, node->name);
414 char* path = strdup(temp);
415 bool ret = callback(idx, (void *)(path), data);
421 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
426 SETTING_TRACE("--> system_setting_data_iterator is NULL");
432 EINA_LIST_FOREACH(filelist, l, node)
436 FREE(node->media_name);
439 eina_list_free(filelist);
444 static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
450 JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
452 JsonParser* parser = ss_json_ringtone_load_from_data();
455 JsonNode *root = json_parser_get_root(parser);
456 int size = json_array_get_length(json_node_get_array(root));
459 for (i = 0; i < size ; i++) {
460 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
461 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
462 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
463 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
465 char* path = strdup(pathval);
466 bool ret = callback(i, (void *)(path), data);
468 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
472 SETTING_TRACE("--> callback is NULL");
477 int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data)
481 _get_default_ringtones(key, callback, data);
482 //-----------------------------------------------------------------------------------------------------------------
483 // 2. get the USER ringtone list
484 //-----------------------------------------------------------------------------------------------------------------
485 _get_user_ringtones(key, callback, data);
487 return SYSTEM_SETTINGS_ERROR_NONE;
491 /* LCOV_EXCL_START */
492 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, void *value)
496 vconf_value = (char *)value;
498 int ret = _is_file_accessible(vconf_value);
500 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
501 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
504 /* @todo add a common ret_handler */
508 return SYSTEM_SETTINGS_ERROR_NONE;
513 /* LCOV_EXCL_START */
514 int system_setting_set_email_alert_ringtone(system_settings_key_e key, void *value)
518 vconf_value = (char *)value;
520 int ret = _is_file_accessible(vconf_value);
522 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
523 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
526 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
527 /* @todo add a common ret_handler */
531 return SYSTEM_SETTINGS_ERROR_NONE;
535 /* LCOV_EXCL_START */
536 static bool dl_is_supported_image_type_load(char *path)
541 bool (*image_type_check)(char *path);
543 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
545 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
549 image_type_check = dlsym(handle, "__is_supported_image_type_load");
550 if ((error = dlerror()) != NULL) {
551 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
556 ret = image_type_check(path);
563 /* LCOV_EXCL_START */
564 static int dl_is_available_font(char *str)
569 int (*check_available_font)(char *font_name);
571 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
573 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
577 check_available_font = dlsym(handle, "__is_available_font");
578 if ((error = dlerror()) != NULL) {
579 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
584 ret = check_available_font(str);
591 /* LCOV_EXCL_START */
592 static void dl_font_size_set()
596 void (*set_font_size)();
598 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
600 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
604 set_font_size = dlsym(handle, "__font_size_set");
605 if ((error = dlerror()) != NULL) {
606 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
618 /* LCOV_EXCL_START */
619 static void dl_font_config_set_notification()
623 void (*set_font_nodification)();
625 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
627 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
631 set_font_nodification = dlsym(handle, "font_config_set_notification");
632 if ((error = dlerror()) != NULL) {
633 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
638 set_font_nodification();
645 /* LCOV_EXCL_START */
646 static bool dl_font_config_set(char *font_name)
651 bool (*check_font_type)(char *font_name);
653 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
655 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
659 check_font_type = dlsym(handle, "font_config_set");
660 if ((error = dlerror()) != NULL) {
661 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
666 ret = check_font_type(font_name);
673 /* LCOV_EXCL_START */
674 static char *dl_get_default_font_info()
679 char *(*get_font_info)();
681 handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY);
683 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
687 get_font_info = dlsym(handle, "_get_default_font");
689 if ((error = dlerror()) != NULL) {
690 SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so.0.1.0");
695 ret = get_font_info();
702 #ifdef TIZEN_WEARABLE
703 /* LCOV_EXCL_START */
704 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
708 const char *find_str = "extended_wallpaper_";
711 if (!(ch = strstr(file_path, find_str))) {
712 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
714 strncpy(buffer, file_path, ch - file_path);
715 buffer[ch - file_path] = 0;
716 sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
718 if (!isdigit(buffer[0])) {
719 SETTING_TRACE("%s is not number", buffer);
720 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
725 return SYSTEM_SETTINGS_ERROR_NONE;
729 /* LCOV_EXCL_START */
730 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
733 if (!source_file_path || !dest_file_path) {
734 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
740 fd = open(source_file_path, O_RDONLY);
742 SETTING_TRACE("file open failed: %s", source_file_path);
743 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
747 fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
749 SETTING_TRACE("file creation failed: %s", dest_file_path);
751 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
754 while (read(fd, buf, sizeof(buf) - 1) > 0) {
755 write(fd2, buf, sizeof(buf) - 1);
761 if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
762 SETTING_TRACE("chmod failed: %s", dest_file_path);
765 return SYSTEM_SETTINGS_ERROR_NONE;
769 /* LCOV_EXCL_START */
770 static int system_setting_remove_oldest_extended_wallpaper()
775 char *min_image_name = NULL;
776 unsigned int min_image_num = 0;
777 unsigned int temp_image_num = 0;
780 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
781 SETTING_TRACE("opendir error");
782 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
785 while ((dirp = readdir(dp))) {
786 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
789 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
790 != SYSTEM_SETTINGS_ERROR_NONE) {
791 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
794 if ((image_count == 0) || (min_image_num > temp_image_num)) {
795 min_image_num = temp_image_num;
796 min_image_name = dirp->d_name;
803 if (min_image_name) {
804 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
805 if (remove(buf) < 0) { /* remove oldest image */
806 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
810 return SYSTEM_SETTINGS_ERROR_NONE;
814 /* LCOV_EXCL_START */
815 static int system_setting_check_extended_wallpaper(const char *file_path)
819 if (!file_path || !strlen(file_path))
821 snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
822 return (strstr(file_path, buffer) != NULL);
826 #define WALLPAPER_MAX_COUNT 10
828 /* LCOV_EXCL_START */
829 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, void *value)
833 vconf_value = (char *)value;
835 bool isok = dl_is_supported_image_type_load(vconf_value);
838 SETTING_TRACE("path : %s is not supported file format", vconf_value);
839 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
841 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
844 /* error handling here */
845 if (_is_file_accessible(vconf_value) != 0)
846 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
848 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
849 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
853 #ifdef TIZEN_WEARABLE
854 if (system_setting_check_extended_wallpaper(vconf_value)) { /* New extended wallpaper */
857 unsigned int max_image_num = 0;
858 unsigned int temp_image_num = 0;
861 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
862 SETTING_TRACE("Setting - dir open error!");
863 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
866 /* Check a max number of wallpapers */
867 while ((dirp = readdir(dp))) {
868 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
871 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
872 != SYSTEM_SETTINGS_ERROR_NONE) {
875 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
878 if ((image_count == 0) || (max_image_num < temp_image_num)) {
879 max_image_num = temp_image_num;
887 /* Numbering rule: Gear is odd number */
888 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
891 char file_name_buffer[512];
892 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
893 _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
895 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
896 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
897 != SYSTEM_SETTINGS_ERROR_NONE) {
898 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
901 /* remove oldest wallpaper */
902 if (image_count >= WALLPAPER_MAX_COUNT) {
903 if (system_setting_remove_oldest_extended_wallpaper()
904 != SYSTEM_SETTINGS_ERROR_NONE) {
905 remove(file_name_buffer);
906 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
910 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
911 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
914 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
915 VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
916 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
919 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
920 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
925 return SYSTEM_SETTINGS_ERROR_NONE;
929 /* LCOV_EXCL_START */
930 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, void *value)
934 vconf_value = (char *)value;
936 bool isok = dl_is_supported_image_type_load(vconf_value);
939 SETTING_TRACE("path : %s is not supported file format", vconf_value);
940 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
942 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
945 /* error handling here */
946 if (_is_file_accessible(vconf_value) != 0)
947 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
949 if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
950 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
953 return SYSTEM_SETTINGS_ERROR_NONE;
957 /* LCOV_EXCL_START */
958 int system_setting_set_font_size(system_settings_key_e key, void *value)
962 vconf_value = *(int **)value;
964 if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
965 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
968 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
969 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
973 return SYSTEM_SETTINGS_ERROR_NONE;
979 /* LCOV_EXCL_START */
980 void *font_conf_doc_parse(char *doc_name, char *font_name)
983 xmlDocPtr doc = NULL;
984 xmlNodePtr cur = NULL;
985 xmlNodePtr cur2 = NULL;
986 xmlNodePtr cur3 = NULL;
989 doc = xmlParseFile(doc_name);
991 cur = xmlDocGetRootElement(doc);
999 if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1005 cur = cur->xmlChildrenNode;
1007 bool is_changed = false;
1008 while (cur != NULL) {
1009 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1010 cur2 = cur->xmlChildrenNode;
1011 while (cur2 != NULL) {
1012 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1013 xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1014 /* if name is not 'family', break */
1015 if (xmlStrcmp(name, (const xmlChar *)"family")) {
1023 cur3 = cur2->xmlChildrenNode;
1024 while (cur3 != NULL) {
1025 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1026 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1027 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1037 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1038 cur2 = cur->xmlChildrenNode;
1039 while (cur2 != NULL) {
1040 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1041 xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1042 key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1046 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1047 cur3 = cur2->xmlChildrenNode;
1048 while (cur3 != NULL) {
1049 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1050 xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1051 key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1075 /* LCOV_EXCL_STOP */
1077 /* LCOV_EXCL_START */
1078 int system_setting_set_font_type(system_settings_key_e key, void *value)
1080 SETTING_TRACE_BEGIN;
1081 char *font_name = NULL;
1082 font_name = (char *)value;
1084 /* get current font list */
1085 int is_found = dl_is_available_font(font_name);
1087 if (is_found == 1) {
1088 SETTING_TRACE("found font : %s ", font_name);
1090 SETTING_TRACE(" NOT found font : %s ", font_name);
1091 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1094 bool bsave = dl_font_config_set(font_name);
1097 SETTING_TRACE(" font type save error by font_config_set() ");
1098 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1100 SETTING_TRACE(" save OK - font_config_set() ");
1103 xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1105 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1110 dl_font_config_set_notification();
1113 vconf_value = (char *)value;
1115 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1116 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1118 return SYSTEM_SETTINGS_ERROR_NONE;
1120 /* LCOV_EXCL_STOP */
1122 /* LCOV_EXCL_START */
1123 int system_setting_set_motion_activation(system_settings_key_e key, void *value)
1125 SETTING_TRACE_BEGIN;
1127 vconf_value = (bool *)value;
1128 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1129 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1131 return SYSTEM_SETTINGS_ERROR_NONE;
1133 /* LCOV_EXCL_STOP */
1135 /* LCOV_EXCL_START */
1136 int system_setting_set_usb_debugging_option(system_settings_key_e key, void *value)
1138 SETTING_TRACE_BEGIN;
1140 vconf_value = (bool *)value;
1141 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1142 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1144 return SYSTEM_SETTINGS_ERROR_NONE;
1147 /* LCOV_EXCL_STOP */
1149 /* LCOV_EXCL_START */
1150 int system_setting_set_3g_data_network(system_settings_key_e key, void *value)
1152 SETTING_TRACE_BEGIN;
1154 vconf_value = (bool *)value;
1155 if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1156 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1159 return SYSTEM_SETTINGS_ERROR_NONE;
1161 /* LCOV_EXCL_STOP */
1163 /* LCOV_EXCL_START */
1164 static int category_func(const char *name, void *user_data)
1166 SETTING_TRACE_BEGIN;
1167 static char *category = "lock-screen";
1168 if (name && !strcmp(name, category)) {
1169 SETTING_TRACE(" SAME ");
1172 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1178 /* LCOV_EXCL_STOP */
1182 * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1186 /* LCOV_EXCL_START */
1187 int system_setting_set_lockscreen_app(system_settings_key_e key, void *value)
1189 SETTING_TRACE_BEGIN;
1191 vconf_value = (char *)value; /* ex) com.samsung.lockscreen */
1194 pkgmgrinfo_appinfo_h handle;
1195 r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1196 if (r != PMINFO_R_OK) {
1197 SETTING_TRACE("*** pkginfo failed ");
1198 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1200 SETTING_TRACE("%x", handle);
1203 int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1204 if (ret != PMINFO_R_OK) {
1205 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1206 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1209 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1210 /*----------------------------------------------------------------------------------- */
1212 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1213 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1216 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1217 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1219 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1220 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1223 if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1224 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1225 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1228 return SYSTEM_SETTINGS_ERROR_NONE;
1230 /* LCOV_EXCL_STOP */
1232 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1235 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1237 SETTING_TRACE_BEGIN;
1238 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1241 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1243 SETTING_TRACE_BEGIN;
1244 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1247 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1249 SETTING_TRACE_BEGIN;
1250 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1253 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1255 SETTING_TRACE_BEGIN;
1256 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1259 int system_setting_set_changed_callback_wallpaper_home_screen(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_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1265 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1267 SETTING_TRACE_BEGIN;
1268 return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1271 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1273 SETTING_TRACE_BEGIN;
1274 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1277 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1279 SETTING_TRACE_BEGIN;
1280 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1283 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1285 SETTING_TRACE_BEGIN;
1286 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1289 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1291 SETTING_TRACE_BEGIN;
1292 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1295 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1297 SETTING_TRACE_BEGIN;
1298 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1301 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1303 SETTING_TRACE_BEGIN;
1304 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1307 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1309 SETTING_TRACE_BEGIN;
1310 return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1313 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1315 SETTING_TRACE_BEGIN;
1316 return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1319 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1321 SETTING_TRACE_BEGIN;
1322 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1325 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1327 SETTING_TRACE_BEGIN;
1328 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1333 * @todo need to add custom event notification method
1335 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1337 SETTING_TRACE_BEGIN;
1338 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1341 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1343 SETTING_TRACE_BEGIN;
1344 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1347 /* TODO : 2th argument, callback, is not in use. */
1348 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1350 SETTING_TRACE_BEGIN;
1351 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1354 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1356 SETTING_TRACE_BEGIN;
1357 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1360 /*//////////////////////////////////////////////////////////////////////////////////////// */
1361 /*--------------------------------------- */
1362 int system_setting_get_locale_country(system_settings_key_e key, void **value)
1364 SETTING_TRACE_BEGIN;
1365 char *vconf_value = NULL;
1366 if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1367 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1370 /* parsing validation */
1373 snprintf(arr, 20, "%s", vconf_value);
1375 *value = strdup(arr);
1379 return SYSTEM_SETTINGS_ERROR_NONE;
1382 /* LCOV_EXCL_START */
1383 int system_setting_set_locale_country(system_settings_key_e key, void *value)
1385 SETTING_TRACE_BEGIN;
1386 char *vconf_value = NULL;
1387 vconf_value = (char *)value;
1389 char *ext = "UTF-8";
1392 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1394 if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1395 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1397 return SYSTEM_SETTINGS_ERROR_NONE;
1399 /* LCOV_EXCL_STOP */
1401 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1403 SETTING_TRACE_BEGIN;
1404 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1407 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1409 SETTING_TRACE_BEGIN;
1410 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1414 /*--------------------------------------- */
1415 int system_setting_get_locale_language(system_settings_key_e key, void **value)
1417 SETTING_TRACE_BEGIN;
1418 char *vconf_value = NULL;
1419 if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1420 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1423 /* parsing validation */
1426 snprintf(arr, 20, "%s", vconf_value);
1428 *value = strdup(arr);
1431 return SYSTEM_SETTINGS_ERROR_NONE;
1434 /* LCOV_EXCL_START */
1435 int system_setting_set_locale_language(system_settings_key_e key, void *value)
1437 SETTING_TRACE_BEGIN;
1438 char *vconf_value = NULL;
1439 vconf_value = (char *)value;
1441 char *ext = "UTF-8";
1444 snprintf(arr, 20, "%s.%s", vconf_value, ext);
1446 if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1447 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1449 return SYSTEM_SETTINGS_ERROR_NONE;
1451 /* LCOV_EXCL_STOP */
1453 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1455 SETTING_TRACE_BEGIN;
1456 /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1457 return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1460 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1462 SETTING_TRACE_BEGIN;
1463 return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1466 /*--------------------------------------- */
1467 /* LCOV_EXCL_START */
1468 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, void **value)
1470 SETTING_TRACE_BEGIN;
1473 if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1474 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1477 bool ret_value = true;
1478 if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1480 else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1483 *value = (void *)ret_value;
1485 return SYSTEM_SETTINGS_ERROR_NONE;
1487 /* LCOV_EXCL_STOP */
1489 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, void *value)
1491 SETTING_TRACE_BEGIN;
1494 vconf_value = (bool *)value;
1497 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1498 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1502 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1503 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1508 return SYSTEM_SETTINGS_ERROR_NONE;
1511 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1513 SETTING_TRACE_BEGIN;
1514 return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1517 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1519 SETTING_TRACE_BEGIN;
1520 return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1523 int system_setting_get_locale_timezone(system_settings_key_e key, void **value)
1526 ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1530 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1531 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1534 SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1535 *value = strdup(&tzpath[20]);
1536 return SYSTEM_SETTINGS_ERROR_NONE;
1539 /* LCOV_EXCL_START */
1540 int system_setting_set_locale_timezone(system_settings_key_e key, void *value)
1542 SETTING_TRACE_BEGIN;
1543 char *timezone_value = NULL;
1544 timezone_value = (char *)value;
1547 snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1549 int is_load = _is_file_accessible(tz_path);
1551 alarmmgr_set_timezone(tz_path);
1553 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1554 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1556 return SYSTEM_SETTINGS_ERROR_NONE;
1558 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1560 /* LCOV_EXCL_STOP */
1564 /* LCOV_EXCL_START */
1565 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1567 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1569 /* LCOV_EXCL_STOP */
1571 /* LCOV_EXCL_START */
1572 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1574 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1576 /* LCOV_EXCL_STOP */
1578 /* LCOV_EXCL_START */
1579 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1581 SETTING_TRACE_BEGIN;
1582 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1584 /* LCOV_EXCL_STOP */
1586 /* LCOV_EXCL_START */
1587 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1589 SETTING_TRACE_BEGIN;
1590 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1592 /* LCOV_EXCL_STOP */
1595 /* LCOV_EXCL_START */
1596 int system_setting_get_time_changed(system_settings_key_e key, void **value)
1598 SETTING_TRACE_BEGIN;
1600 int ** val = (int**)value;
1601 cur_tick = time(NULL);
1603 /* struct tm * localtime = time (cur_tick); */
1604 /* printf("%s\n", ctime(&cur_tick); */
1605 return SYSTEM_SETTINGS_ERROR_NONE;
1608 /* LCOV_EXCL_STOP */
1610 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1612 SETTING_TRACE_BEGIN;
1613 return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1616 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1618 SETTING_TRACE_BEGIN;
1619 return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1624 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1625 int system_setting_get_sound_lock(system_settings_key_e key, void **value)
1627 SETTING_TRACE_BEGIN;
1630 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1631 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1633 *value = (void *)vconf_value;
1635 return SYSTEM_SETTINGS_ERROR_NONE;
1638 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1640 SETTING_TRACE_BEGIN;
1641 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1644 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1646 SETTING_TRACE_BEGIN;
1647 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1651 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1653 * a == false, b == false --> silent mode
1654 * a == true, b == false --> sound mode
1655 * a == false, b == true --> vibration mode
1657 /* LCOV_EXCL_START */
1658 int system_setting_get_sound_silent_mode(system_settings_key_e key, void **value)
1660 SETTING_TRACE_BEGIN;
1665 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1666 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1669 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1670 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1673 if (sound_cond == false && vib_cond == false) {
1675 *value = (void *)vconf_value;
1677 vconf_value = false;
1678 *value = (void *)vconf_value;
1680 return SYSTEM_SETTINGS_ERROR_NONE;
1682 /* LCOV_EXCL_STOP */
1685 * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1687 * a == false, b == false --> silent mode
1688 * a == true, b == false --> sound mode
1690 int system_setting_set_sound_silent_mode(system_settings_key_e key, void *value)
1692 SETTING_TRACE_BEGIN;
1695 vconf_value = (bool *)value;
1697 bool vconf_sound = false;
1698 bool vconf_vib = false;
1701 vconf_sound = false;
1708 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1709 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1711 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1712 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1715 return SYSTEM_SETTINGS_ERROR_NONE;
1721 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1723 SETTING_TRACE_BEGIN;
1724 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1728 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1730 SETTING_TRACE_BEGIN;
1731 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1734 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1735 int system_setting_get_sound_touch(system_settings_key_e key, void **value)
1737 SETTING_TRACE_BEGIN;
1740 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1741 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1744 *value = (void *)vconf_value;
1748 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1750 SETTING_TRACE_BEGIN;
1751 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1754 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1756 SETTING_TRACE_BEGIN;
1757 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1761 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1762 int system_setting_get_sound_lock(system_settings_key_e key, void **value)
1766 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1767 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1769 *value = (void *)vconf_value;
1771 return SYSTEM_SETTINGS_ERROR_NONE;
1775 int system_setting_get_auto_rotation_mode(system_settings_key_e key, void **value)
1777 SETTING_TRACE_BEGIN;
1780 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1781 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1783 *value = (void *)vconf_value;
1785 return SYSTEM_SETTINGS_ERROR_NONE;
1788 /* LCOV_EXCL_START */
1789 int system_setting_set_auto_rotation_mode(system_settings_key_e key, void *value)
1791 SETTING_TRACE_BEGIN;
1793 vconf_value = (bool *)value;
1794 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1795 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1798 return SYSTEM_SETTINGS_ERROR_NONE;
1800 /* LCOV_EXCL_STOP */
1802 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1804 SETTING_TRACE_BEGIN;
1805 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1808 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1810 SETTING_TRACE_BEGIN;
1811 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1814 int system_setting_get_screen_backlight_time(system_settings_key_e key, void **value)
1816 SETTING_TRACE_BEGIN;
1818 int ** val = (int**)value;
1820 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1821 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1823 **val = vconf_value;
1825 return SYSTEM_SETTINGS_ERROR_NONE;
1829 /* LCOV_EXCL_START */
1830 int system_setting_set_screen_backlight_time(system_settings_key_e key, void *value)
1832 SETTING_TRACE_BEGIN;
1834 vconf_value = *(int **)value;
1836 if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1837 SETTING_TRACE(" ERR Betweeny here 0 ~ 600");
1838 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1841 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1842 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1845 return SYSTEM_SETTINGS_ERROR_NONE;
1847 /* LCOV_EXCL_STOP */
1849 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1851 SETTING_TRACE_BEGIN;
1852 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
1855 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1857 SETTING_TRACE_BEGIN;
1858 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1861 int system_setting_get_sound_notification(system_settings_key_e key, void **value)
1863 SETTING_TRACE_BEGIN;
1864 char *vconf_value = NULL;
1865 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1866 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1869 *value = vconf_value;
1870 return SYSTEM_SETTINGS_ERROR_NONE;
1873 /* LCOV_EXCL_START */
1874 int system_setting_set_sound_notification(system_settings_key_e key, void *value)
1876 SETTING_TRACE_BEGIN;
1877 char *vconf_value = NULL;
1878 vconf_value = (char *)value;
1880 int is_load = _is_file_accessible(vconf_value);
1882 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1883 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1884 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1885 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1888 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1889 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1892 return SYSTEM_SETTINGS_ERROR_NONE;
1894 /* LCOV_EXCL_STOP */
1896 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1898 SETTING_TRACE_BEGIN;
1899 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
1902 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1904 SETTING_TRACE_BEGIN;
1905 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1908 int system_setting_get_notification_repetition_period(system_settings_key_e key, void **value)
1910 SETTING_TRACE_BEGIN;
1911 int ** val = (int**)value;
1914 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1915 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1917 **val = vconf_value;
1919 return SYSTEM_SETTINGS_ERROR_NONE;
1922 /* LCOV_EXCL_START */
1923 int system_setting_set_notification_repetition_period(system_settings_key_e key, void *value)
1925 SETTING_TRACE_BEGIN;
1927 vconf_value = *(int **)value;
1929 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1930 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1933 return SYSTEM_SETTINGS_ERROR_NONE;
1935 /* LCOV_EXCL_STOP */
1937 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1939 SETTING_TRACE_BEGIN;
1940 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);
1943 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1945 SETTING_TRACE_BEGIN;
1946 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1949 int system_setting_get_device_name(system_settings_key_e key, void **value)
1951 SETTING_TRACE_BEGIN;
1952 char *vconf_value = NULL;
1953 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1954 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1957 *value = vconf_value;
1958 return SYSTEM_SETTINGS_ERROR_NONE;
1961 /* LCOV_EXCL_START */
1962 int system_setting_set_device_name(system_settings_key_e key, void *value)
1964 SETTING_TRACE_BEGIN;
1965 char *vconf_value = NULL;
1966 vconf_value = (char *)value;
1968 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1969 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1972 return SYSTEM_SETTINGS_ERROR_NONE;
1974 /* LCOV_EXCL_STOP */
1976 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1978 SETTING_TRACE_BEGIN;
1979 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1982 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1984 SETTING_TRACE_BEGIN;
1985 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1988 /*---------------------------------------------- */
1989 int system_setting_get_network_flight_mode(system_settings_key_e key, void **value)
1991 SETTING_TRACE_BEGIN;
1993 if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1994 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1996 *value = (void *)vconf_value;
1998 return SYSTEM_SETTINGS_ERROR_NONE;
2001 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2003 SETTING_TRACE_BEGIN;
2004 return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
2007 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2009 SETTING_TRACE_BEGIN;
2010 return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
2013 int system_setting_get_network_wifi_notification(system_settings_key_e key, void **value)
2015 SETTING_TRACE_BEGIN;
2017 if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2018 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2021 bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2023 *value = (void *)bret;
2024 return SYSTEM_SETTINGS_ERROR_NONE;
2027 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2029 SETTING_TRACE_BEGIN;
2030 return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
2033 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2035 SETTING_TRACE_BEGIN;
2036 return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
2039 /* LCOV_EXCL_START */
2040 int system_setting_get_lock_state(system_settings_key_e key, void **value)
2043 int ** val = (int**)value;
2045 if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2046 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2048 **val = vconf_value;
2050 return SYSTEM_SETTINGS_ERROR_NONE;
2052 /* LCOV_EXCL_STOP */
2054 /* LCOV_EXCL_START */
2055 int system_setting_set_lock_state(system_settings_key_e key, void *value)
2057 SETTING_TRACE_BEGIN;
2059 vconf_value = *(int **)value;
2061 if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2062 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2065 return SYSTEM_SETTINGS_ERROR_NONE;
2067 /* LCOV_EXCL_STOP */
2069 /* LCOV_EXCL_START */
2070 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2072 return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
2074 /* LCOV_EXCL_STOP */
2076 /* LCOV_EXCL_START */
2077 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2079 return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
2081 /* LCOV_EXCL_STOP */
2083 //----------------------------------------------------------------------------------------------------------------------------
2085 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2087 int system_setting_get_ads_id(system_settings_key_e key, void **value)
2089 SETTING_TRACE_BEGIN;
2090 int optout_value = 0;
2091 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2092 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2095 if (optout_value == 1) {
2096 *value = strdup(DEFAULT_ADS_ID);
2097 return SYSTEM_SETTINGS_ERROR_NONE;
2100 char *vconf_value = NULL;
2101 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2102 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2105 *value = vconf_value;
2106 return SYSTEM_SETTINGS_ERROR_NONE;
2111 void make_ad_id(void)
2114 char uuid_unparsed[50] = {0};
2115 uuid_generate(uuid_value);
2116 uuid_unparse(uuid_value, uuid_unparsed);
2117 system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2120 int system_setting_set_ads_id(system_settings_key_e key, void *value)
2122 SETTING_TRACE_BEGIN;
2123 char *vconf_value = NULL;
2124 vconf_value = (char *)value;
2126 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
2127 SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
2128 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2131 return SYSTEM_SETTINGS_ERROR_NONE;
2134 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2136 SETTING_TRACE_BEGIN;
2137 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
2140 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2142 SETTING_TRACE_BEGIN;
2143 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);
2146 int system_settings_feature_check_bool(char *path)
2148 bool profile_data = false;
2149 int ret = system_info_get_platform_bool(path, &profile_data);
2150 if (ret != SYSTEM_INFO_ERROR_NONE) {
2151 SETTING_TRACE("Setting - reading profile string failed, %d", ret);
2152 return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2155 ret = (profile_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2161 int system_setting_feature_check_incoming_call(void * value)
2163 static bool first_query = true;
2164 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2166 if (first_query == true) {
2167 ret = system_settings_feature_check_bool(SETTING_INCOMING_CALL_PATH);
2168 first_query = false;
2174 int system_setting_feature_check_home_screen(void * value)
2176 static bool first_query = true;
2177 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2179 if (first_query == true) {
2180 ret = system_settings_feature_check_bool(SETTING_HOME_SCREEN_PATH);
2181 first_query = false;
2187 int system_setting_feature_check_lock_screen(void * value)
2189 static bool first_query = true;
2190 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2192 if (first_query == true) {
2193 ret = system_settings_feature_check_bool(SETTING_LOCK_SCREEN_PATH);
2194 first_query = false;
2200 int system_setting_feature_check_notification_email(void * value)
2202 static bool first_query = true;
2203 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2205 if (first_query == true) {
2206 ret = system_settings_feature_check_bool(SETTING_NOTIFICATION_EMAIL_PATH);
2207 first_query = false;
2213 int system_setting_feature_check_wifi(void * value)
2215 static bool first_query = true;
2216 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2218 if (first_query == true) {
2219 ret = system_settings_feature_check_bool(SETTING_WIFI_PATH);
2220 first_query = false;
2226 int system_setting_feature_check_telephony(void * value)
2228 static bool first_query = true;
2229 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2231 if (first_query == true) {
2232 ret = system_settings_feature_check_bool(SETTING_TELEPHONY_PATH);
2233 first_query = false;
2240 int system_setting_feature_check_font(void * value)
2242 static bool first_query = true;
2243 static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2245 if (first_query == true) {
2246 ret = system_settings_feature_check_bool(SETTING_FONT_PATH);
2247 first_query = false;
2252 /* LCOV_EXCL_START */
2253 int system_setting_get_uds_state(system_settings_key_e key, void **value)
2255 int ** p_value = (int**)value;
2257 char *vconf_string_value = NULL;
2259 if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_UDSM, &vconf_value)) {
2260 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2263 SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
2265 if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
2266 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
2267 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2269 if (vconf_string_value) {
2270 if (!strcmp(vconf_string_value, "NONE")) {
2271 vconf_value = SYSTEM_SETTINGS_UDS_ON;
2273 char *app_id = NULL;
2274 char *package_id = NULL;
2275 pid_t pid = getpid();
2276 app_manager_get_app_id(pid, &app_id);
2279 package_manager_get_package_id_by_app_id(app_id, &package_id);
2280 SETTING_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value);
2283 if (package_id && strstr(vconf_string_value, package_id)) {
2284 vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
2285 SETTING_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id);
2287 vconf_value = SYSTEM_SETTINGS_UDS_ON;
2291 if (vconf_string_value)
2292 free(vconf_string_value);
2296 **p_value = vconf_value;
2299 return SYSTEM_SETTINGS_ERROR_NONE;
2301 /* LCOV_EXCL_STOP */
2303 /* LCOV_EXCL_START */
2304 int system_setting_set_changed_callback_uds_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2306 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, 4, user_data);
2308 /* LCOV_EXCL_STOP */
2310 /* LCOV_EXCL_START */
2311 int system_setting_unset_changed_callback_uds_state(system_settings_key_e key)
2313 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM, 4);
2315 /* LCOV_EXCL_STOP */
2317 /* LCOV_EXCL_START */
2318 int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2320 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, 4, user_data);
2322 /* LCOV_EXCL_STOP */
2324 /* LCOV_EXCL_START */
2325 int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key)
2327 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, 4);
2329 /* LCOV_EXCL_STOP */
2331 /* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS */
2332 int system_setting_get_accessibility_tts(system_settings_key_e key, void **value)
2334 SETTING_TRACE_BEGIN;
2337 int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &vconf_value);
2338 if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
2341 *value = (void *)vconf_value;
2345 int system_setting_set_changed_callback_accessibility_tts(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2347 SETTING_TRACE_BEGIN;
2348 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, 2, user_data);
2351 int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_e key)
2353 SETTING_TRACE_BEGIN;
2354 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 2);
2357 /* SYSTEM_SETTINGS_KEY_VIBRATION */
2358 int system_setting_get_vibration(system_settings_key_e key, void **value)
2360 SETTING_TRACE_BEGIN;
2363 if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vconf_value)) {
2364 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2366 *value = (void *)vconf_value;
2368 return SYSTEM_SETTINGS_ERROR_NONE;
2371 /* LCOV_EXCL_START */
2372 int system_setting_set_vibration(system_settings_key_e key, void *value)
2374 SETTING_TRACE_BEGIN;
2376 vconf_value = (bool *)value;
2377 if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, *vconf_value)) {
2378 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2381 return SYSTEM_SETTINGS_ERROR_NONE;
2383 /* LCOV_EXCL_STOP */
2385 int system_setting_set_changed_callback_vibration(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2387 SETTING_TRACE_BEGIN;
2388 return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, SYSTEM_SETTINGS_KEY_VIBRATION, 2, user_data);
2391 int system_setting_unset_changed_callback_vibration(system_settings_key_e key)
2393 SETTING_TRACE_BEGIN;
2394 return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, 2);