Fix to get locale language and country data
[platform/core/api/system-settings.git] / src / system_setting_platform.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20 #include <errno.h>
21 #include <time.h>
22 #include <dlfcn.h>
23
24 #include <string.h>
25 #include <libgen.h>
26 #include <sys/types.h>
27 #include <sys/stat.h>
28 #include <fcntl.h>
29 #include <regex.h>
30
31 #include <aul.h>
32 #include <dlog.h>
33 #include <vconf.h>
34
35 #include <glib.h>
36 #include <libxml/xmlmemory.h>
37 #include <libxml/parser.h>
38
39 #include <fontconfig/fontconfig.h>
40
41 #include <pkgmgr-info.h>
42 #include <package_manager.h>
43 #include <app_manager.h>
44
45 #include <system_settings.h>
46 #include <system_settings_private.h>
47 #include <system_settings_ringtones.h>
48 #include <system_settings_json.h>
49
50 #include <system-setting-config.h>
51
52 #include <tzplatform_config.h>
53 #include <alarm.h>
54
55 #include <system_info.h>
56
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"
59
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"
63
64
65 #define __FREE(del, arg) do { \
66                 if (arg) { \
67                         del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
68                         arg = NULL; \
69                 } \
70         } while (0);
71 #define FREE(arg) __FREE(free, arg)
72
73 #ifdef SETTING_ARCH_64
74 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
75 #else
76 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
77 #endif
78
79 int _is_file_accessible(const char *path);
80
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();
87
88 /**
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
92  */
93 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, void **value)
94 {
95         SETTING_TRACE_BEGIN;
96         char *vconf_value = NULL;
97         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
98                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
99         }
100
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);
104         if (is_load == 0) {
105                 *value = vconf_value;
106         } else { /* not zero on errro */
107                 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
108                 free(vconf_value);
109         }
110
111         /**value = vconf_value; */
112         return SYSTEM_SETTINGS_ERROR_NONE;
113 }
114
115
116 int system_setting_get_email_alert_ringtone(system_settings_key_e key, void **value)
117 {
118         SETTING_TRACE_BEGIN;
119         char *vconf_value = NULL;
120         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
121                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
122         }
123
124         /* check to see if it's accessable -> OK */
125         /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
126         int is_load = _is_file_accessible(vconf_value);
127         if (is_load == 0) {
128                 *value = vconf_value;
129         } else { /* not zero on errro */
130                 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
131                 free(vconf_value);
132         }
133
134         return SYSTEM_SETTINGS_ERROR_NONE;
135 }
136
137
138 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, void **value)
139 {
140         SETTING_TRACE_BEGIN;
141         char *vconf_value;
142         if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
143                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
144         }
145         *value = vconf_value;
146         return SYSTEM_SETTINGS_ERROR_NONE;
147 }
148
149
150 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, void **value)
151 {
152         SETTING_TRACE_BEGIN;
153         char *vconf_value;
154
155         if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
156                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
157         }
158         *value = vconf_value;
159
160         return SYSTEM_SETTINGS_ERROR_NONE;
161 }
162
163
164 /* [int] vconf GET */
165 int system_setting_get_font_size(system_settings_key_e key, void **value)
166 {
167         SETTING_TRACE_BEGIN;
168         int vconf_value;
169         int ** val = (int**)value;
170
171         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
172                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
173         }
174         **val = vconf_value;
175
176         return SYSTEM_SETTINGS_ERROR_NONE;
177 }
178
179
180 int system_setting_get_default_font_type(system_settings_key_e key, void **value)
181 {
182         SETTING_TRACE_BEGIN;
183         char *font_name = dl_get_default_font_info();
184         if (font_name) {
185                 *value = (void *)font_name;
186                 return SYSTEM_SETTINGS_ERROR_NONE;
187         } else {
188                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
189         }
190 }
191
192 /* [int] vconf GET */
193 int system_setting_get_font_type(system_settings_key_e key, void **value)
194 {
195         SETTING_TRACE_BEGIN;
196         char *font_name = NULL;
197
198         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, &font_name)) {
199                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
200         }
201
202         *value = font_name;
203         return SYSTEM_SETTINGS_ERROR_NONE;
204 }
205
206
207 int system_setting_get_motion_activation(system_settings_key_e key, void **value)
208 {
209         SETTING_TRACE_BEGIN;
210         bool vconf_value;
211
212         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
213                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
214         }
215         *value = (void *)vconf_value;
216
217         return SYSTEM_SETTINGS_ERROR_NONE;
218 }
219
220 int system_setting_get_usb_debugging_option(system_settings_key_e key, void **value)
221 {
222         SETTING_TRACE_BEGIN;
223         bool vconf_value;
224
225         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
226                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
227         }
228         *value = (void *)vconf_value;
229
230         return SYSTEM_SETTINGS_ERROR_NONE;
231 }
232
233 int system_setting_get_3g_data_network(system_settings_key_e key, void **value)
234 {
235         SETTING_TRACE_BEGIN;
236         bool vconf_value;
237
238         if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
239                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
240         }
241         *value = (void *)vconf_value;
242
243         return SYSTEM_SETTINGS_ERROR_NONE;
244 }
245 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
246
247
248 /**
249  * get current lock scren app package name (string)
250  *
251  * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
252  */
253 int system_setting_get_lockscreen_app(system_settings_key_e key, void **value)
254 {
255         SETTING_TRACE_BEGIN;
256         char *pkg_name = NULL;
257         int locktype = -1;
258         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
259                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
260         }
261
262         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
263                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
264         }
265
266         if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
267                 free(pkg_name);
268                 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
269         }
270
271         *value = pkg_name;
272         return SYSTEM_SETTINGS_ERROR_NONE;
273 }
274
275
276 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
277
278 int _is_file_accessible(const char *path)
279 {
280         SETTING_TRACE_BEGIN;
281         int ret = access(path , R_OK);
282         if (ret == 0) {
283                 SETTING_TRACE("found the file  %s", path);
284                 return 0;
285         } else {
286                 /* error code : 13 */
287                 SETTING_TRACE("found the file  %s --- error code : %d ", path, errno);
288                 return -errno;
289         }
290 }
291
292
293
294 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
295 // @todo move to CMake
296 #define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones"
297
298 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
299 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
300
301 #if 0
302 static char* _get_json_file_path()
303 {
304         // for testing
305         return JSONFILE;
306 }
307 #endif
308
309 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value)
310 {
311         SETTING_TRACE_BEGIN;
312         char* pathval = (char*)value;
313         char* dnameval = NULL;
314         char* baseval = NULL;
315
316 #ifdef USE_JSONFILE
317         // NOT IN USE
318         JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
319 #else
320         JsonParser *parser = ss_json_ringtone_load_from_data();
321 #endif
322
323         JsonNode *root = json_parser_get_root(parser);
324
325         // dirname
326         // basename
327         int ret = SYSTEM_SETTINGS_ERROR_NONE;
328         if (false == ss_json_ringtone_contain(root, pathval)) {
329                 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
330                 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
331                 SETTING_TRACE("pathval is : %s -- OK", pathval);
332         } else {
333                 SETTING_TRACE("pathval is duplicated : %s", pathval);
334                 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
335         }
336
337         dnameval = strdup(pathval);
338         baseval = strdup(pathval);
339         if (dnameval && baseval) {
340                 SETTING_TRACE("---> dirname is : %s ", dirname(dnameval));
341                 SETTING_TRACE("---> basename is : %s ", basename(baseval));
342         }
343         FREE(dnameval);
344         FREE(baseval);
345
346         if (parser) {
347                 g_object_unref(parser);
348                 parser = NULL;
349         }
350
351         return ret;
352 }
353
354 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value)
355 {
356         SETTING_TRACE_BEGIN;
357         char* pathval = (char*)value;
358 #ifdef USE_JSONFILE
359         // NOT IN USE
360         JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
361 #else
362         JsonParser* parser = ss_json_ringtone_load_from_data();
363 #endif
364         JsonNode *root = json_parser_get_root(parser);
365
366         ss_json_ringtone_remove(root, JSONFILE, pathval);
367         //void ss_json_ringtone_remove(JsonNode *root,  char* filename, char* path_to_del)
368
369         ss_json_ringtone_print(root);
370         if (parser) {
371                 g_object_unref(parser);
372                 parser = NULL;
373         }
374
375         return SYSTEM_SETTINGS_ERROR_NONE;
376 }
377
378
379 /*  LCOV_EXCL_START */
380 gint _compare_cb(gconstpointer d1, gconstpointer d2)
381 {
382         fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
383         fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
384
385         return strcmp(pNode1->media_name, pNode2->media_name);
386 }
387 /*  LCOV_EXCL_STOP */
388
389 /*
390  * get the RINGTONE list
391  */
392 static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
393 {
394         SETTING_TRACE_BEGIN;
395         /*Get file list */
396         GList *filelist = NULL;
397         GList *iter;
398         fileNodeInfo *node = NULL;
399         int idx = 0;
400
401         //-----------------------------------------------------------------------------------------------------------------
402         // 1. get the default ringtone list
403         //-----------------------------------------------------------------------------------------------------------------
404         int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
405         if (ret != 0) {
406                 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
407         }
408
409         filelist = g_list_sort(filelist, _compare_cb);
410
411         for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
412                 node = (fileNodeInfo *)iter->data;
413                 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
414                 // @todo assert NULL check
415                 if (callback) {
416                         char temp[1024];
417                         snprintf(temp, 1024, "%s/%s", node->path, node->name);
418                         char* path = strdup(temp);
419                         bool ret = callback(idx, (void *)(path), data);
420                         if (path) {
421                                 free(path);
422                                 path = NULL;
423                         }
424                         if (ret == false) {
425                                 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
426                                 break;
427                         }
428
429                 } else {
430                         SETTING_TRACE("--> system_setting_data_iterator is NULL");
431                 }
432         }
433
434         for (iter = filelist; iter != NULL; iter = g_list_next(iter)) {
435                 node = (fileNodeInfo *)iter->data;
436                 FREE(node->path);
437                 FREE(node->name);
438                 FREE(node->media_name);
439                 FREE(node);
440         }
441         g_list_free(filelist);
442         filelist = NULL;
443
444 }
445
446 static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data)
447 {
448         SETTING_TRACE_BEGIN;
449
450 #ifdef USE_JSONFILE
451         // NOT IN USE
452         JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
453 #else
454         JsonParser* parser = ss_json_ringtone_load_from_data();
455 #endif
456
457         JsonNode *root = json_parser_get_root(parser);
458         int size = json_array_get_length(json_node_get_array(root));
459
460         int i = 0;
461         for (i = 0; i < size ; i++) {
462                 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
463                 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
464                 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
465                 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
466                 if (callback && pathval) {
467                         char* path = strdup(pathval);
468                         bool ret = callback(i, (void *)(path), data);
469                         if (ret == false) {
470                                 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
471                                 break;
472                         }
473                         FREE(path);
474                 } else {
475                         SETTING_TRACE("--> callback is NULL");
476                 }
477         }
478
479         g_object_unref(parser);
480 }
481
482 int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data)
483 {
484         SETTING_TRACE_BEGIN;
485
486         _get_default_ringtones(key, callback, data);
487         //-----------------------------------------------------------------------------------------------------------------
488         // 2. get the USER ringtone list
489         //-----------------------------------------------------------------------------------------------------------------
490         _get_user_ringtones(key, callback, data);
491
492         return SYSTEM_SETTINGS_ERROR_NONE;
493 }
494
495
496 /*  LCOV_EXCL_START */
497 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, void *value)
498 {
499         SETTING_TRACE_BEGIN;
500         char *vconf_value;
501         vconf_value = (char *)value;
502
503         int ret = _is_file_accessible(vconf_value);
504         if (ret == 0) {
505                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
506                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
507                 }
508         } else {
509                 /* @todo add a common ret_handler */
510                 return ret;
511         }
512
513         return SYSTEM_SETTINGS_ERROR_NONE;
514 }
515 /*  LCOV_EXCL_STOP */
516
517
518 /*  LCOV_EXCL_START */
519 int system_setting_set_email_alert_ringtone(system_settings_key_e key, void *value)
520 {
521         SETTING_TRACE_BEGIN;
522         char *vconf_value;
523         vconf_value = (char *)value;
524
525         int ret = _is_file_accessible(vconf_value);
526         if (ret == 0) {
527                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
528                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
529                 }
530         } else {
531                 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
532                 /* @todo add a common ret_handler */
533                 return ret;
534         }
535
536         return SYSTEM_SETTINGS_ERROR_NONE;
537 }
538 /*  LCOV_EXCL_STOP */
539
540 /*  LCOV_EXCL_START */
541 static bool dl_is_supported_image_type_load(char *path)
542 {
543         void *handle = NULL;
544         char *error;
545         bool ret = false;
546         bool (*image_type_check)(char *path);
547
548         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
549         if (!handle) {
550                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
551                 return false;
552         }
553
554         image_type_check = dlsym(handle, "__is_supported_image_type_load");
555         if ((error = dlerror()) != NULL) {
556                 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
557                 if (handle)
558                         dlclose(handle);
559                 return false;
560         }
561         ret = image_type_check(path);
562         if (handle)
563                 dlclose(handle);
564         return ret;
565 }
566 /*  LCOV_EXCL_STOP */
567
568 /*  LCOV_EXCL_START */
569 static int dl_is_available_font(char *str)
570 {
571         void *handle = NULL;
572         char *error;
573         int ret = false;
574         int (*check_available_font)(char *font_name);
575
576         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
577         if (!handle) {
578                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
579                 return false;
580         }
581
582         check_available_font = dlsym(handle, "__is_available_font");
583         if ((error = dlerror()) != NULL) {
584                 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
585                 if (handle)
586                         dlclose(handle);
587                 return false;
588         }
589         ret = check_available_font(str);
590         if (handle)
591                 dlclose(handle);
592         return ret;
593 }
594 /*  LCOV_EXCL_STOP */
595
596 /*  LCOV_EXCL_START */
597 static void dl_font_size_set()
598 {
599         void *handle = NULL;
600         char *error;
601         void (*set_font_size)();
602
603         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
604         if (!handle) {
605                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
606                 return;
607         }
608
609         set_font_size = dlsym(handle, "__font_size_set");
610         if ((error = dlerror()) != NULL) {
611                 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
612                 if (handle)
613                         dlclose(handle);
614                 return;
615         }
616         set_font_size();
617         if (handle)
618                 dlclose(handle);
619         return;
620 }
621 /*  LCOV_EXCL_STOP */
622
623 /*  LCOV_EXCL_START */
624 static void dl_font_config_set_notification()
625 {
626         void *handle = NULL;
627         char *error;
628         void (*set_font_nodification)();
629
630         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
631         if (!handle) {
632                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
633                 return;
634         }
635
636         set_font_nodification = dlsym(handle, "font_config_set_notification");
637         if ((error = dlerror()) != NULL) {
638                 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
639                 if (handle)
640                         dlclose(handle);
641                 return;
642         }
643         set_font_nodification();
644         if (handle)
645                 dlclose(handle);
646         return;
647 }
648 /*  LCOV_EXCL_STOP */
649
650 /*  LCOV_EXCL_START */
651 static bool dl_font_config_set(char *font_name)
652 {
653         void *handle = NULL;
654         char *error;
655         bool ret = false;
656         bool (*check_font_type)(char *font_name);
657
658         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
659         if (!handle) {
660                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
661                 return false;
662         }
663
664         check_font_type = dlsym(handle, "font_config_set");
665         if ((error = dlerror()) != NULL) {
666                 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
667                 if (handle)
668                         dlclose(handle);
669                 return false;
670         }
671         ret = check_font_type(font_name);
672         if (handle)
673                 dlclose(handle);
674         return ret;
675 }
676 /*  LCOV_EXCL_STOP */
677
678 /*  LCOV_EXCL_START */
679 static char *dl_get_default_font_info()
680 {
681         void *handle = NULL;
682         char *error;
683         char *ret = NULL;
684         char *(*get_font_info)();
685
686         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
687         if (!handle) {
688                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
689                 return false;
690         }
691
692         get_font_info = dlsym(handle, "_get_default_font");
693
694         if ((error = dlerror()) != NULL) {
695                 SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so.0.1.0");
696                 if (handle)
697                         dlclose(handle);
698                 return false;
699         }
700         ret = get_font_info();
701         if (handle)
702                 dlclose(handle);
703         return ret;
704 }
705 /*  LCOV_EXCL_STOP */
706
707 #ifdef TIZEN_WEARABLE
708 /*  LCOV_EXCL_START */
709 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
710 {
711         SETTING_TRACE_BEGIN;
712         char buffer[256];
713         const char *find_str = "extended_wallpaper_";
714         char *ch = NULL;
715
716         if (!(ch = strstr(file_path, find_str))) {
717                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
718         }
719         strncpy(buffer, file_path, ch - file_path);
720         buffer[ch - file_path] = 0;
721         sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
722
723         if (!isdigit(buffer[0])) {
724                 SETTING_TRACE("%s is not number", buffer);
725                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
726         }
727
728         *num = atoi(buffer);
729
730         return SYSTEM_SETTINGS_ERROR_NONE;
731 }
732 /*  LCOV_EXCL_STOP */
733
734 /*  LCOV_EXCL_START */
735 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
736 {
737         SETTING_TRACE_BEGIN;
738         if (!source_file_path || !dest_file_path) {
739                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
740         }
741
742         char buf[1024];
743
744         int fd;
745         fd = open(source_file_path, O_RDONLY);
746         if (fd < 0) {
747                 SETTING_TRACE("file open failed: %s", source_file_path);
748                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
749         }
750
751         int fd2;
752         fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
753         if (fd2 < 0) {
754                 SETTING_TRACE("file creation failed: %s", dest_file_path);
755                 close(fd);
756                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
757         }
758
759         while (read(fd, buf, sizeof(buf) - 1) > 0) {
760                 write(fd2, buf, sizeof(buf) - 1);
761         }
762
763         close(fd2);
764         close(fd);
765
766         if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
767                 SETTING_TRACE("chmod failed: %s", dest_file_path);
768         }
769
770         return SYSTEM_SETTINGS_ERROR_NONE;
771 }
772 /*  LCOV_EXCL_STOP */
773
774 /*  LCOV_EXCL_START */
775 static int system_setting_remove_oldest_extended_wallpaper()
776 {
777         SETTING_TRACE_BEGIN;
778         DIR *dp;
779         struct dirent *dirp;
780         char *min_image_name = NULL;
781         unsigned int min_image_num = 0;
782         unsigned int temp_image_num = 0;
783         int image_count = 0;
784
785         if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
786                 SETTING_TRACE("opendir error");
787                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
788         }
789
790         while ((dirp = readdir(dp))) {
791                 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
792                         continue;
793
794                 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
795                     != SYSTEM_SETTINGS_ERROR_NONE) {
796                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
797                 }
798
799                 if ((image_count == 0) || (min_image_num > temp_image_num)) {
800                         min_image_num = temp_image_num;
801                         min_image_name = dirp->d_name;
802                 }
803
804                 image_count++;
805         }
806
807         char buf[512];
808         if (min_image_name) {
809                 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
810                 if (remove(buf) < 0) {  /* remove oldest image */
811                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
812                 }
813         }
814
815         return SYSTEM_SETTINGS_ERROR_NONE;
816 }
817 /*  LCOV_EXCL_STOP */
818
819 /*  LCOV_EXCL_START */
820 static int system_setting_check_extended_wallpaper(const char *file_path)
821 {
822         char buffer[512];
823         SETTING_TRACE_BEGIN;
824         if (!file_path || !strlen(file_path))
825                 return 0;
826         snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
827         return (strstr(file_path, buffer) != NULL);
828 }
829 /*  LCOV_EXCL_STOP */
830
831 #define WALLPAPER_MAX_COUNT             10
832 #endif
833 /*  LCOV_EXCL_START */
834 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, void *value)
835 {
836         SETTING_TRACE_BEGIN;
837         char *vconf_value;
838         vconf_value = (char *)value;
839
840         bool isok  = dl_is_supported_image_type_load(vconf_value);
841         if (!isok) {
842                 /* not supported */
843                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
844                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
845         } else {
846                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
847         }
848
849         /* error handling here */
850         if (_is_file_accessible(vconf_value) != 0)
851                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
852 #ifdef TIZEN_MOBILE
853         if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
854                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
855         }
856 #endif
857
858 #ifdef TIZEN_WEARABLE
859         if (system_setting_check_extended_wallpaper(vconf_value)) {     /* New extended wallpaper */
860                 DIR *dp = NULL;
861                 struct dirent *dirp;
862                 unsigned int max_image_num = 0;
863                 unsigned int temp_image_num = 0;
864                 int image_count = 0;
865
866                 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
867                         SETTING_TRACE("Setting - dir open error!");
868                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
869                 }
870
871                 /* Check a max number of wallpapers */
872                 while ((dirp = readdir(dp))) {
873                         if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
874                                 continue;
875
876                         if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
877                             != SYSTEM_SETTINGS_ERROR_NONE) {
878                                 if (dp)
879                                         closedir(dp);
880                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
881                         }
882
883                         if ((image_count == 0) || (max_image_num < temp_image_num)) {
884                                 max_image_num = temp_image_num;
885                         }
886
887                         image_count++;
888                 }
889                 if (dp)
890                         closedir(dp);
891
892                 /* Numbering rule: Gear is odd number */
893                 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
894                                                         : max_image_num + 2;
895
896                 char file_name_buffer[512];
897                 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
898                                         _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
899
900                 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
901                 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
902                     != SYSTEM_SETTINGS_ERROR_NONE) {
903                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
904                 }
905
906                 /* remove oldest wallpaper */
907                 if (image_count >= WALLPAPER_MAX_COUNT) {
908                         if (system_setting_remove_oldest_extended_wallpaper()
909                             != SYSTEM_SETTINGS_ERROR_NONE) {
910                                 remove(file_name_buffer);
911                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
912                         }
913                 }
914
915                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
916                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
917                 }
918
919                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
920                                                                                                         VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
921                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
922                 }
923         } else {
924                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
925                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
926                 }
927         }
928 #endif
929
930         return SYSTEM_SETTINGS_ERROR_NONE;
931 }
932 /*  LCOV_EXCL_STOP */
933
934 /*  LCOV_EXCL_START */
935 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, void *value)
936 {
937         SETTING_TRACE_BEGIN;
938         char *vconf_value;
939         vconf_value = (char *)value;
940
941         bool isok  = dl_is_supported_image_type_load(vconf_value);
942         if (!isok) {
943                 /* not supported */
944                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
945                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
946         } else {
947                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
948         }
949
950         /* error handling here */
951         if (_is_file_accessible(vconf_value) != 0)
952                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
953
954         if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
955                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
956         }
957
958         return SYSTEM_SETTINGS_ERROR_NONE;
959 }
960 /*  LCOV_EXCL_STOP */
961
962 /*  LCOV_EXCL_START */
963 int system_setting_set_font_size(system_settings_key_e key, void *value)
964 {
965         SETTING_TRACE_BEGIN;
966         int *vconf_value;
967         vconf_value = *(int **)value;
968
969         if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
970                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
971         }
972
973         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
974                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
975         }
976         dl_font_size_set();
977         SETTING_TRACE_END;
978         return SYSTEM_SETTINGS_ERROR_NONE;
979 }
980 /*  LCOV_EXCL_STOP */
981 /**
982  * [internal API]
983  */
984 /*  LCOV_EXCL_START */
985 void *font_conf_doc_parse(char *doc_name, char *font_name)
986 {
987         SETTING_TRACE_BEGIN;
988         xmlDocPtr doc = NULL;
989         xmlNodePtr cur = NULL;
990         xmlNodePtr cur2 = NULL;
991         xmlNodePtr cur3 = NULL;
992         xmlChar *key = NULL;
993
994         doc = xmlParseFile(doc_name);
995
996         cur = xmlDocGetRootElement(doc);
997
998         if (cur == NULL) {
999                 xmlFreeDoc(doc);
1000                 doc = NULL;
1001                 return NULL;
1002         }
1003
1004         if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1005                 xmlFreeDoc(doc);
1006                 doc = NULL;
1007                 return NULL;
1008         }
1009
1010         cur = cur->xmlChildrenNode;
1011
1012         bool is_changed = false;
1013         while (cur != NULL) {
1014                 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1015                         cur2 = cur->xmlChildrenNode;
1016                         while (cur2 != NULL) {
1017                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1018                                         xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1019                                         /* if name is not 'family', break */
1020                                         if (xmlStrcmp(name, (const xmlChar *)"family")) {
1021                                                 xmlFree(name);
1022                                                 name = NULL;
1023                                                 break;
1024                                         }
1025                                         xmlFree(name);
1026                                         name = NULL;
1027
1028                                         cur3 = cur2->xmlChildrenNode;
1029                                         while (cur3 != NULL) {
1030                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1031                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1032                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1033                                                         xmlFree(key);
1034                                                         key = NULL;
1035                                                         is_changed = true;
1036                                                 }
1037                                                 cur3 = cur3->next;
1038                                         }
1039                                 }
1040                                 cur2 = cur2->next;
1041                         }
1042                 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1043                         cur2 = cur->xmlChildrenNode;
1044                         while (cur2 != NULL) {
1045                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1046                                         xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1047                                         key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1048                                         xmlFree(key);
1049                                         key = NULL;
1050                                         is_changed = true;
1051                                 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1052                                         cur3 = cur2->xmlChildrenNode;
1053                                         while (cur3 != NULL) {
1054                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1055                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1056                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1057                                                         xmlFree(key);
1058                                                         key = NULL;
1059                                                         is_changed = true;
1060                                                         cur3 = cur3->next;
1061                                                         return doc;
1062                                                 }
1063                                                 cur3 = cur3->next;
1064                                         }
1065                                 }
1066                                 cur2 = cur2->next;
1067                         }
1068                 }
1069                 cur = cur->next;
1070         }
1071
1072         if (is_changed) {
1073                 return doc;
1074         } else {
1075                 xmlFreeDoc(doc);
1076                 doc = NULL;
1077                 return NULL;
1078         }
1079 }
1080 /*  LCOV_EXCL_STOP */
1081
1082 /*  LCOV_EXCL_START */
1083 int system_setting_set_font_type(system_settings_key_e key, void *value)
1084 {
1085         SETTING_TRACE_BEGIN;
1086         char *font_name = NULL;
1087         font_name = (char *)value;
1088
1089         /* get current font list */
1090         int is_found = dl_is_available_font(font_name);
1091
1092         if (is_found == 1) {
1093                 SETTING_TRACE("found font : %s ", font_name);
1094         } else {
1095                 SETTING_TRACE(" NOT found font : %s ", font_name);
1096                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1097         }
1098
1099         bool bsave = dl_font_config_set(font_name);
1100
1101         if (!bsave) {
1102                 SETTING_TRACE(" font type save error by font_config_set() ");
1103                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1104         } else {
1105                 SETTING_TRACE(" save OK - font_config_set() ");
1106         }
1107
1108         xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1109         if (doc != NULL) {
1110                 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1111                 xmlFreeDoc(doc);
1112                 doc = NULL;
1113         }
1114
1115         dl_font_config_set_notification();
1116
1117         char *vconf_value;
1118         vconf_value = (char *)value;
1119
1120         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1121                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1122         }
1123         return SYSTEM_SETTINGS_ERROR_NONE;
1124 }
1125 /*  LCOV_EXCL_STOP */
1126
1127 /*  LCOV_EXCL_START */
1128 int system_setting_set_motion_activation(system_settings_key_e key, void *value)
1129 {
1130         SETTING_TRACE_BEGIN;
1131         bool *vconf_value;
1132         vconf_value = (bool *)value;
1133         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1134                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1135         }
1136         return SYSTEM_SETTINGS_ERROR_NONE;
1137 }
1138 /*  LCOV_EXCL_STOP */
1139
1140 /*  LCOV_EXCL_START */
1141 int system_setting_set_usb_debugging_option(system_settings_key_e key, void *value)
1142 {
1143         SETTING_TRACE_BEGIN;
1144         bool *vconf_value;
1145         vconf_value = (bool *)value;
1146         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1147                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1148         }
1149         return SYSTEM_SETTINGS_ERROR_NONE;
1150
1151 }
1152 /*  LCOV_EXCL_STOP */
1153
1154 /*  LCOV_EXCL_START */
1155 int system_setting_set_3g_data_network(system_settings_key_e key, void *value)
1156 {
1157         SETTING_TRACE_BEGIN;
1158         bool *vconf_value;
1159         vconf_value = (bool *)value;
1160         if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1161                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1162         }
1163
1164         return SYSTEM_SETTINGS_ERROR_NONE;
1165 }
1166 /*  LCOV_EXCL_STOP */
1167
1168 /*  LCOV_EXCL_START */
1169 static int category_func(const char *name, void *user_data)
1170 {
1171         SETTING_TRACE_BEGIN;
1172         static char *category = "lock-screen";
1173         if (name && !strcmp(name, category)) {
1174                 SETTING_TRACE(" SAME ");
1175                 return -1;
1176         } else {
1177                 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1178                 return 0;
1179         }
1180
1181         return 0;
1182 }
1183 /*  LCOV_EXCL_STOP */
1184
1185 /**
1186  *
1187  * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1188  *
1189  */
1190
1191 /*  LCOV_EXCL_START */
1192 int system_setting_set_lockscreen_app(system_settings_key_e key, void *value)
1193 {
1194         SETTING_TRACE_BEGIN;
1195         char *vconf_value;
1196         vconf_value = (char *)value;            /* ex) com.samsung.lockscreen */
1197
1198         int r = 0;
1199         pkgmgrinfo_appinfo_h handle;
1200         r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1201         if (r != PMINFO_R_OK) {
1202                 SETTING_TRACE("*** pkginfo failed ");
1203                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1204         } else {
1205                 SETTING_TRACE("%p", handle);
1206         }
1207
1208         int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1209         if (ret != PMINFO_R_OK) {
1210                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1211                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1212         }
1213
1214         pkgmgrinfo_appinfo_destroy_appinfo(handle);
1215         /*----------------------------------------------------------------------------------- */
1216         int locktype = -1;
1217         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1218                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1219         }
1220
1221         if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1222                 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1223
1224         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1225                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1226         }
1227
1228         if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1229                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1230                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1231                 }
1232         }
1233         return SYSTEM_SETTINGS_ERROR_NONE;
1234 }
1235 /*  LCOV_EXCL_STOP */
1236
1237 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1238 /* */
1239
1240 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1241 {
1242         SETTING_TRACE_BEGIN;
1243         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
1244 }
1245
1246 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1247 {
1248         SETTING_TRACE_BEGIN;
1249         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTING_CALLBACK_SLOT_0);
1250 }
1251
1252 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1253 {
1254         SETTING_TRACE_BEGIN;
1255         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
1256 }
1257
1258 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1259 {
1260         SETTING_TRACE_BEGIN;
1261         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTING_CALLBACK_SLOT_0);
1262 }
1263
1264 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1265 {
1266         SETTING_TRACE_BEGIN;
1267         return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
1268 }
1269
1270 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1271 {
1272         SETTING_TRACE_BEGIN;
1273         return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTING_CALLBACK_SLOT_0);
1274 }
1275
1276 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1277 {
1278         SETTING_TRACE_BEGIN;
1279         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
1280 }
1281
1282 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1283 {
1284         SETTING_TRACE_BEGIN;
1285         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTING_CALLBACK_SLOT_0);
1286 }
1287
1288 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1289 {
1290         SETTING_TRACE_BEGIN;
1291         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, SYSTEM_SETTING_CALLBACK_SLOT_1, user_data);
1292 }
1293
1294 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1295 {
1296         SETTING_TRACE_BEGIN;
1297         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTING_CALLBACK_SLOT_1);
1298 }
1299
1300 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1301 {
1302         SETTING_TRACE_BEGIN;
1303         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, SYSTEM_SETTING_CALLBACK_SLOT_1, user_data);
1304 }
1305
1306 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1307 {
1308         SETTING_TRACE_BEGIN;
1309         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_1);
1310 }
1311
1312 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1313 {
1314         SETTING_TRACE_BEGIN;
1315         return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, SYSTEM_SETTING_CALLBACK_SLOT_1, user_data);
1316 }
1317
1318 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1319 {
1320         SETTING_TRACE_BEGIN;
1321         return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTING_CALLBACK_SLOT_1);
1322 }
1323
1324 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1325 {
1326         SETTING_TRACE_BEGIN;
1327         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, SYSTEM_SETTING_CALLBACK_SLOT_1, user_data);
1328 }
1329
1330 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1331 {
1332         SETTING_TRACE_BEGIN;
1333         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTING_CALLBACK_SLOT_1);
1334 }
1335
1336
1337 /**
1338  * @todo need to add custom event notification method
1339  */
1340 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1341 {
1342         SETTING_TRACE_BEGIN;
1343         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
1344 }
1345
1346 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1347 {
1348         SETTING_TRACE_BEGIN;
1349         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTING_CALLBACK_SLOT_2);
1350 }
1351
1352 /* TODO : 2th argument, callback, is not in use. */
1353 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1354 {
1355         SETTING_TRACE_BEGIN;
1356         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1357 }
1358
1359 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1360 {
1361         SETTING_TRACE_BEGIN;
1362         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTING_CALLBACK_SLOT_3);
1363 }
1364
1365 /*//////////////////////////////////////////////////////////////////////////////////////// */
1366 /*--------------------------------------- */
1367 int system_setting_get_locale_country(system_settings_key_e key, void **value)
1368 {
1369         SETTING_TRACE_BEGIN;
1370         char *vconf_value = NULL;
1371         if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1372                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1373         }
1374
1375         /* parsing validation */
1376         /* en_US.UTF-8 */
1377         char arr[21] = {0,};
1378         snprintf(arr, 20, "%s", vconf_value);
1379         for (int i = 0; i < strlen(arr); i++) {
1380                 if ('.' == arr[i]) {
1381                         arr[i] = 0;
1382                         SETTING_TRACE("replace . to NULL : %d", i);
1383                         break;
1384                 }
1385         }
1386         *value = strdup(arr);
1387         free(vconf_value);
1388         vconf_value = NULL;
1389
1390         return SYSTEM_SETTINGS_ERROR_NONE;
1391 }
1392
1393 /*  LCOV_EXCL_START */
1394 int system_setting_set_locale_country(system_settings_key_e key, void *value)
1395 {
1396         SETTING_TRACE_BEGIN;
1397         char *vconf_value = NULL;
1398         vconf_value = (char *)value;
1399
1400         char *ext = "UTF-8";
1401
1402         char arr[20];
1403         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1404
1405         if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1406                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1407         }
1408         return SYSTEM_SETTINGS_ERROR_NONE;
1409 }
1410 /*  LCOV_EXCL_STOP */
1411
1412 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1413 {
1414         SETTING_TRACE_BEGIN;
1415         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1416 }
1417
1418 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1419 {
1420         SETTING_TRACE_BEGIN;
1421         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTING_CALLBACK_SLOT_3);
1422 }
1423
1424
1425 /*--------------------------------------- */
1426 int system_setting_get_locale_language(system_settings_key_e key, void **value)
1427 {
1428         SETTING_TRACE_BEGIN;
1429         char *vconf_value = NULL;
1430         if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1431                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1432         }
1433
1434         /* parsing validation */
1435         /* en_US.UTF-8 */
1436         char arr[21] = {0,};
1437         snprintf(arr, 20, "%s", vconf_value);
1438         for (int i = 0; i < strlen(arr); i++) {
1439                 if ('.' == arr[i]) {
1440                         arr[i] = 0;
1441                         SETTING_TRACE("replace . to NULL : %d", i);
1442                         break;
1443                 }
1444         }
1445         *value = strdup(arr);
1446         free(vconf_value);
1447         vconf_value = NULL;
1448         return SYSTEM_SETTINGS_ERROR_NONE;
1449 }
1450
1451 /*  LCOV_EXCL_START */
1452 int system_setting_set_locale_language(system_settings_key_e key, void *value)
1453 {
1454         SETTING_TRACE_BEGIN;
1455         char *vconf_value = NULL;
1456         vconf_value = (char *)value;
1457
1458         char *ext = "UTF-8";
1459
1460         char arr[20];
1461         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1462
1463         if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1464                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1465         }
1466         return SYSTEM_SETTINGS_ERROR_NONE;
1467 }
1468 /*  LCOV_EXCL_STOP */
1469
1470 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1471 {
1472         SETTING_TRACE_BEGIN;
1473         /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1474         return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, SYSTEM_SETTING_CALLBACK_SLOT_5, user_data);
1475 }
1476
1477 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1478 {
1479         SETTING_TRACE_BEGIN;
1480         return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTING_CALLBACK_SLOT_5);
1481 }
1482
1483 /*--------------------------------------- */
1484 /*  LCOV_EXCL_START */
1485 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, void **value)
1486 {
1487         SETTING_TRACE_BEGIN;
1488         int vconf_value;
1489
1490         if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1491                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1492         }
1493
1494         bool ret_value = true;
1495         if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1496                 ret_value = false;
1497         else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1498                 ret_value = true;
1499
1500         *value = (void *)ret_value;
1501
1502         return SYSTEM_SETTINGS_ERROR_NONE;
1503 }
1504 /*  LCOV_EXCL_STOP */
1505
1506 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, void *value)
1507 {
1508         SETTING_TRACE_BEGIN;
1509         bool *vconf_value;
1510
1511         vconf_value = (bool *)value;
1512
1513         if (*vconf_value) {
1514                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1515                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1516                 }
1517
1518         } else {
1519                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1520                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1521                 }
1522
1523         }
1524
1525         return SYSTEM_SETTINGS_ERROR_NONE;
1526 }
1527
1528 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1529 {
1530         SETTING_TRACE_BEGIN;
1531         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1532 }
1533
1534 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1535 {
1536         SETTING_TRACE_BEGIN;
1537         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTING_CALLBACK_SLOT_3);
1538 }
1539
1540 int system_setting_get_locale_timezone(system_settings_key_e key, void **value)
1541 {
1542         char tzpath[256];
1543         ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1544         if (len != -1) {
1545                 tzpath[len] = '\0';
1546         } else {
1547                 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1548                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1549         }
1550
1551         SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1552         *value = strdup(&tzpath[20]);
1553         return SYSTEM_SETTINGS_ERROR_NONE;
1554 }
1555
1556 /*  LCOV_EXCL_START */
1557 int system_setting_set_locale_timezone(system_settings_key_e key, void *value)
1558 {
1559         SETTING_TRACE_BEGIN;
1560         char *timezone_value = NULL;
1561         timezone_value = (char *)value;
1562
1563         char tz_path[1024];
1564         snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1565
1566         int is_load = _is_file_accessible(tz_path);
1567         if (is_load == 0) {
1568                 alarmmgr_set_timezone(tz_path);
1569
1570                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1571                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1572                 }
1573                 return SYSTEM_SETTINGS_ERROR_NONE;
1574         }
1575         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1576 }
1577 /*  LCOV_EXCL_STOP */
1578
1579
1580
1581 /*  LCOV_EXCL_START */
1582 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1583 {
1584         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, SYSTEM_SETTING_CALLBACK_SLOT_4, user_data);
1585 }
1586 /*  LCOV_EXCL_STOP */
1587
1588 /*  LCOV_EXCL_START */
1589 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1590 {
1591         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTING_CALLBACK_SLOT_4);
1592 }
1593 /*  LCOV_EXCL_STOP */
1594
1595 /*  LCOV_EXCL_START */
1596 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1597 {
1598         SETTING_TRACE_BEGIN;
1599         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1600 }
1601 /*  LCOV_EXCL_STOP */
1602
1603 /*  LCOV_EXCL_START */
1604 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1605 {
1606         SETTING_TRACE_BEGIN;
1607         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1608 }
1609 /*  LCOV_EXCL_STOP */
1610
1611
1612 /*  LCOV_EXCL_START */
1613 int system_setting_get_time_changed(system_settings_key_e key, void **value)
1614 {
1615         SETTING_TRACE_BEGIN;
1616         time_t cur_tick;
1617         int ** val = (int**)value;
1618         cur_tick = time(NULL);
1619         **val = cur_tick;
1620         /* struct tm * localtime = time (cur_tick); */
1621         /* printf("%s\n", ctime(&cur_tick); */
1622         return SYSTEM_SETTINGS_ERROR_NONE;
1623
1624 }
1625 /*  LCOV_EXCL_STOP */
1626
1627 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1628 {
1629         SETTING_TRACE_BEGIN;
1630         return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1631 }
1632
1633 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1634 {
1635         SETTING_TRACE_BEGIN;
1636         return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTING_CALLBACK_SLOT_3);
1637 }
1638
1639
1640
1641 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1642 int system_setting_get_sound_lock(system_settings_key_e key, void **value)
1643 {
1644         SETTING_TRACE_BEGIN;
1645         bool vconf_value;
1646
1647         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1648                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1649         }
1650         *value = (void *)vconf_value;
1651
1652         return SYSTEM_SETTINGS_ERROR_NONE;
1653 }
1654
1655 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1656 {
1657         SETTING_TRACE_BEGIN;
1658         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1659 }
1660
1661 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1662 {
1663         SETTING_TRACE_BEGIN;
1664         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_3);
1665 }
1666
1667 /**
1668  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1669  *
1670  * a == false, b == false --> silent mode
1671  * a == true, b == false --> sound mode
1672  * a == false, b == true --> vibration mode
1673  */
1674 /*  LCOV_EXCL_START */
1675 int system_setting_get_sound_silent_mode(system_settings_key_e key, void **value)
1676 {
1677         SETTING_TRACE_BEGIN;
1678         bool sound_cond;
1679         bool vib_cond;
1680
1681         bool vconf_value;
1682         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1683                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1684         }
1685
1686         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1687                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1688         }
1689
1690         if (sound_cond == false && vib_cond == false) {
1691                 vconf_value = true;
1692                 *value = (void *)vconf_value;
1693         } else {
1694                 vconf_value = false;
1695                 *value = (void *)vconf_value;
1696         }
1697         return SYSTEM_SETTINGS_ERROR_NONE;
1698 }
1699 /*  LCOV_EXCL_STOP */
1700
1701 /**
1702  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1703  *
1704  * a == false, b == false --> silent mode
1705  * a == true, b == false --> sound mode
1706  */
1707 int system_setting_set_sound_silent_mode(system_settings_key_e key, void *value)
1708 {
1709         SETTING_TRACE_BEGIN;
1710         bool *vconf_value;
1711
1712         vconf_value = (bool *)value;
1713
1714         bool vconf_sound = false;
1715         bool vconf_vib = false;
1716
1717         if (*vconf_value) {
1718                 vconf_sound = false;
1719                 vconf_vib = false;
1720         } else {
1721                 vconf_sound = true;
1722                 vconf_vib = false;
1723         }
1724
1725         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1726                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1727         }
1728         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1729                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1730         }
1731
1732         return SYSTEM_SETTINGS_ERROR_NONE;
1733 }
1734
1735
1736
1737 /* TODO */
1738 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1739 {
1740         SETTING_TRACE_BEGIN;
1741         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
1742 }
1743
1744 /* TODO */
1745 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1746 {
1747         SETTING_TRACE_BEGIN;
1748         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_3);
1749 }
1750
1751 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1752 int system_setting_get_sound_touch(system_settings_key_e key, void **value)
1753 {
1754         SETTING_TRACE_BEGIN;
1755         bool vconf_value;
1756
1757         int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1758         if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1759                 return ret;
1760         }
1761         *value = (void *)vconf_value;
1762         return ret;
1763 }
1764
1765 int system_setting_set_sound_touch(system_settings_key_e key, void *value)
1766 {
1767         SETTING_TRACE_BEGIN;
1768         return system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, *(bool *)value);
1769 }
1770
1771
1772 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1773 {
1774         SETTING_TRACE_BEGIN;
1775         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
1776 }
1777
1778 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1779 {
1780         SETTING_TRACE_BEGIN;
1781         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_2);
1782 }
1783
1784 #if 0
1785 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1786 int system_setting_get_sound_lock(system_settings_key_e key, void **value)
1787 {
1788         bool vconf_value;
1789
1790         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1791                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1792         }
1793         *value = (void *)vconf_value;
1794
1795         return SYSTEM_SETTINGS_ERROR_NONE;
1796 }
1797 #endif
1798
1799 int system_setting_get_auto_rotation_mode(system_settings_key_e key, void **value)
1800 {
1801         SETTING_TRACE_BEGIN;
1802         bool vconf_value;
1803
1804         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1805                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1806         }
1807         *value = (void *)vconf_value;
1808
1809         return SYSTEM_SETTINGS_ERROR_NONE;
1810 }
1811
1812 /*  LCOV_EXCL_START */
1813 int system_setting_set_auto_rotation_mode(system_settings_key_e key, void *value)
1814 {
1815         SETTING_TRACE_BEGIN;
1816         bool *vconf_value;
1817         vconf_value = (bool *)value;
1818         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1819                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1820         }
1821
1822         return SYSTEM_SETTINGS_ERROR_NONE;
1823 }
1824 /*  LCOV_EXCL_STOP */
1825
1826 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1827 {
1828         SETTING_TRACE_BEGIN;
1829         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
1830 }
1831
1832 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1833 {
1834         SETTING_TRACE_BEGIN;
1835         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_2);
1836 }
1837
1838 int system_setting_get_screen_backlight_time(system_settings_key_e key, void **value)
1839 {
1840         SETTING_TRACE_BEGIN;
1841         int vconf_value;
1842         int ** val = (int**)value;
1843
1844         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1845                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1846         }
1847         **val = vconf_value;
1848
1849         return SYSTEM_SETTINGS_ERROR_NONE;
1850 }
1851
1852
1853 /*  LCOV_EXCL_START */
1854 int system_setting_set_screen_backlight_time(system_settings_key_e key, void *value)
1855 {
1856         SETTING_TRACE_BEGIN;
1857         int *vconf_value;
1858         vconf_value = *(int **)value;
1859
1860         if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1861                 SETTING_TRACE(" ERR Betweeny here  0 ~ 600");
1862                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1863         }
1864
1865         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1866                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1867         }
1868         SETTING_TRACE_END;
1869         return SYSTEM_SETTINGS_ERROR_NONE;
1870 }
1871 /*  LCOV_EXCL_STOP */
1872
1873 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1874 {
1875         SETTING_TRACE_BEGIN;
1876         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
1877 }
1878
1879 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1880 {
1881         SETTING_TRACE_BEGIN;
1882         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTING_CALLBACK_SLOT_2);
1883 }
1884
1885 int system_setting_get_sound_notification(system_settings_key_e key, void **value)
1886 {
1887         SETTING_TRACE_BEGIN;
1888         char *vconf_value = NULL;
1889         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1890                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1891         }
1892
1893         *value = vconf_value;
1894         return SYSTEM_SETTINGS_ERROR_NONE;
1895 }
1896
1897 /*  LCOV_EXCL_START */
1898 int system_setting_set_sound_notification(system_settings_key_e key, void *value)
1899 {
1900         SETTING_TRACE_BEGIN;
1901         char *vconf_value = NULL;
1902         vconf_value = (char *)value;
1903
1904         int is_load = _is_file_accessible(vconf_value);
1905         if (is_load == 0) {
1906                 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1907                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1908                         //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1909                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1910                 }
1911         } else {
1912                 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1913                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1914         }
1915
1916         return SYSTEM_SETTINGS_ERROR_NONE;
1917 }
1918 /*  LCOV_EXCL_STOP */
1919
1920 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1921 {
1922         SETTING_TRACE_BEGIN;
1923         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
1924 }
1925
1926 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1927 {
1928         SETTING_TRACE_BEGIN;
1929         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTING_CALLBACK_SLOT_0);
1930 }
1931
1932 int system_setting_get_notification_repetition_period(system_settings_key_e key, void **value)
1933 {
1934         SETTING_TRACE_BEGIN;
1935         int ** val = (int**)value;
1936         int vconf_value;
1937
1938         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1939                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1940         }
1941         **val = vconf_value;
1942
1943         return SYSTEM_SETTINGS_ERROR_NONE;
1944 }
1945
1946 /*  LCOV_EXCL_START */
1947 int system_setting_set_notification_repetition_period(system_settings_key_e key, void *value)
1948 {
1949         SETTING_TRACE_BEGIN;
1950         int *vconf_value;
1951         vconf_value = *(int **)value;
1952
1953         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1954                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1955         }
1956         SETTING_TRACE_END;
1957         return SYSTEM_SETTINGS_ERROR_NONE;
1958 }
1959 /*  LCOV_EXCL_STOP */
1960
1961 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1962 {
1963         SETTING_TRACE_BEGIN;
1964         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, SYSTEM_SETTING_CALLBACK_SLOT_1, user_data);
1965 }
1966
1967 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1968 {
1969         SETTING_TRACE_BEGIN;
1970         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTING_CALLBACK_SLOT_1);
1971 }
1972
1973 int system_setting_get_device_name(system_settings_key_e key, void **value)
1974 {
1975         SETTING_TRACE_BEGIN;
1976         char *vconf_value = NULL;
1977         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1978                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1979         }
1980
1981         *value = vconf_value;
1982         return SYSTEM_SETTINGS_ERROR_NONE;
1983 }
1984
1985 /*  LCOV_EXCL_START */
1986 int system_setting_set_device_name(system_settings_key_e key, void *value)
1987 {
1988         SETTING_TRACE_BEGIN;
1989         char *vconf_value = NULL;
1990         vconf_value = (char *)value;
1991
1992         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1993                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1994         }
1995
1996         return SYSTEM_SETTINGS_ERROR_NONE;
1997 }
1998 /*  LCOV_EXCL_STOP */
1999
2000 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2001 {
2002         SETTING_TRACE_BEGIN;
2003         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
2004 }
2005
2006 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
2007 {
2008         SETTING_TRACE_BEGIN;
2009         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTING_CALLBACK_SLOT_0);
2010 }
2011
2012 /*---------------------------------------------- */
2013 int system_setting_get_network_flight_mode(system_settings_key_e key, void **value)
2014 {
2015         SETTING_TRACE_BEGIN;
2016         bool vconf_value;
2017         if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
2018                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2019         }
2020         *value = (void *)vconf_value;
2021
2022         return SYSTEM_SETTINGS_ERROR_NONE;
2023 }
2024
2025 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2026 {
2027         SETTING_TRACE_BEGIN;
2028         return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
2029 }
2030
2031 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2032 {
2033         SETTING_TRACE_BEGIN;
2034         return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTING_CALLBACK_SLOT_3);
2035 }
2036
2037 int system_setting_get_network_wifi_notification(system_settings_key_e key, void **value)
2038 {
2039         SETTING_TRACE_BEGIN;
2040         int vconf_value;
2041         if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2042                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2043         }
2044         bool bret ;
2045         bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2046
2047         *value = (void *)bret;
2048         return SYSTEM_SETTINGS_ERROR_NONE;
2049 }
2050
2051 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2052 {
2053         SETTING_TRACE_BEGIN;
2054         return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, SYSTEM_SETTING_CALLBACK_SLOT_4, user_data);
2055 }
2056
2057 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2058 {
2059         SETTING_TRACE_BEGIN;
2060         return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTING_CALLBACK_SLOT_4);
2061 }
2062
2063 /*  LCOV_EXCL_START */
2064 int system_setting_get_lock_state(system_settings_key_e key, void **value)
2065 {
2066         int vconf_value;
2067         int ** val = (int**)value;
2068
2069         if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2070                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2071         }
2072         **val = vconf_value;
2073
2074         return SYSTEM_SETTINGS_ERROR_NONE;
2075 }
2076 /*  LCOV_EXCL_STOP */
2077
2078 /*  LCOV_EXCL_START */
2079 int system_setting_set_lock_state(system_settings_key_e key, void *value)
2080 {
2081         SETTING_TRACE_BEGIN;
2082         int *vconf_value;
2083         vconf_value = *(int **)value;
2084
2085         if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2086                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2087         }
2088         SETTING_TRACE_END;
2089         return SYSTEM_SETTINGS_ERROR_NONE;
2090 }
2091 /*  LCOV_EXCL_STOP */
2092
2093 /*  LCOV_EXCL_START */
2094 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2095 {
2096         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, SYSTEM_SETTING_CALLBACK_SLOT_4, user_data);
2097 }
2098 /*  LCOV_EXCL_STOP */
2099
2100 /*  LCOV_EXCL_START */
2101 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2102 {
2103         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTING_CALLBACK_SLOT_4);
2104 }
2105 /*  LCOV_EXCL_STOP */
2106
2107 //----------------------------------------------------------------------------------------------------------------------------
2108
2109 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2110
2111 int system_setting_get_ads_id(system_settings_key_e key, void **value)
2112 {
2113         SETTING_TRACE_BEGIN;
2114         int optout_value = 0;
2115         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2116                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2117         }
2118
2119         if (optout_value == 1) {
2120                 *value = strdup(DEFAULT_ADS_ID);
2121                 return SYSTEM_SETTINGS_ERROR_NONE;
2122         }
2123
2124         char *vconf_value = NULL;
2125         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2126                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2127         }
2128
2129         *value = vconf_value;
2130         return SYSTEM_SETTINGS_ERROR_NONE;
2131 }
2132
2133
2134 #if 0
2135 void make_ad_id(void)
2136 {
2137         uuid_t uuid_value;
2138         char uuid_unparsed[50] = {0};
2139         uuid_generate(uuid_value);
2140         uuid_unparse(uuid_value, uuid_unparsed);
2141         system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2142 }
2143 #endif
2144 int system_setting_set_ads_id(system_settings_key_e key, void *value)
2145 {
2146         SETTING_TRACE_BEGIN;
2147         char *vconf_value = NULL;
2148         vconf_value = (char *)value;
2149
2150         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_AD_ID, vconf_value)) {
2151                 SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed");
2152                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2153         }
2154
2155         return SYSTEM_SETTINGS_ERROR_NONE;
2156 }
2157
2158 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2159 {
2160         SETTING_TRACE_BEGIN;
2161         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, SYSTEM_SETTING_CALLBACK_SLOT_0, user_data);
2162 }
2163
2164 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2165 {
2166         SETTING_TRACE_BEGIN;
2167         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTING_CALLBACK_SLOT_0);
2168 }
2169
2170 int system_settings_feature_check_bool(char *path)
2171 {
2172         bool feature_data = false;
2173         int ret = system_info_get_platform_bool(path, &feature_data);
2174         if (ret != SYSTEM_INFO_ERROR_NONE) {
2175                 SETTING_TRACE("Setting - reading feature data failed, %d", ret);
2176                 return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2177         }
2178
2179         ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2180
2181         return ret;
2182
2183 }
2184
2185 int system_setting_feature_check_incoming_call(void *value)
2186 {
2187         static bool first_query = true;
2188         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2189
2190         if (first_query == true) {
2191                 ret = system_settings_feature_check_bool(SETTING_INCOMING_CALL_PATH);
2192                 first_query = false;
2193         }
2194
2195         return ret;
2196 }
2197
2198 int system_setting_feature_check_home_screen(void *value)
2199 {
2200         static bool first_query = true;
2201         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2202
2203         if (first_query == true) {
2204                 ret = system_settings_feature_check_bool(SETTING_HOME_SCREEN_PATH);
2205                 first_query = false;
2206         }
2207
2208         return ret;
2209 }
2210
2211 int system_setting_feature_check_lock_screen(void *value)
2212 {
2213         static bool first_query = true;
2214         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2215
2216         if (first_query == true) {
2217                 ret = system_settings_feature_check_bool(SETTING_LOCK_SCREEN_PATH);
2218                 first_query = false;
2219         }
2220
2221         return ret;
2222 }
2223
2224 int system_setting_feature_check_notification_email(void *value)
2225 {
2226         static bool first_query = true;
2227         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2228
2229         if (first_query == true) {
2230                 ret = system_settings_feature_check_bool(SETTING_NOTIFICATION_EMAIL_PATH);
2231                 first_query = false;
2232         }
2233
2234         return ret;
2235 }
2236
2237 int system_setting_feature_check_wifi(void *value)
2238 {
2239         static bool first_query = true;
2240         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2241
2242         if (first_query == true) {
2243                 ret = system_settings_feature_check_bool(SETTING_WIFI_PATH);
2244                 first_query = false;
2245         }
2246
2247         return ret;
2248 }
2249
2250 int system_setting_feature_check_telephony(void *value)
2251 {
2252         static bool first_query = true;
2253         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2254
2255         if (first_query == true) {
2256                 ret = system_settings_feature_check_bool(SETTING_TELEPHONY_PATH);
2257                 first_query = false;
2258         }
2259
2260         return ret;
2261 }
2262
2263
2264 int system_setting_feature_check_font(void *value)
2265 {
2266         static bool first_query = true;
2267         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2268
2269         if (first_query == true) {
2270                 ret = system_settings_feature_check_bool(SETTING_FONT_PATH);
2271                 first_query = false;
2272         }
2273
2274         return ret;
2275 }
2276
2277 int system_setting_feature_check_accessibility_grayscale(void *value)
2278 {
2279         static bool first_query = true;
2280         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2281
2282         if (first_query == true) {
2283                 ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_GRAYSCALE_PATH);
2284                 first_query = false;
2285         }
2286
2287         return ret;
2288 }
2289
2290 int system_setting_feature_check_accessibility_negative(void *value)
2291 {
2292         static bool first_query = true;
2293         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2294
2295         if (first_query == true) {
2296                 ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_NEGATIVE_PATH);
2297                 first_query = false;
2298         }
2299
2300         return ret;
2301 }
2302
2303 int system_setting_feature_check_wearable_profile(void *value)
2304 {
2305         static bool first_query = true;
2306         static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2307
2308         if (first_query == true) {
2309                 char *profile_data = NULL;
2310                 int rotary_feature = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2311                 ret = system_info_get_platform_string(SETTING_PROFILE_PATH, &profile_data);
2312                 if (ret != SYSTEM_INFO_ERROR_NONE) {
2313                         SETTING_TRACE("Setting - reading profile string failed, %d", ret);
2314                         return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2315                 }
2316
2317                 rotary_feature = system_settings_feature_check_bool(SETTING_INPUT_ROTATING_BEZEL_PATH);
2318
2319                 if ((rotary_feature == SYSTEM_SETTINGS_ERROR_NONE) && profile_data && !strcmp(profile_data, "wearable"))
2320                         ret = SYSTEM_SETTINGS_ERROR_NONE;
2321                 else
2322                         ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED;
2323
2324                 if (profile_data)
2325                         free(profile_data);
2326
2327                 first_query = false;
2328         }
2329
2330         return ret;
2331 }
2332
2333 /*  LCOV_EXCL_START */
2334 int system_setting_get_uds_state(system_settings_key_e key, void **value)
2335 {
2336         int ** p_value = (int**)value;
2337         int vconf_value;
2338         char *vconf_string_value = NULL;
2339
2340         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_UDSM, &vconf_value)) {
2341                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2342         }
2343
2344         SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
2345
2346         if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
2347                 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
2348                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2349
2350                 if (vconf_string_value) {
2351                         if (!strcmp(vconf_string_value, "NONE")) {
2352                                 vconf_value = SYSTEM_SETTINGS_UDS_ON;
2353                         } else {
2354                                 char *app_id = NULL;
2355                                 char *package_id = NULL;
2356                                 pid_t pid = getpid();
2357
2358                                 int ret = app_manager_get_app_id(pid, &app_id);
2359                                 if (ret != APP_MANAGER_ERROR_NONE) {
2360                                         free(vconf_string_value);
2361                                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2362                                 }
2363
2364                                 if (app_id) {
2365                                         int result = 0;
2366                                         result = package_manager_get_package_id_by_app_id(app_id, &package_id);
2367                                         if (result != PACKAGE_MANAGER_ERROR_NONE) {
2368                                                 SETTING_TRACE("package_manager_get_package_id_by_app_id returned error! %d", result);
2369                                                 free(vconf_string_value);
2370                                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2371                                         }
2372
2373                                         SETTING_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value);
2374                                 }
2375
2376                                 if (package_id && strstr(vconf_string_value, package_id)) {
2377                                         vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
2378                                         SETTING_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id);
2379                                 } else {
2380                                         vconf_value = SYSTEM_SETTINGS_UDS_ON;
2381                                 }
2382
2383                         }
2384                         free(vconf_string_value);
2385                 }
2386         }
2387
2388         **p_value = vconf_value;
2389
2390
2391         return SYSTEM_SETTINGS_ERROR_NONE;
2392 }
2393 /*  LCOV_EXCL_STOP */
2394
2395 /*  LCOV_EXCL_START */
2396 int system_setting_set_changed_callback_uds_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2397 {
2398         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, SYSTEM_SETTING_CALLBACK_SLOT_4, user_data);
2399 }
2400 /*  LCOV_EXCL_STOP */
2401
2402 /*  LCOV_EXCL_START */
2403 int system_setting_unset_changed_callback_uds_state(system_settings_key_e key)
2404 {
2405         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM, SYSTEM_SETTING_CALLBACK_SLOT_4);
2406 }
2407 /*  LCOV_EXCL_STOP */
2408
2409 /*  LCOV_EXCL_START */
2410 int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2411 {
2412         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, SYSTEM_SETTING_CALLBACK_SLOT_4, user_data);
2413 }
2414 /*  LCOV_EXCL_STOP */
2415
2416 /*  LCOV_EXCL_START */
2417 int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key)
2418 {
2419         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, SYSTEM_SETTING_CALLBACK_SLOT_4);
2420 }
2421 /*  LCOV_EXCL_STOP */
2422
2423 /* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS */
2424 int system_setting_get_accessibility_tts(system_settings_key_e key, void **value)
2425 {
2426         SETTING_TRACE_BEGIN;
2427         bool vconf_value;
2428
2429         int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &vconf_value);
2430         if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
2431                 return ret;
2432         }
2433         *value = (void *)vconf_value;
2434         return ret;
2435 }
2436
2437 /*  LCOV_EXCL_START */
2438 int system_setting_set_accessibility_tts(system_settings_key_e key, void *value)
2439 {
2440         SETTING_TRACE_BEGIN;
2441         bool *vconf_value;
2442         vconf_value = (bool *)value;
2443         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, *vconf_value)) {
2444                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2445         }
2446
2447         return SYSTEM_SETTINGS_ERROR_NONE;
2448 }
2449 /*  LCOV_EXCL_STOP */
2450
2451 int system_setting_set_changed_callback_accessibility_tts(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2452 {
2453         SETTING_TRACE_BEGIN;
2454         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_TTS, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2455 }
2456
2457 int system_setting_unset_changed_callback_accessibility_tts(system_settings_key_e key)
2458 {
2459         SETTING_TRACE_BEGIN;
2460         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, SYSTEM_SETTING_CALLBACK_SLOT_2);
2461 }
2462
2463 /* SYSTEM_SETTINGS_KEY_VIBRATION */
2464 int system_setting_get_vibration(system_settings_key_e key, void **value)
2465 {
2466         SETTING_TRACE_BEGIN;
2467         bool vconf_value;
2468
2469         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vconf_value)) {
2470                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2471         }
2472         *value = (void *)vconf_value;
2473
2474         return SYSTEM_SETTINGS_ERROR_NONE;
2475 }
2476
2477 /*  LCOV_EXCL_START */
2478 int system_setting_set_vibration(system_settings_key_e key, void *value)
2479 {
2480         SETTING_TRACE_BEGIN;
2481         bool *vconf_value;
2482         vconf_value = (bool *)value;
2483         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, *vconf_value)) {
2484                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2485         }
2486
2487         return SYSTEM_SETTINGS_ERROR_NONE;
2488 }
2489 /*  LCOV_EXCL_STOP */
2490
2491 int system_setting_set_changed_callback_vibration(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2492 {
2493         SETTING_TRACE_BEGIN;
2494         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, SYSTEM_SETTINGS_KEY_VIBRATION, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2495 }
2496
2497 int system_setting_unset_changed_callback_vibration(system_settings_key_e key)
2498 {
2499         SETTING_TRACE_BEGIN;
2500         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_2);
2501 }
2502
2503 /* SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE */
2504 int system_setting_get_automatic_time_update(system_settings_key_e key, void **value)
2505 {
2506         SETTING_TRACE_BEGIN;
2507         bool vconf_value;
2508
2509         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, &vconf_value)) {
2510                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2511         }
2512         *value = (void *)vconf_value;
2513
2514         return SYSTEM_SETTINGS_ERROR_NONE;
2515 }
2516
2517 /*  LCOV_EXCL_START */
2518 int system_setting_set_automatic_time_update(system_settings_key_e key, void *value)
2519 {
2520         SETTING_TRACE_BEGIN;
2521         bool *vconf_value;
2522         vconf_value = (bool *)value;
2523         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, *vconf_value)) {
2524                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2525         }
2526
2527         return SYSTEM_SETTINGS_ERROR_NONE;
2528 }
2529 /*  LCOV_EXCL_STOP */
2530
2531 int system_setting_set_changed_callback_automatic_time_update(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2532 {
2533         SETTING_TRACE_BEGIN;
2534         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2535 }
2536
2537 int system_setting_unset_changed_callback_automatic_time_update(system_settings_key_e key)
2538 {
2539         SETTING_TRACE_BEGIN;
2540         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_2);
2541 }
2542
2543 /* SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE */
2544 int system_setting_get_developer_option_state(system_settings_key_e key, void **value)
2545 {
2546         SETTING_TRACE_BEGIN;
2547         bool vconf_value;
2548
2549         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, &vconf_value)) {
2550                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2551         }
2552         *value = (void *)vconf_value;
2553
2554         return SYSTEM_SETTINGS_ERROR_NONE;
2555 }
2556
2557 /*  LCOV_EXCL_START */
2558 int system_setting_set_developer_option_state(system_settings_key_e key, void *value)
2559 {
2560         SETTING_TRACE_BEGIN;
2561         bool *vconf_value;
2562         vconf_value = (bool *)value;
2563         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, *vconf_value)) {
2564                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2565         }
2566
2567         return SYSTEM_SETTINGS_ERROR_NONE;
2568 }
2569 /*  LCOV_EXCL_STOP */
2570
2571 int system_setting_set_changed_callback_developer_option_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2572 {
2573         SETTING_TRACE_BEGIN;
2574         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2575 }
2576
2577 int system_setting_unset_changed_callback_developer_option_state(system_settings_key_e key)
2578 {
2579         SETTING_TRACE_BEGIN;
2580         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, SYSTEM_SETTING_CALLBACK_SLOT_2);
2581 }
2582
2583 /* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE */
2584 int system_setting_get_accessibility_grayscale(system_settings_key_e key, void **value)
2585 {
2586         SETTING_TRACE_BEGIN;
2587         bool vconf_value;
2588
2589         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, &vconf_value)) {
2590                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2591         }
2592         *value = (void *)vconf_value;
2593
2594         return SYSTEM_SETTINGS_ERROR_NONE;
2595 }
2596
2597 /*  LCOV_EXCL_START */
2598 int system_setting_set_accessibility_grayscale(system_settings_key_e key, void *value)
2599 {
2600         SETTING_TRACE_BEGIN;
2601         bool *vconf_value;
2602         vconf_value = (bool *)value;
2603         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, *vconf_value)) {
2604                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2605         }
2606
2607         return SYSTEM_SETTINGS_ERROR_NONE;
2608 }
2609 /*  LCOV_EXCL_STOP */
2610
2611 int system_setting_set_changed_callback_accessibility_grayscale(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2612 {
2613         SETTING_TRACE_BEGIN;
2614         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2615 }
2616
2617 int system_setting_unset_changed_callback_accessibility_grayscale(system_settings_key_e key)
2618 {
2619         SETTING_TRACE_BEGIN;
2620         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, SYSTEM_SETTING_CALLBACK_SLOT_2);
2621 }
2622
2623 /* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR */
2624 int system_setting_get_accessibility_negative_color(system_settings_key_e key, void **value)
2625 {
2626         SETTING_TRACE_BEGIN;
2627         bool vconf_value;
2628
2629         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &vconf_value)) {
2630                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2631         }
2632         *value = (void *)vconf_value;
2633
2634         return SYSTEM_SETTINGS_ERROR_NONE;
2635 }
2636
2637 /*  LCOV_EXCL_START */
2638 int system_setting_set_accessibility_negative_color(system_settings_key_e key, void *value)
2639 {
2640         SETTING_TRACE_BEGIN;
2641         bool *vconf_value;
2642         vconf_value = (bool *)value;
2643         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, *vconf_value)) {
2644                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2645         }
2646
2647         return SYSTEM_SETTINGS_ERROR_NONE;
2648 }
2649 /*  LCOV_EXCL_STOP */
2650
2651 int system_setting_set_changed_callback_accessibility_negative_color(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2652 {
2653         SETTING_TRACE_BEGIN;
2654         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, SYSTEM_SETTING_CALLBACK_SLOT_2, user_data);
2655 }
2656
2657 int system_setting_unset_changed_callback_accessibility_negative_color(system_settings_key_e key)
2658 {
2659         SETTING_TRACE_BEGIN;
2660         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, SYSTEM_SETTING_CALLBACK_SLOT_2);
2661 }
2662
2663 /* SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED */
2664 /*  LCOV_EXCL_START */
2665 int system_setting_get_rotary_event_enabled(system_settings_key_e key, void **value)
2666 {
2667         SETTING_TRACE_BEGIN;
2668         bool vconf_value;
2669
2670         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ROTARY_EVENT_ENABLED_BOOL, &vconf_value)) {
2671                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2672         }
2673         *value = (void *)vconf_value;
2674
2675         return SYSTEM_SETTINGS_ERROR_NONE;
2676 }
2677 /*  LCOV_EXCL_STOP */
2678
2679 /*  LCOV_EXCL_START */
2680 int system_setting_set_rotary_event_enabled(system_settings_key_e key, void *value)
2681 {
2682         SETTING_TRACE_BEGIN;
2683         bool *vconf_value;
2684         vconf_value = (bool *)value;
2685         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ROTARY_EVENT_ENABLED_BOOL, *vconf_value)) {
2686                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2687         }
2688
2689         return SYSTEM_SETTINGS_ERROR_NONE;
2690 }
2691 /*  LCOV_EXCL_STOP */
2692
2693 /*  LCOV_EXCL_START */
2694 int system_setting_set_changed_callback_rotary_event_enabled(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2695 {
2696         SETTING_TRACE_BEGIN;
2697         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ROTARY_EVENT_ENABLED_BOOL, SYSTEM_SETTINGS_KEY_ROTARY_EVENT_ENABLED, SYSTEM_SETTING_CALLBACK_SLOT_3, user_data);
2698 }
2699 /*  LCOV_EXCL_STOP */
2700
2701 /*  LCOV_EXCL_START */
2702 int system_setting_unset_changed_callback_rotary_event_enabled(system_settings_key_e key)
2703 {
2704         SETTING_TRACE_BEGIN;
2705         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ROTARY_EVENT_ENABLED_BOOL, SYSTEM_SETTING_CALLBACK_SLOT_3);
2706 }
2707 /*  LCOV_EXCL_STOP */
2708