[ACR-876] Support Ultra Data Save Status Get/Change CB API
[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 <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28 #include <aul.h>
29
30 #include <regex.h>
31
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
51 #include <tzplatform_config.h>
52 #include <alarm.h>
53
54
55
56 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
57 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
58
59 #define SETTING_TIME_ZONEINFO_PATH              "/usr/share/zoneinfo/"
60 #define SETTING_TIME_SHARE_LOCAL_PATH   "/usr/share/locale"
61 #define SETTING_TZONE_SYMLINK_PATH              "/opt/etc/localtime"
62
63
64 #define __FREE(del, arg) do { \
65                 if (arg) { \
66                         del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\
67                         arg = NULL; \
68                 } \
69         } while (0);
70 #define FREE(arg) __FREE(free, arg)
71
72 #ifdef SETTING_ARCH_64
73 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib64/libsystem-settings-util.so.0.1.0"
74 #else
75 #define SETTING_UTILS_SO_FILE_PATH "/usr/lib/libsystem-settings-util.so.0.1.0"
76 #endif
77
78 int _is_file_accessible(const char *path);
79
80 static bool dl_is_supported_image_type_load(char *path);
81 static bool dl_font_config_set(char *font_name);
82 static char *dl_get_font_info(char *str);
83 static int dl_is_available_font(char *str);
84 static void dl_font_size_set();
85 static void dl_font_config_set_notification();
86
87
88 #ifndef VCONFKEY_SETAPPL_UDSM
89 #define VCONFKEY_SETAPPL_UDSM "db/setting/udsm"
90 #endif
91
92 #ifndef VCONFKEY_SETAPPL_UDSM_PKGID_LIST
93 #define VCONFKEY_SETAPPL_UDSM_PKGID_LIST "db/setting/udsm/pkgid_list"
94 #endif
95
96
97 /**
98  * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
99  * @return the ringtone file path specified by user in normal case
100  *                 if it's not accessable, return the default ringtone path
101  */
102 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
103 {
104         SETTING_TRACE_BEGIN;
105         char *vconf_value;
106         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
107                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
108         }
109
110         /* check to see if it's accessable -> OK */
111         /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
112         int is_load = _is_file_accessible(vconf_value);
113         if (is_load == 0) {
114                 *value = vconf_value;
115         } else { /* not zero on errro */
116                 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
117         }
118
119         /**value = vconf_value; */
120         return SYSTEM_SETTINGS_ERROR_NONE;
121 }
122
123
124 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
125 {
126         SETTING_TRACE_BEGIN;
127         char *vconf_value;
128         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
129                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
130         }
131
132         /* check to see if it's accessable -> OK */
133         /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
134         int is_load = _is_file_accessible(vconf_value);
135         if (is_load == 0) {
136                 *value = vconf_value;
137         } else { /* not zero on errro */
138                 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
139         }
140
141         return SYSTEM_SETTINGS_ERROR_NONE;
142 }
143
144
145 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
146 {
147         SETTING_TRACE_BEGIN;
148         char *vconf_value;
149         if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
150                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
151         }
152         *value = vconf_value;
153         return SYSTEM_SETTINGS_ERROR_NONE;
154 }
155
156
157 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
158 {
159         SETTING_TRACE_BEGIN;
160         char *vconf_value;
161
162         if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
163                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
164         }
165         *value = vconf_value;
166
167         return SYSTEM_SETTINGS_ERROR_NONE;
168 }
169
170
171 /* [int] vconf GET */
172 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
173 {
174         SETTING_TRACE_BEGIN;
175         int vconf_value;
176         int ** val = (int**)value;
177
178         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
179                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
180         }
181         **val = vconf_value;
182
183         return SYSTEM_SETTINGS_ERROR_NONE;
184 }
185
186
187 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
188 {
189         SETTING_TRACE_BEGIN;
190         char *font_name = dl_get_font_info("default");
191         if (font_name) {
192                 *value = (void *)font_name;
193                 return SYSTEM_SETTINGS_ERROR_NONE;
194         } else {
195                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
196         }
197 }
198
199 /* [int] vconf GET */
200 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
201 {
202         SETTING_TRACE_BEGIN;
203         char *font_name = dl_get_font_info("cur");
204         *value = (void *)font_name;
205
206         return SYSTEM_SETTINGS_ERROR_NONE;
207 }
208
209
210 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
211 {
212         SETTING_TRACE_BEGIN;
213         bool vconf_value;
214
215         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
216                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
217         }
218         *value = (void *)vconf_value;
219
220         return SYSTEM_SETTINGS_ERROR_NONE;
221 }
222
223 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
224 {
225         SETTING_TRACE_BEGIN;
226         bool vconf_value;
227
228         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
229                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
230         }
231         *value = (void *)vconf_value;
232
233         return SYSTEM_SETTINGS_ERROR_NONE;
234 }
235
236 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
237 {
238         SETTING_TRACE_BEGIN;
239         bool vconf_value;
240
241         if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &vconf_value)) {
242                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
243         }
244         *value = (void *)vconf_value;
245
246         return SYSTEM_SETTINGS_ERROR_NONE;
247 }
248 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
249
250
251 /**
252  * get current lock scren app package name (string)
253  *
254  * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
255  */
256 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
257 {
258         SETTING_TRACE_BEGIN;
259         char *pkg_name = NULL;
260         int locktype = -1;
261         system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
262
263         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
264                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
265         }
266
267         if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
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 "/opt/share/settings/Ringtones"
297 #define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones"
298 #define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json"
299
300 #if 0
301 static char* _get_json_file_path()
302 {
303         // for testing
304         return JSONFILE;
305 }
306 #endif
307
308 int system_setting_add_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
309 {
310         SETTING_TRACE_BEGIN;
311         char* pathval = (char*)value;
312
313 #ifdef USE_JSONFILE
314         // NOT IN USE
315         JsonParser *parser = ss_json_ringtone_open_file(JSONFILE);
316 #else
317         JsonParser *parser = ss_json_ringtone_load_from_data();
318 #endif
319
320         JsonNode *root = json_parser_get_root(parser);
321
322         // dirname
323         // basename
324         int ret = SYSTEM_SETTINGS_ERROR_NONE;
325         if (false == ss_json_ringtone_contain(root, pathval)) {
326                 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
327                 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
328                 // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER)
329                 ss_json_ringtone_add(root, JSONFILE, pathval, pathval);
330                 SETTING_TRACE("pathval is : %s -- OK", pathval);
331         } else {
332                 SETTING_TRACE("pathval is duplicated : %s", pathval);
333                 SETTING_TRACE("---> dirname is : %s ", dirname(strdup(pathval)));
334                 SETTING_TRACE("---> basename is : %s ", basename(strdup(pathval)));
335                 ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
336         }
337
338         if (parser) {
339                 g_object_unref(parser);
340                 parser = NULL;
341         }
342
343         return ret;
344 }
345
346 int system_setting_del_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
347 {
348         SETTING_TRACE_BEGIN;
349         char* pathval = (char*)value;
350 #ifdef USE_JSONFILE
351         // NOT IN USE
352         JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
353 #else
354         JsonParser* parser = ss_json_ringtone_load_from_data();
355 #endif
356         JsonNode *root = json_parser_get_root(parser);
357
358         ss_json_ringtone_remove(root, JSONFILE, pathval);
359         //void ss_json_ringtone_remove(JsonNode *root,  char* filename, char* path_to_del)
360
361         ss_json_ringtone_print(root);
362         if (parser) {
363                 g_object_unref(parser);
364                 parser = NULL;
365         }
366
367         return SYSTEM_SETTINGS_ERROR_NONE;
368 }
369
370
371 static int _compare_cb(const void *d1, const void *d2)
372 {
373         fileNodeInfo *pNode1 = (fileNodeInfo *)d1;
374         fileNodeInfo *pNode2 = (fileNodeInfo *)d2;
375
376         return strcmp(pNode1->media_name, pNode2->media_name);
377 }
378
379 /*
380  * get the RINGTONE list
381  */
382 static void _get_default_ringtones(system_settings_key_e key, system_setting_data_type_e data_type,  system_settings_iter_cb callback, void *data)
383 {
384         SETTING_TRACE_BEGIN;
385         /*Get file list */
386         Eina_List *filelist = NULL;
387         Eina_List *l = NULL;
388         fileNodeInfo *node = NULL;
389         int idx = 0;
390
391         //-----------------------------------------------------------------------------------------------------------------
392         // 1. get the default ringtone list
393         //-----------------------------------------------------------------------------------------------------------------
394         int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist);
395         if (ret != 0) {
396                 SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH);
397         }
398         filelist = eina_list_sort(filelist, eina_list_count(filelist), _compare_cb);
399
400         EINA_LIST_FOREACH(filelist, l, node)
401         {
402                 SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name);
403                 // @todo assert NULL check
404                 if (callback) {
405                         char temp[1024];
406                         snprintf(temp, 1024, "%s/%s", node->path, node->name);
407                         char* path = strdup(temp);
408                         bool ret = callback(idx, (void *)(path), data);
409                         if (path) {
410                                 free(path);
411                                 path = NULL;
412                         }
413                         if (ret == false) {
414                                 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
415                                 break;
416                         }
417
418                 } else {
419                         SETTING_TRACE("--> system_setting_data_iterator is NULL");
420                 }
421         }
422
423         l = NULL;
424         node = NULL;
425         EINA_LIST_FOREACH(filelist, l, node)
426         {
427                 FREE(node->path);
428                 FREE(node->name);
429                 FREE(node->media_name);
430                 FREE(node);
431         }
432         eina_list_free(filelist);
433         filelist = NULL;
434
435 }
436
437 static void _get_user_ringtones(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
438 {
439         SETTING_TRACE_BEGIN;
440
441 #ifdef USE_JSONFILE
442         // NOT IN USE
443         JsonParser* parser = ss_json_ringtone_open_file(JSONFILE);
444 #else
445         JsonParser* parser = ss_json_ringtone_load_from_data();
446 #endif
447
448         JsonNode *root = json_parser_get_root(parser);
449         int size = json_array_get_length(json_node_get_array(root));
450
451         int i = 0;
452         for (i = 0; i < size ; i++) {
453                 JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i);
454                 char *nameval = (char *)json_object_get_string_member(ringtone, "name");
455                 char *pathval = (char *)json_object_get_string_member(ringtone, "path");
456                 SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval);
457                 if (callback) {
458                         char* path = strdup(pathval);
459                         bool ret = callback(i, (void *)(path), data);
460                         if (ret == false) {
461                                 SETTING_TRACE("quit the iteration by return value == false : %d", ret);
462                                 break;
463                         }
464                 } else {
465                         SETTING_TRACE("--> callback is NULL");
466                 }
467         }
468 }
469
470 int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, system_settings_iter_cb callback, void *data)
471 {
472         SETTING_TRACE_BEGIN;
473
474         _get_default_ringtones(key, data_type, callback, data);
475         //-----------------------------------------------------------------------------------------------------------------
476         // 2. get the USER ringtone list
477         //-----------------------------------------------------------------------------------------------------------------
478         _get_user_ringtones(key, data_type, callback, data);
479
480         return SYSTEM_SETTINGS_ERROR_NONE;
481 }
482
483
484 /*  LCOV_EXCL_START */
485 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
486 {
487         SETTING_TRACE_BEGIN;
488         char *vconf_value;
489         vconf_value = (char *)value;
490
491         int ret = _is_file_accessible(vconf_value);
492         if (ret == 0) {
493                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
494                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
495                 }
496         } else {
497                 /* @todo add a common ret_handler */
498                 return ret;
499         }
500
501         return SYSTEM_SETTINGS_ERROR_NONE;
502 }
503 /*  LCOV_EXCL_STOP */
504
505
506 /*  LCOV_EXCL_START */
507 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
508 {
509         SETTING_TRACE_BEGIN;
510         char *vconf_value;
511         vconf_value = (char *)value;
512
513         int ret = _is_file_accessible(vconf_value);
514         if (ret == 0) {
515                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
516                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
517                 }
518         } else {
519                 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
520                 /* @todo add a common ret_handler */
521                 return ret;
522         }
523
524         return SYSTEM_SETTINGS_ERROR_NONE;
525 }
526 /*  LCOV_EXCL_STOP */
527
528 /*  LCOV_EXCL_START */
529 static bool dl_is_supported_image_type_load(char *path)
530 {
531         void *handle = NULL;
532         char *error;
533         bool ret = false;
534         bool (*image_type_check)(char *path);
535
536         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
537         if (!handle) {
538                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
539                 return false;
540         }
541
542         image_type_check = dlsym(handle, "__is_supported_image_type_load");
543         if ((error = dlerror()) != NULL) {
544                 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
545                 if (handle)
546                         dlclose(handle);
547                 return false;
548         }
549         ret = image_type_check(path);
550         if (handle)
551                 dlclose(handle);
552         return ret;
553 }
554 /*  LCOV_EXCL_STOP */
555
556 /*  LCOV_EXCL_START */
557 static int dl_is_available_font(char *str)
558 {
559         void *handle = NULL;
560         char *error;
561         int ret = false;
562         int (*check_available_font)(char *font_name);
563
564         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
565         if (!handle) {
566                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
567                 return false;
568         }
569
570         check_available_font = dlsym(handle, "__is_available_font");
571         if ((error = dlerror()) != NULL) {
572                 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
573                 if (handle)
574                         dlclose(handle);
575                 return false;
576         }
577         ret = check_available_font(str);
578         if (handle)
579                 dlclose(handle);
580         return ret;
581 }
582 /*  LCOV_EXCL_STOP */
583
584 /*  LCOV_EXCL_START */
585 static void dl_font_size_set()
586 {
587         void *handle = NULL;
588         char *error;
589         void (*set_font_size)();
590
591         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
592         if (!handle) {
593                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
594                 return;
595         }
596
597         set_font_size = dlsym(handle, "__font_size_set");
598         if ((error = dlerror()) != NULL) {
599                 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
600                 if (handle)
601                         dlclose(handle);
602                 return;
603         }
604         set_font_size();
605         if (handle)
606                 dlclose(handle);
607         return;
608 }
609 /*  LCOV_EXCL_STOP */
610
611 /*  LCOV_EXCL_START */
612 static void dl_font_config_set_notification()
613 {
614         void *handle = NULL;
615         char *error;
616         void (*set_font_nodification)();
617
618         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
619         if (!handle) {
620                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
621                 return;
622         }
623
624         set_font_nodification = dlsym(handle, "font_config_set_notification");
625         if ((error = dlerror()) != NULL) {
626                 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
627                 if (handle)
628                         dlclose(handle);
629                 return;
630         }
631         set_font_nodification();
632         if (handle)
633                 dlclose(handle);
634         return;
635 }
636 /*  LCOV_EXCL_STOP */
637
638 /*  LCOV_EXCL_START */
639 static bool dl_font_config_set(char *font_name)
640 {
641         void *handle = NULL;
642         char *error;
643         bool ret = false;
644         bool (*check_font_type)(char *font_name);
645
646         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
647         if (!handle) {
648                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
649                 return false;
650         }
651
652         check_font_type = dlsym(handle, "font_config_set");
653         if ((error = dlerror()) != NULL) {
654                 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
655                 if (handle)
656                         dlclose(handle);
657                 return false;
658         }
659         ret = check_font_type(font_name);
660         if (handle)
661                 dlclose(handle);
662         return ret;
663 }
664 /*  LCOV_EXCL_STOP */
665
666 /*  LCOV_EXCL_START */
667 static char *dl_get_font_info(char *str)
668 {
669         void *handle = NULL;
670         char *error;
671         char *ret = NULL;
672         char *(*get_font_info)();
673
674         handle = dlopen(SETTING_UTILS_SO_FILE_PATH,  RTLD_LAZY);
675         if (!handle) {
676                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
677                 return false;
678         }
679
680         if (strcmp(str, "cur") == 0)
681                 get_font_info = dlsym(handle, "_get_cur_font");
682         else
683                 get_font_info = dlsym(handle, "_get_default_font");
684
685         if ((error = dlerror()) != NULL) {
686                 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
687                 if (handle)
688                         dlclose(handle);
689                 return false;
690         }
691         ret = get_font_info();
692         if (handle)
693                 dlclose(handle);
694         return ret;
695 }
696 /*  LCOV_EXCL_STOP */
697
698 /*  LCOV_EXCL_START */
699 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
700 bool __is_supported_image_type_by_ext(char *file_path)
701 {
702         SETTING_TRACE_BEGIN;
703         regex_t fsm;
704         regmatch_t str[2048 + 1];
705
706         if (!file_path) return false;
707
708         int ret = false;
709         if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
710                 SETTING_TRACE("regular expresstion fail");
711                 return 1;
712         }
713
714         /* code */
715         if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
716                 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
717                 ret = 0;
718         } else {
719                 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
720                 ret = 1;
721         }
722         return ret;
723 }
724 /*  LCOV_EXCL_STOP */
725 #ifdef TIZEN_WEARABLE
726 /*  LCOV_EXCL_START */
727 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
728 {
729         SETTING_TRACE_BEGIN;
730         char buffer[256];
731         const char *find_str = "extended_wallpaper_";
732         char *ch = NULL;
733
734         if (!(ch = strstr(file_path, find_str))) {
735                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
736         }
737         strncpy(buffer, file_path, ch - file_path);
738         buffer[ch - file_path] = 0;
739         sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
740
741         if (!isdigit(buffer[0])) {
742                 SETTING_TRACE("%s is not number", buffer);
743                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
744         }
745
746         *num = atoi(buffer);
747
748         return SYSTEM_SETTINGS_ERROR_NONE;
749 }
750 /*  LCOV_EXCL_STOP */
751
752 /*  LCOV_EXCL_START */
753 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
754 {
755         SETTING_TRACE_BEGIN;
756         if (!source_file_path || !dest_file_path) {
757                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
758         }
759
760         char buf[1024];
761
762         int fd;
763         fd = open(source_file_path, O_RDONLY);
764         if (fd < 0) {
765                 SETTING_TRACE("file open failed: %s", source_file_path);
766                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
767         }
768
769         int fd2;
770         fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
771         if (fd2 < 0) {
772                 SETTING_TRACE("file creation failed: %s", dest_file_path);
773                 close(fd);
774                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
775         }
776
777         while (read(fd, buf, sizeof(buf) - 1) > 0) {
778                 write(fd2, buf, sizeof(buf) - 1);
779         }
780
781         close(fd2);
782         close(fd);
783
784         if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
785                 SETTING_TRACE("chmod failed: %s", dest_file_path);
786         }
787
788         return SYSTEM_SETTINGS_ERROR_NONE;
789 }
790 /*  LCOV_EXCL_STOP */
791
792 /*  LCOV_EXCL_START */
793 static int system_setting_remove_oldest_extended_wallpaper()
794 {
795         SETTING_TRACE_BEGIN;
796         DIR *dp;
797         struct dirent *dirp;
798         char *min_image_name = NULL;
799         unsigned int min_image_num = 0;
800         unsigned int temp_image_num = 0;
801         int image_count = 0;
802
803         if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
804                 SETTING_TRACE("opendir error");
805                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
806         }
807
808         while ((dirp = readdir(dp))) {
809                 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
810                         continue;
811
812                 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
813                     != SYSTEM_SETTINGS_ERROR_NONE) {
814                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
815                 }
816
817                 if ((image_count == 0) || (min_image_num > temp_image_num)) {
818                         min_image_num = temp_image_num;
819                         min_image_name = dirp->d_name;
820                 }
821
822                 image_count++;
823         }
824
825         char buf[512];
826         if (min_image_name) {
827                 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
828                 if (remove(buf) < 0) {  /* remove oldest image */
829                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
830                 }
831         }
832
833         return SYSTEM_SETTINGS_ERROR_NONE;
834 }
835 /*  LCOV_EXCL_STOP */
836
837 /*  LCOV_EXCL_START */
838 static int system_setting_check_extended_wallpaper(const char *file_path)
839 {
840         char buffer[512];
841         SETTING_TRACE_BEGIN;
842         if (!file_path || !strlen(file_path))
843                 return 0;
844         snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
845         return (strstr(file_path, buffer) != NULL);
846 }
847 /*  LCOV_EXCL_STOP */
848
849 #define WALLPAPER_MAX_COUNT             10
850 #endif
851 /*  LCOV_EXCL_START */
852 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
853 {
854         SETTING_TRACE_BEGIN;
855         char *vconf_value;
856         vconf_value = (char *)value;
857
858         bool isok  = dl_is_supported_image_type_load(vconf_value);
859         if (!isok) {
860                 /* not supported */
861                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
862                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
863         } else {
864                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
865         }
866
867         /* error handling here */
868         if (_is_file_accessible(vconf_value) != 0)
869                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
870 #ifdef TIZEN_MOBILE
871         if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
872                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
873         }
874 #endif
875
876 #ifdef TIZEN_WEARABLE
877         if (system_setting_check_extended_wallpaper(vconf_value)) {     /* New extended wallpaper */
878                 DIR *dp = NULL;
879                 struct dirent *dirp;
880                 unsigned int max_image_num = 0;
881                 unsigned int temp_image_num = 0;
882                 int image_count = 0;
883
884                 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
885                         SETTING_TRACE("Setting - dir open error!");
886                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
887                 }
888
889                 /* Check a max number of wallpapers */
890                 while ((dirp = readdir(dp))) {
891                         if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
892                                 continue;
893
894                         if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
895                             != SYSTEM_SETTINGS_ERROR_NONE) {
896                                 if (dp)
897                                         closedir(dp);
898                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
899                         }
900
901                         if ((image_count == 0) || (max_image_num < temp_image_num)) {
902                                 max_image_num = temp_image_num;
903                         }
904
905                         image_count++;
906                 }
907                 if (dp)
908                         closedir(dp);
909
910                 /* Numbering rule: Gear is odd number */
911                 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
912                                                         : max_image_num + 2;
913
914                 char file_name_buffer[512];
915                 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
916                                         _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
917
918                 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
919                 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
920                     != SYSTEM_SETTINGS_ERROR_NONE) {
921                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
922                 }
923
924                 /* remove oldest wallpaper */
925                 if (image_count >= WALLPAPER_MAX_COUNT) {
926                         if (system_setting_remove_oldest_extended_wallpaper()
927                             != SYSTEM_SETTINGS_ERROR_NONE) {
928                                 remove(file_name_buffer);
929                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
930                         }
931                 }
932
933                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
934                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
935                 }
936
937                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
938                                                                                                         VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
939                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
940                 }
941         } else {
942                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
943                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
944                 }
945         }
946 #endif
947
948         return SYSTEM_SETTINGS_ERROR_NONE;
949 }
950 /*  LCOV_EXCL_STOP */
951
952 /*  LCOV_EXCL_START */
953 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
954 {
955         SETTING_TRACE_BEGIN;
956         char *vconf_value;
957         vconf_value = (char *)value;
958
959         bool isok  = dl_is_supported_image_type_load(vconf_value);
960         if (!isok) {
961                 /* not supported */
962                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
963                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
964         } else {
965                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
966         }
967
968         /* error handling here */
969         if (_is_file_accessible(vconf_value) != 0)
970                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
971
972         if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
973                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
974         }
975
976         return SYSTEM_SETTINGS_ERROR_NONE;
977 }
978 /*  LCOV_EXCL_STOP */
979
980 /*  LCOV_EXCL_START */
981 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
982 {
983         SETTING_TRACE_BEGIN;
984         int *vconf_value;
985         vconf_value = *(int **)value;
986
987         if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
988                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
989         }
990
991         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
992                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
993         }
994         dl_font_size_set();
995         SETTING_TRACE_END;
996         return SYSTEM_SETTINGS_ERROR_NONE;
997 }
998 /*  LCOV_EXCL_STOP */
999 /**
1000  * [internal API]
1001  */
1002 /*  LCOV_EXCL_START */
1003 void *font_conf_doc_parse(char *doc_name, char *font_name)
1004 {
1005         SETTING_TRACE_BEGIN;
1006         xmlDocPtr doc = NULL;
1007         xmlNodePtr cur = NULL;
1008         xmlNodePtr cur2 = NULL;
1009         xmlNodePtr cur3 = NULL;
1010         xmlChar *key = NULL;
1011
1012         doc = xmlParseFile(doc_name);
1013
1014         cur = xmlDocGetRootElement(doc);
1015
1016         if (cur == NULL) {
1017                 xmlFreeDoc(doc);
1018                 doc = NULL;
1019                 return NULL;
1020         }
1021
1022         if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
1023                 xmlFreeDoc(doc);
1024                 doc = NULL;
1025                 return NULL;
1026         }
1027
1028         cur = cur->xmlChildrenNode;
1029
1030         bool is_changed = false;
1031         while (cur != NULL) {
1032                 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
1033                         cur2 = cur->xmlChildrenNode;
1034                         while (cur2 != NULL) {
1035                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
1036                                         xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
1037                                         /* if name is not 'family', break */
1038                                         if (xmlStrcmp(name, (const xmlChar *)"family")) {
1039                                                 xmlFree(name);
1040                                                 name = NULL;
1041                                                 break;
1042                                         }
1043                                         xmlFree(name);
1044                                         name = NULL;
1045
1046                                         cur3 = cur2->xmlChildrenNode;
1047                                         while (cur3 != NULL) {
1048                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
1049                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1050                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1051                                                         xmlFree(key);
1052                                                         key = NULL;
1053                                                         is_changed = true;
1054                                                 }
1055                                                 cur3 = cur3->next;
1056                                         }
1057                                 }
1058                                 cur2 = cur2->next;
1059                         }
1060                 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
1061                         cur2 = cur->xmlChildrenNode;
1062                         while (cur2 != NULL) {
1063                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
1064                                         xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
1065                                         key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
1066                                         xmlFree(key);
1067                                         key = NULL;
1068                                         is_changed = true;
1069                                 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
1070                                         cur3 = cur2->xmlChildrenNode;
1071                                         while (cur3 != NULL) {
1072                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
1073                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
1074                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
1075                                                         xmlFree(key);
1076                                                         key = NULL;
1077                                                         is_changed = true;
1078                                                         cur3 = cur3->next;
1079                                                         return doc;
1080                                                 }
1081                                                 cur3 = cur3->next;
1082                                         }
1083                                 }
1084                                 cur2 = cur2->next;
1085                         }
1086                 }
1087                 cur = cur->next;
1088         }
1089
1090         if (is_changed) {
1091                 return doc;
1092         } else {
1093                 xmlFreeDoc(doc);
1094                 doc = NULL;
1095                 return NULL;
1096         }
1097 }
1098 /*  LCOV_EXCL_STOP */
1099
1100 /*  LCOV_EXCL_START */
1101 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1102 {
1103         SETTING_TRACE_BEGIN;
1104         char *font_name = NULL;
1105         font_name = (char *)value;
1106
1107         /* get current font list */
1108         int is_found = dl_is_available_font(font_name);
1109
1110         if (is_found) {
1111                 SETTING_TRACE("found font : %s ", font_name);
1112         } else {
1113                 SETTING_TRACE(" NOT found font : %s ", font_name);
1114                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1115         }
1116
1117         bool bsave = dl_font_config_set(font_name);
1118
1119         if (!bsave) {
1120                 SETTING_TRACE(" font type save error by font_config_set() ");
1121                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1122         } else {
1123                 SETTING_TRACE(" save OK - font_config_set() ");
1124         }
1125
1126         xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
1127         if (doc != NULL) {
1128                 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
1129                 xmlFreeDoc(doc);
1130                 doc = NULL;
1131         }
1132
1133         dl_font_config_set_notification();
1134
1135         char *vconf_value;
1136         vconf_value = (char *)value;
1137
1138         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
1139                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1140         }
1141         return SYSTEM_SETTINGS_ERROR_NONE;
1142 }
1143 /*  LCOV_EXCL_STOP */
1144
1145 /*  LCOV_EXCL_START */
1146 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1147 {
1148         SETTING_TRACE_BEGIN;
1149         bool *vconf_value;
1150         vconf_value = (bool *)value;
1151         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
1152                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1153         }
1154         return SYSTEM_SETTINGS_ERROR_NONE;
1155 }
1156 /*  LCOV_EXCL_STOP */
1157
1158 /*  LCOV_EXCL_START */
1159 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1160 {
1161         SETTING_TRACE_BEGIN;
1162         bool *vconf_value;
1163         vconf_value = (bool *)value;
1164         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
1165                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1166         }
1167         return SYSTEM_SETTINGS_ERROR_NONE;
1168
1169 }
1170 /*  LCOV_EXCL_STOP */
1171
1172 /*  LCOV_EXCL_START */
1173 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1174 {
1175         SETTING_TRACE_BEGIN;
1176         bool *vconf_value;
1177         vconf_value = (bool *)value;
1178         if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
1179                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1180         }
1181
1182         return SYSTEM_SETTINGS_ERROR_NONE;
1183 }
1184 /*  LCOV_EXCL_STOP */
1185
1186 /*  LCOV_EXCL_START */
1187 static int category_func(const char *name, void *user_data)
1188 {
1189         SETTING_TRACE_BEGIN;
1190         static char *category = "lock-screen";
1191         if (name && !strcmp(name, category)) {
1192                 SETTING_TRACE(" SAME ");
1193                 return -1;
1194         } else {
1195                 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
1196                 return 0;
1197         }
1198
1199         return 0;
1200 }
1201 /*  LCOV_EXCL_STOP */
1202
1203 /**
1204  *
1205  * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
1206  *
1207  */
1208
1209 /*  LCOV_EXCL_START */
1210 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1211 {
1212         SETTING_TRACE_BEGIN;
1213         char *vconf_value;
1214         vconf_value = (char *)value;            /* ex) com.samsung.lockscreen */
1215
1216         int r = 0;
1217         pkgmgrinfo_appinfo_h handle;
1218         r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
1219         if (r != PMINFO_R_OK) {
1220                 SETTING_TRACE("*** pkginfo failed ");
1221                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1222         } else {
1223                 SETTING_TRACE("%x", handle);
1224         }
1225
1226         int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
1227         if (ret != PMINFO_R_OK) {
1228                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
1229                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1230         }
1231
1232         pkgmgrinfo_appinfo_destroy_appinfo(handle);
1233         /*----------------------------------------------------------------------------------- */
1234         int locktype = -1;
1235         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
1236                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1237         }
1238
1239         if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1240                 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
1241
1242         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
1243                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1244         }
1245
1246         if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
1247                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
1248                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1249                 }
1250         }
1251         return SYSTEM_SETTINGS_ERROR_NONE;
1252 }
1253 /*  LCOV_EXCL_STOP */
1254
1255 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
1256 /* */
1257
1258 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1259 {
1260         SETTING_TRACE_BEGIN;
1261         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1262 }
1263
1264 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
1265 {
1266         SETTING_TRACE_BEGIN;
1267         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1268 }
1269
1270 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1271 {
1272         SETTING_TRACE_BEGIN;
1273         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1274 }
1275
1276 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1277 {
1278         SETTING_TRACE_BEGIN;
1279         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1280 }
1281
1282 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1283 {
1284         SETTING_TRACE_BEGIN;
1285         return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1286 }
1287
1288 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1289 {
1290         SETTING_TRACE_BEGIN;
1291         return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1292 }
1293
1294 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1295 {
1296         SETTING_TRACE_BEGIN;
1297         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1298 }
1299
1300 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1301 {
1302         SETTING_TRACE_BEGIN;
1303         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1304 }
1305
1306 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1307 {
1308         SETTING_TRACE_BEGIN;
1309         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1310 }
1311
1312 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1313 {
1314         SETTING_TRACE_BEGIN;
1315         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1316 }
1317
1318 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1319 {
1320         SETTING_TRACE_BEGIN;
1321         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1322 }
1323
1324 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1325 {
1326         SETTING_TRACE_BEGIN;
1327         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1328 }
1329
1330 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1331 {
1332         SETTING_TRACE_BEGIN;
1333         return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1334 }
1335
1336 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1337 {
1338         SETTING_TRACE_BEGIN;
1339         return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1340 }
1341
1342 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1343 {
1344         SETTING_TRACE_BEGIN;
1345         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1346 }
1347
1348 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1349 {
1350         SETTING_TRACE_BEGIN;
1351         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1352 }
1353
1354
1355 /**
1356  * @todo need to add custom event notification method
1357  */
1358 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1359 {
1360         SETTING_TRACE_BEGIN;
1361         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1362 }
1363
1364 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1365 {
1366         SETTING_TRACE_BEGIN;
1367         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1368 }
1369
1370 /* TODO : 2th argument, callback, is not in use. */
1371 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1372 {
1373         SETTING_TRACE_BEGIN;
1374         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1375 }
1376
1377 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1378 {
1379         SETTING_TRACE_BEGIN;
1380         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1381 }
1382
1383 /*//////////////////////////////////////////////////////////////////////////////////////// */
1384 /*--------------------------------------- */
1385 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1386 {
1387         SETTING_TRACE_BEGIN;
1388         char *vconf_value = NULL;
1389         if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1390                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1391         }
1392
1393         /* parsing validation */
1394         /* en_US.UTF-8 */
1395         char arr[20];
1396         snprintf(arr, 20, "%s", vconf_value);
1397         arr[5] = '\0';
1398         *value = strdup(arr);
1399         free(vconf_value);
1400         vconf_value = NULL;
1401
1402         return SYSTEM_SETTINGS_ERROR_NONE;
1403 }
1404
1405 /*  LCOV_EXCL_START */
1406 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1407 {
1408         SETTING_TRACE_BEGIN;
1409         char *vconf_value = NULL;
1410         vconf_value = (char *)value;
1411
1412         char *ext = "UTF-8";
1413
1414         char arr[20];
1415         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1416
1417         if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1418                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1419         }
1420         return SYSTEM_SETTINGS_ERROR_NONE;
1421 }
1422 /*  LCOV_EXCL_STOP */
1423
1424 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1425 {
1426         SETTING_TRACE_BEGIN;
1427         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1428 }
1429
1430 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1431 {
1432         SETTING_TRACE_BEGIN;
1433         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1434 }
1435
1436
1437 /*--------------------------------------- */
1438 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1439 {
1440         SETTING_TRACE_BEGIN;
1441         char *vconf_value = NULL;
1442         if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1443                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1444         }
1445
1446         /* parsing validation */
1447         /* en_US.UTF-8 */
1448         char arr[20];
1449         snprintf(arr, 20, "%s", vconf_value);
1450         arr[5] = '\0';
1451         *value = strdup(arr);
1452         free(vconf_value);
1453         vconf_value = NULL;
1454         return SYSTEM_SETTINGS_ERROR_NONE;
1455 }
1456
1457 /*  LCOV_EXCL_START */
1458 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1459 {
1460         SETTING_TRACE_BEGIN;
1461         char *vconf_value = NULL;
1462         vconf_value = (char *)value;
1463
1464         char *ext = "UTF-8";
1465
1466         char arr[20];
1467         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1468
1469         if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1470                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1471         }
1472         return SYSTEM_SETTINGS_ERROR_NONE;
1473 }
1474 /*  LCOV_EXCL_STOP */
1475
1476 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1477 {
1478         SETTING_TRACE_BEGIN;
1479         /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1480         return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1481 }
1482
1483 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1484 {
1485         SETTING_TRACE_BEGIN;
1486         return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1487 }
1488
1489 /*--------------------------------------- */
1490 /*  LCOV_EXCL_START */
1491 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1492 {
1493         SETTING_TRACE_BEGIN;
1494         int vconf_value;
1495
1496         if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1497                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1498         }
1499
1500         bool ret_value = true;
1501         if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1502                 ret_value = false;
1503         else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1504                 ret_value = true;
1505
1506         *value = (void *)ret_value;
1507
1508         return SYSTEM_SETTINGS_ERROR_NONE;
1509 }
1510 /*  LCOV_EXCL_STOP */
1511
1512 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1513 {
1514         SETTING_TRACE_BEGIN;
1515         bool *vconf_value;
1516
1517         vconf_value = (bool *)value;
1518
1519         if (*vconf_value) {
1520                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1521                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1522                 }
1523
1524         } else {
1525                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1526                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1527                 }
1528
1529         }
1530
1531         return SYSTEM_SETTINGS_ERROR_NONE;
1532 }
1533
1534 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1535 {
1536         SETTING_TRACE_BEGIN;
1537         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1538 }
1539
1540 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1541 {
1542         SETTING_TRACE_BEGIN;
1543         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1544 }
1545
1546 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1547 {
1548         char tzpath[256];
1549         ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath)-1);
1550         if (len != -1) {
1551                 tzpath[len] = '\0';
1552         } else {
1553                 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1554                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1555         }
1556
1557         SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1558         *value = strdup(&tzpath[20]);
1559         return SYSTEM_SETTINGS_ERROR_NONE;
1560 }
1561
1562 /*  LCOV_EXCL_START */
1563 int system_setting_set_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1564 {
1565         SETTING_TRACE_BEGIN;
1566         char *timezone_value = NULL;
1567         timezone_value = (char *)value;
1568
1569         char tz_path[1024];
1570         snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value);
1571
1572         int is_load = _is_file_accessible(tz_path);
1573         if (is_load == 0) {
1574                 alarmmgr_set_timezone(tz_path);
1575
1576                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_TIMEZONE_ID, timezone_value)) {
1577                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1578                 }
1579                 return SYSTEM_SETTINGS_ERROR_NONE;
1580         }
1581         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1582 }
1583 /*  LCOV_EXCL_STOP */
1584
1585
1586
1587 /*  LCOV_EXCL_START */
1588 int system_setting_set_changed_callback_locale_timezone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1589 {
1590         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, SYSTEM_SETTINGS_KEY_LOCALE_TIMEZONE, 4, user_data);
1591 }
1592 /*  LCOV_EXCL_STOP */
1593
1594 /*  LCOV_EXCL_START */
1595 int system_setting_unset_changed_callback_locale_timezone(system_settings_key_e key)
1596 {
1597         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TIMEZONE_ID, 4);
1598 }
1599 /*  LCOV_EXCL_STOP */
1600
1601 /*  LCOV_EXCL_START */
1602 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1603 {
1604         SETTING_TRACE_BEGIN;
1605         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1606 }
1607 /*  LCOV_EXCL_STOP */
1608
1609 /*  LCOV_EXCL_START */
1610 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1611 {
1612         SETTING_TRACE_BEGIN;
1613         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1614 }
1615 /*  LCOV_EXCL_STOP */
1616
1617
1618 /*  LCOV_EXCL_START */
1619 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1620 {
1621         SETTING_TRACE_BEGIN;
1622         time_t cur_tick;
1623         int ** val = (int**)value;
1624         cur_tick = time(NULL);
1625         **val = cur_tick;
1626         /* struct tm * localtime = time (cur_tick); */
1627         /* printf("%s\n", ctime(&cur_tick); */
1628         return SYSTEM_SETTINGS_ERROR_NONE;
1629
1630 }
1631 /*  LCOV_EXCL_STOP */
1632
1633 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1634 {
1635         SETTING_TRACE_BEGIN;
1636         return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1637 }
1638
1639 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1640 {
1641         SETTING_TRACE_BEGIN;
1642         return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1643 }
1644
1645
1646
1647 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1648 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1649 {
1650         SETTING_TRACE_BEGIN;
1651         bool vconf_value;
1652
1653         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1654                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1655         }
1656         *value = (void *)vconf_value;
1657
1658         return SYSTEM_SETTINGS_ERROR_NONE;
1659 }
1660
1661 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1662 {
1663         SETTING_TRACE_BEGIN;
1664         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1665 }
1666
1667 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1668 {
1669         SETTING_TRACE_BEGIN;
1670         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1671 }
1672
1673 /**
1674  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1675  *
1676  * a == false, b == false --> silent mode
1677  * a == true, b == false --> sound mode
1678  * a == false, b == true --> vibration mode
1679  */
1680 /*  LCOV_EXCL_START */
1681 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1682 {
1683         SETTING_TRACE_BEGIN;
1684         bool sound_cond;
1685         bool vib_cond;
1686
1687         bool vconf_value;
1688         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1689                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1690         }
1691
1692         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1693                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1694         }
1695
1696         if (sound_cond == false && vib_cond == false) {
1697                 vconf_value = true;
1698                 *value = (void *)vconf_value;
1699         } else {
1700                 vconf_value = false;
1701                 *value = (void *)vconf_value;
1702         }
1703         return SYSTEM_SETTINGS_ERROR_NONE;
1704 }
1705 /*  LCOV_EXCL_STOP */
1706
1707 /**
1708  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1709  *
1710  * a == false, b == false --> silent mode
1711  * a == true, b == false --> sound mode
1712  */
1713 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1714 {
1715         SETTING_TRACE_BEGIN;
1716         bool *vconf_value;
1717
1718         vconf_value = (bool *)value;
1719
1720         bool vconf_sound = false;
1721         bool vconf_vib = false;
1722
1723         if (*vconf_value) {
1724                 vconf_sound = false;
1725                 vconf_vib = false;
1726         } else {
1727                 vconf_sound = true;
1728                 vconf_vib = false;
1729         }
1730
1731         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1732                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1733         }
1734         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1735                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1736         }
1737
1738         return SYSTEM_SETTINGS_ERROR_NONE;
1739 }
1740
1741
1742
1743 /* TODO */
1744 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1745 {
1746         SETTING_TRACE_BEGIN;
1747         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1748 }
1749
1750 /* TODO */
1751 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1752 {
1753         SETTING_TRACE_BEGIN;
1754         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1755 }
1756
1757 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1758 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1759 {
1760         SETTING_TRACE_BEGIN;
1761         bool vconf_value;
1762
1763         int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1764         if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1765                 return ret;
1766         }
1767         *value = (void *)vconf_value;
1768         return ret;
1769 }
1770
1771 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1772 {
1773         SETTING_TRACE_BEGIN;
1774         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1775 }
1776
1777 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1778 {
1779         SETTING_TRACE_BEGIN;
1780         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1781 }
1782
1783 #if 0
1784 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1785 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1786 {
1787         bool vconf_value;
1788
1789         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1790                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1791         }
1792         *value = (void *)vconf_value;
1793
1794         return SYSTEM_SETTINGS_ERROR_NONE;
1795 }
1796 #endif
1797
1798 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1799 {
1800         SETTING_TRACE_BEGIN;
1801         bool vconf_value;
1802
1803         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1804                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1805         }
1806         *value = (void *)vconf_value;
1807
1808         return SYSTEM_SETTINGS_ERROR_NONE;
1809 }
1810
1811 /*  LCOV_EXCL_START */
1812 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1813 {
1814         SETTING_TRACE_BEGIN;
1815         bool *vconf_value;
1816         vconf_value = (bool *)value;
1817         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1818                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1819         }
1820
1821         return SYSTEM_SETTINGS_ERROR_NONE;
1822 }
1823 /*  LCOV_EXCL_STOP */
1824
1825 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1826 {
1827         SETTING_TRACE_BEGIN;
1828         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1829 }
1830
1831 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1832 {
1833         SETTING_TRACE_BEGIN;
1834         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1835 }
1836
1837 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1838 {
1839         SETTING_TRACE_BEGIN;
1840         int vconf_value;
1841         int ** val = (int**)value;
1842
1843         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1844                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1845         }
1846         **val = vconf_value;
1847
1848         return SYSTEM_SETTINGS_ERROR_NONE;
1849 }
1850
1851
1852 /*  LCOV_EXCL_START */
1853 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1854 {
1855         SETTING_TRACE_BEGIN;
1856         int *vconf_value;
1857         vconf_value = *(int **)value;
1858
1859         if (!(*vconf_value > 0 && *vconf_value <= 600)) {
1860                 SETTING_TRACE(" ERR Betweeny here  0 ~ 600");
1861                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1862         }
1863
1864         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1865                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1866         }
1867         SETTING_TRACE_END;
1868         return SYSTEM_SETTINGS_ERROR_NONE;
1869 }
1870 /*  LCOV_EXCL_STOP */
1871
1872 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1873 {
1874         SETTING_TRACE_BEGIN;
1875         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_SCREEN_BACKLIGHT_TIME, 2, user_data);
1876 }
1877
1878 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1879 {
1880         SETTING_TRACE_BEGIN;
1881         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1882 }
1883
1884 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1885 {
1886         SETTING_TRACE_BEGIN;
1887         char *vconf_value = NULL;
1888         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1889                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1890         }
1891
1892         *value = vconf_value;
1893         return SYSTEM_SETTINGS_ERROR_NONE;
1894 }
1895
1896 /*  LCOV_EXCL_START */
1897 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1898 {
1899         SETTING_TRACE_BEGIN;
1900         char *vconf_value = NULL;
1901         vconf_value = (char *)value;
1902
1903         int is_load = _is_file_accessible(vconf_value);
1904         if (is_load == 0) {
1905                 //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) TRY", vconf_value);
1906                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1907                         //SETTING_TRACE(" system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1908                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1909                 }
1910         } else {
1911                 //SETTING_TRACE(" is_file_accessibile FAILED - system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, %s) FAIL", vconf_value);
1912                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1913         }
1914
1915         return SYSTEM_SETTINGS_ERROR_NONE;
1916 }
1917 /*  LCOV_EXCL_STOP */
1918
1919 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1920 {
1921         SETTING_TRACE_BEGIN;
1922         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION, 0, user_data);
1923 }
1924
1925 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1926 {
1927         SETTING_TRACE_BEGIN;
1928         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1929 }
1930
1931 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1932 {
1933         SETTING_TRACE_BEGIN;
1934         int ** val = (int**)value;
1935         int vconf_value;
1936
1937         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1938                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1939         }
1940         **val = vconf_value;
1941
1942         return SYSTEM_SETTINGS_ERROR_NONE;
1943 }
1944
1945 /*  LCOV_EXCL_START */
1946 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1947 {
1948         SETTING_TRACE_BEGIN;
1949         int *vconf_value;
1950         vconf_value = *(int **)value;
1951
1952         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1953                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1954         }
1955         SETTING_TRACE_END;
1956         return SYSTEM_SETTINGS_ERROR_NONE;
1957 }
1958 /*  LCOV_EXCL_STOP */
1959
1960 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1961 {
1962         SETTING_TRACE_BEGIN;
1963         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, SYSTEM_SETTINGS_KEY_SOUND_NOTIFICATION_REPETITION_PERIOD, 1, user_data);
1964 }
1965
1966 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1967 {
1968         SETTING_TRACE_BEGIN;
1969         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1970 }
1971
1972 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1973 {
1974         SETTING_TRACE_BEGIN;
1975         char *vconf_value = NULL;
1976         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1977                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1978         }
1979
1980         *value = vconf_value;
1981         return SYSTEM_SETTINGS_ERROR_NONE;
1982 }
1983
1984 /*  LCOV_EXCL_START */
1985 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1986 {
1987         SETTING_TRACE_BEGIN;
1988         char *vconf_value = NULL;
1989         vconf_value = (char *)value;
1990
1991         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1992                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1993         }
1994
1995         return SYSTEM_SETTINGS_ERROR_NONE;
1996 }
1997 /*  LCOV_EXCL_STOP */
1998
1999 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2000 {
2001         SETTING_TRACE_BEGIN;
2002         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
2003 }
2004
2005 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
2006 {
2007         SETTING_TRACE_BEGIN;
2008         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
2009 }
2010
2011 /*---------------------------------------------- */
2012 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2013 {
2014         SETTING_TRACE_BEGIN;
2015         bool vconf_value;
2016         if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
2017                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2018         }
2019         *value = (void *)vconf_value;
2020
2021         return SYSTEM_SETTINGS_ERROR_NONE;
2022 }
2023
2024 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2025 {
2026         SETTING_TRACE_BEGIN;
2027         return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
2028 }
2029
2030 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
2031 {
2032         SETTING_TRACE_BEGIN;
2033         return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
2034 }
2035
2036 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2037 {
2038         SETTING_TRACE_BEGIN;
2039         int vconf_value;
2040         if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
2041                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2042         }
2043         bool bret ;
2044         bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
2045
2046         *value = (void *)bret;
2047         return SYSTEM_SETTINGS_ERROR_NONE;
2048 }
2049
2050 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2051 {
2052         SETTING_TRACE_BEGIN;
2053         return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
2054 }
2055
2056 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
2057 {
2058         SETTING_TRACE_BEGIN;
2059         return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
2060 }
2061
2062 /*  LCOV_EXCL_START */
2063 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2064 {
2065         int vconf_value;
2066         int ** val = (int**)value;
2067
2068         if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
2069                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2070         }
2071         **val = vconf_value;
2072
2073         return SYSTEM_SETTINGS_ERROR_NONE;
2074 }
2075 /*  LCOV_EXCL_STOP */
2076
2077 /*  LCOV_EXCL_START */
2078 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
2079 {
2080         SETTING_TRACE_BEGIN;
2081         int *vconf_value;
2082         vconf_value = *(int **)value;
2083
2084         if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
2085                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2086         }
2087         SETTING_TRACE_END;
2088         return SYSTEM_SETTINGS_ERROR_NONE;
2089 }
2090 /*  LCOV_EXCL_STOP */
2091
2092 /*  LCOV_EXCL_START */
2093 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2094 {
2095         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
2096 }
2097 /*  LCOV_EXCL_STOP */
2098
2099 /*  LCOV_EXCL_START */
2100 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
2101 {
2102         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
2103 }
2104 /*  LCOV_EXCL_STOP */
2105
2106 //----------------------------------------------------------------------------------------------------------------------------
2107
2108 #define DEFAULT_ADS_ID "00000000-0000-0000-0000-000000000000"
2109
2110 int system_setting_get_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2111 {
2112         SETTING_TRACE_BEGIN;
2113         int optout_value = 0;
2114         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) {
2115                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2116         }
2117
2118         if (optout_value == 1) {
2119                 *value = strdup(DEFAULT_ADS_ID);
2120                 return SYSTEM_SETTINGS_ERROR_NONE;
2121         }
2122
2123         char *vconf_value = NULL;
2124         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_AD_ID, &vconf_value)) {
2125                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2126         }
2127
2128         *value = vconf_value;
2129         return SYSTEM_SETTINGS_ERROR_NONE;
2130 }
2131
2132
2133 #if 0
2134 void make_ad_id(void)
2135 {
2136         uuid_t uuid_value;
2137         char uuid_unparsed[50] = {0};
2138         uuid_generate(uuid_value);
2139         uuid_unparse(uuid_value, uuid_unparsed);
2140         system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value
2141 }
2142 #endif
2143 /*  LCOV_EXCL_START */
2144 int system_setting_set_ads_id(system_settings_key_e key, system_setting_data_type_e data_type, 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 /*  LCOV_EXCL_STOP */
2158
2159 int system_setting_set_changed_callback_ads_id(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2160 {
2161         SETTING_TRACE_BEGIN;
2162         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AD_ID, SYSTEM_SETTINGS_KEY_ADS_ID, 0, user_data);
2163 }
2164
2165 int system_setting_unset_changed_callback_ads_id(system_settings_key_e key)
2166 {
2167         SETTING_TRACE_BEGIN;
2168         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AD_ID, 0);
2169 }
2170 //
2171 //----------------------------------------------------------------------------------------------------------------------------
2172
2173 /*  LCOV_EXCL_START */
2174 int system_setting_get_uds_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
2175 {
2176         int ** p_value = (int**)value;
2177         int vconf_value;
2178         char *vconf_string_value = NULL;
2179
2180         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_UDSM, &vconf_value)) {
2181                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2182         }
2183
2184         SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value);
2185
2186         if (vconf_value == SYSTEM_SETTINGS_UDS_ON) {
2187                 if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value))
2188                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
2189
2190                 if (vconf_string_value) {
2191                         if (!strcmp(vconf_string_value, "NONE")) {
2192                                 vconf_value = SYSTEM_SETTINGS_UDS_ON;
2193                         } else {
2194                                 char *app_id = NULL;
2195                                 char *package_id = NULL;
2196                                 pid_t pid = getpid();
2197                                 app_manager_get_app_id(pid, &app_id);
2198
2199                                 if (app_id) {
2200                                         package_manager_get_package_id_by_app_id(app_id, &package_id);
2201                                         SETTING_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value);
2202                                 }
2203
2204                                 if (package_id && strstr(vconf_string_value, package_id)) {
2205                                         vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED;
2206                                         SETTING_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id);
2207                                 } else {
2208                                         vconf_value = SYSTEM_SETTINGS_UDS_ON;
2209                                 }
2210
2211                         }
2212                         if (vconf_string_value)
2213                                 free(vconf_string_value);
2214                 }
2215         }
2216
2217         **p_value = vconf_value;
2218
2219
2220         return SYSTEM_SETTINGS_ERROR_NONE;
2221 }
2222 /*  LCOV_EXCL_STOP */
2223
2224 /*  LCOV_EXCL_START */
2225 int system_setting_set_changed_callback_uds_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2226 {
2227         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE, 4, user_data);
2228 }
2229 /*  LCOV_EXCL_STOP */
2230
2231 /*  LCOV_EXCL_START */
2232 int system_setting_unset_changed_callback_uds_state(system_settings_key_e key)
2233 {
2234         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM, 4);
2235 }
2236 /*  LCOV_EXCL_STOP */
2237
2238 /*  LCOV_EXCL_START */
2239 int system_setting_set_changed_callback_uds_pkg_list(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
2240 {
2241         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST, 4, user_data);
2242 }
2243 /*  LCOV_EXCL_STOP */
2244
2245 /*  LCOV_EXCL_START */
2246 int system_setting_unset_changed_callback_uds_pkg_list(system_settings_key_e key)
2247 {
2248         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, 4);
2249 }
2250 /*  LCOV_EXCL_STOP */
2251