Fixed errors when dynamic so file was created.
[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
29 #include <regex.h>
30
31 #include <dlog.h>
32 #include <vconf.h>
33
34 #include <glib.h>
35 #include <libxml/xmlmemory.h>
36 #include <libxml/parser.h>
37
38 #include <fontconfig/fontconfig.h>
39
40 #include <pkgmgr-info.h>
41
42 #include <system_settings.h>
43 #include <system_settings_private.h>
44
45 #include <tzplatform_config.h>
46
47 #ifdef USE_EFL_ASSIST
48 #include <efl_assist.h>
49 #endif
50
51 #define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
52 #define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf"
53
54 #define SETTING_TIME_ZONEINFO_PATH              "/usr/share/zoneinfo/"
55 #define SETTING_TIME_SHARE_LOCAL_PATH   "/usr/share/locale"
56 #define SETTING_TZONE_SYMLINK_PATH              "/etc/localtime"
57
58
59 int _is_file_accessible(const char *path);
60
61 bool dl_is_supported_image_type_load(char *path);
62 bool dl_font_config_set(char *font_name);
63 char *dl_get_font_info(char *str);
64 int dl_is_available_font(char *str);
65 void dl_font_size_set();
66 void dl_font_config_set_notification();
67
68
69 /**
70  * VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR has a path of the ringtone file which user choose
71  * @return the ringtone file path specified by user in normal case
72  *                 if it's not accessable, return the default ringtone path
73  */
74 int system_setting_get_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
75 {
76         SETTING_TRACE_BEGIN;
77         char *vconf_value;
78         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, &vconf_value)) {
79                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
80         }
81
82         /* check to see if it's accessable -> OK */
83         /* no --> default ringtone path VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR */
84         int is_load = _is_file_accessible(vconf_value);
85         if (is_load == 0) {
86                 *value = vconf_value;
87         } else { /* not zero on errro */
88                 *value = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_DEFAULT_PATH_STR);
89         }
90
91         /**value = vconf_value; */
92         return SYSTEM_SETTINGS_ERROR_NONE;
93 }
94
95
96 int system_setting_get_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
97 {
98         SETTING_TRACE_BEGIN;
99         char *vconf_value;
100         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
101                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
102         }
103
104         /* check to see if it's accessable -> OK */
105         /* no --> default ringtone path VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR */
106         int is_load = _is_file_accessible(vconf_value);
107         if (is_load == 0) {
108                 *value = vconf_value;
109         } else { /* not zero on errro */
110                 *value = vconf_get_str(VCONFKEY_SETAPPL_NOTI_RINGTONE_DEFAULT_PATH_STR);
111         }
112
113         return SYSTEM_SETTINGS_ERROR_NONE;
114 }
115
116
117 int system_setting_get_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
118 {
119         SETTING_TRACE_BEGIN;
120         char *vconf_value;
121         if (system_setting_vconf_get_value_string(VCONFKEY_BGSET, &vconf_value)) {
122                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
123         }
124         *value = vconf_value;
125         return SYSTEM_SETTINGS_ERROR_NONE;
126 }
127
128
129 int system_setting_get_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
130 {
131         SETTING_TRACE_BEGIN;
132         char *vconf_value;
133
134         if (system_setting_vconf_get_value_string(VCONFKEY_IDLE_LOCK_BGSET, &vconf_value)) {
135                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
136         }
137         *value = vconf_value;
138
139         return SYSTEM_SETTINGS_ERROR_NONE;
140 }
141
142
143 /* [int] vconf GET */
144 int system_setting_get_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
145 {
146         SETTING_TRACE_BEGIN;
147         int vconf_value;
148
149         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &vconf_value)) {
150                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
151         }
152         *value = (void *)vconf_value;
153
154         return SYSTEM_SETTINGS_ERROR_NONE;
155 }
156
157
158 int system_setting_get_default_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
159 {
160         SETTING_TRACE_BEGIN;
161         char *font_name = dl_get_font_info("default");
162         if (font_name) {
163                 *value = (void *)font_name;
164                 return SYSTEM_SETTINGS_ERROR_NONE;
165         } else {
166                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
167         }
168 }
169
170 /* [int] vconf GET */
171 int system_setting_get_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
172 {
173         SETTING_TRACE_BEGIN;
174         char *font_name = dl_get_font_info("cur");
175         *value = (void *)font_name;
176
177         return SYSTEM_SETTINGS_ERROR_NONE;
178 }
179
180
181 int system_setting_get_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
182 {
183         SETTING_TRACE_BEGIN;
184         bool vconf_value;
185
186         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, &vconf_value)) {
187                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
188         }
189         *value = (void *)vconf_value;
190
191         return SYSTEM_SETTINGS_ERROR_NONE;
192 }
193
194 int system_setting_get_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
195 {
196         SETTING_TRACE_BEGIN;
197         bool vconf_value;
198
199         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, &vconf_value)) {
200                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
201         }
202         *value = (void *)vconf_value;
203
204         return SYSTEM_SETTINGS_ERROR_NONE;
205 }
206
207 int system_setting_get_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
208 {
209         SETTING_TRACE_BEGIN;
210         bool vconf_value;
211
212         if (system_setting_vconf_get_value_bool(VCONFKEY_3G_ENABLE, &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
221
222 /**
223  * get current lock scren app package name (string)
224  *
225  * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password'
226  */
227 int system_setting_get_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
228 {
229         SETTING_TRACE_BEGIN;
230         char *pkg_name = NULL;
231         int locktype = -1;
232         system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
233
234         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, &pkg_name)) {
235                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
236         }
237
238         if (pkg_name && strcmp(pkg_name, "com.samsung.lockscreen") == 0 && locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
239                 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
240         }
241
242         *value = pkg_name;
243         return SYSTEM_SETTINGS_ERROR_NONE;
244 }
245
246
247 /*////////////////////////////////////////////////////////////////////////////////////////////////// */
248
249 int _is_file_accessible(const char *path)
250 {
251         SETTING_TRACE_BEGIN;
252         int ret = access(path , R_OK);
253         if (ret == 0) {
254                 SETTING_TRACE("found the file  %s", path);
255                 return 0;
256         } else {
257                 /* error code : 13 */
258                 SETTING_TRACE("found the file  %s --- error code : %d ", path, errno);
259                 return -errno;
260         }
261 }
262
263 int system_setting_set_incoming_call_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
264 {
265         SETTING_TRACE_BEGIN;
266         char *vconf_value;
267         vconf_value = (char *)value;
268
269         int ret = _is_file_accessible(vconf_value);
270         if (ret == 0) {
271                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, vconf_value)) {
272                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
273                 }
274         } else {
275                 /* @todo add a common ret_handler */
276                 return ret;
277         }
278
279         return SYSTEM_SETTINGS_ERROR_NONE;
280 }
281
282
283 int system_setting_set_email_alert_ringtone(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
284 {
285         SETTING_TRACE_BEGIN;
286         char *vconf_value;
287         vconf_value = (char *)value;
288
289         int ret = _is_file_accessible(vconf_value);
290         if (ret == 0) {
291                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
292                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
293                 }
294         } else {
295                 /*return SYSTEM_SETTINGS_ERROR_IO_ERROR;*/
296                 /* @todo add a common ret_handler */
297                 return ret;
298         }
299
300         return SYSTEM_SETTINGS_ERROR_NONE;
301 }
302
303 bool dl_is_supported_image_type_load(char *path)
304 {
305         void *handle = NULL;
306         char *error;
307         bool ret = false;
308         bool (*image_type_check)(char *path);
309
310         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
311         if (!handle) {
312                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
313                 return false;
314         }
315
316         image_type_check = dlsym(handle, "__is_supported_image_type_load");
317         if ((error = dlerror()) != NULL) {
318                 SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so.0.1.0");
319                 if (handle)
320                         dlclose(handle);
321                 return false;
322         }
323         ret = image_type_check(path);
324         if (handle)
325                 dlclose(handle);
326         return ret;
327 }
328
329 int dl_is_available_font(char *str)
330 {
331         void *handle = NULL;
332         char *error;
333         int ret = false;
334         int (*check_available_font)(char *font_name);
335
336         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
337         if (!handle) {
338                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
339                 return false;
340         }
341
342         check_available_font = dlsym(handle, "__is_available_font");
343         if ((error = dlerror()) != NULL) {
344                 SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so.0.1.0");
345                 if (handle)
346                         dlclose(handle);
347                 return false;
348         }
349         ret = check_available_font(str);
350         if (handle)
351                 dlclose(handle);
352         return ret;
353 }
354
355 void dl_font_size_set()
356 {
357         void *handle = NULL;
358         char *error;
359         void (*set_font_size)();
360
361         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
362         if (!handle) {
363                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
364                 return;
365         }
366
367         set_font_size = dlsym(handle, "__font_size_set");
368         if ((error = dlerror()) != NULL) {
369                 SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so.0.1.0");
370                 if (handle)
371                         dlclose(handle);
372                 return;
373         }
374         set_font_size();
375         if (handle)
376                 dlclose(handle);
377         return;
378 }
379
380 void dl_font_config_set_notification()
381 {
382         void *handle = NULL;
383         char *error;
384         void (*set_font_nodification)();
385
386         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
387         if (!handle) {
388                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
389                 return;
390         }
391
392         set_font_nodification = dlsym(handle, "font_config_set_notification");
393         if ((error = dlerror()) != NULL) {
394                 SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so.0.1.0");
395                 if (handle)
396                         dlclose(handle);
397                 return;
398         }
399         set_font_nodification();
400         if (handle)
401                 dlclose(handle);
402         return;
403 }
404
405 bool dl_font_config_set(char *font_name)
406 {
407         void *handle = NULL;
408         char *error;
409         bool ret = false;
410         bool (*check_font_type)(char *font_name);
411
412         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
413         if (!handle) {
414                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
415                 return false;
416         }
417
418         check_font_type = dlsym(handle, "font_config_set");
419         if ((error = dlerror()) != NULL) {
420                 SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so.0.1.0");
421                 if (handle)
422                         dlclose(handle);
423                 return false;
424         }
425         ret = check_font_type(font_name);
426         if (handle)
427                 dlclose(handle);
428         return ret;
429 }
430
431 char *dl_get_font_info(char *str)
432 {
433         void *handle = NULL;
434         char *error;
435         char *ret = NULL;
436         char *(*get_font_info)();
437
438         handle = dlopen("/usr/lib/libsystem-settings-util.so.0.1.0",  RTLD_LAZY);
439         if (!handle) {
440                 SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so.0.1.0");
441                 return false;
442         }
443
444         if (strcmp(str, "cur") == 0)
445                 get_font_info = dlsym(handle, "_get_cur_font");
446         else
447                 get_font_info = dlsym(handle, "_get_default_font");
448
449         if ((error = dlerror()) != NULL) {
450                 SETTING_TRACE("ERROR!! canNOT find %s function at libsystem-settings-util.so.0.1.0", str);
451                 if (handle)
452                         dlclose(handle);
453                 return false;
454         }
455         ret = get_font_info();
456         if (handle)
457                 dlclose(handle);
458         return ret;
459 }
460
461 #define PATH_EXT_CHECK_REG ".(jpe?g|jpg|png|gif)$"
462 bool __is_supported_image_type_by_ext(char *file_path)
463 {
464         SETTING_TRACE_BEGIN;
465         regex_t fsm;
466         regmatch_t str[2048 + 1];
467
468         if (!file_path) return false;
469
470         int ret = false;
471         if ((ret = regcomp(&fsm, PATH_EXT_CHECK_REG, REG_ICASE | REG_EXTENDED))) {
472                 SETTING_TRACE("regular expresstion fail");
473                 return 1;
474         }
475
476         /* code */
477         if (regexec(&fsm, file_path, strlen(file_path) + 1, str, 0) == REG_NOMATCH) {
478                 /*SETTING_TRACE("FAILED - %s", file_path[i]); */
479                 ret = 0;
480         } else {
481                 /*SETTING_TRACE("MATCHED - %s", file_path[i]); */
482                 ret = 1;
483         }
484         return ret;
485 }
486 #ifdef TIZEN_WEARABLE
487 static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num)
488 {
489         SETTING_TRACE_BEGIN;
490         char buffer[256];
491         const char *find_str = "extended_wallpaper_";
492         char *ch = NULL;
493
494         if (!(ch = strstr(file_path, find_str))) {
495                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
496         }
497         strncpy(buffer, file_path, ch - file_path);
498         buffer[ch - file_path] = 0;
499         sprintf(buffer + (ch - file_path), "%s%s", "", ch + strlen(find_str));
500
501         if (!isdigit(buffer[0])) {
502                 SETTING_TRACE("%s is not number", buffer);
503                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
504         }
505
506         *num = atoi(buffer);
507
508         return SYSTEM_SETTINGS_ERROR_NONE;
509 }
510
511 static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path)
512 {
513         SETTING_TRACE_BEGIN;
514         if (!source_file_path || !dest_file_path) {
515                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
516         }
517
518         char buf[1024];
519
520         int fd;
521         fd = open(source_file_path, O_RDONLY);
522         if (fd < 0) {
523                 SETTING_TRACE("file open failed: %s", source_file_path);
524                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
525         }
526
527         int fd2;
528         fd2 = open(dest_file_path, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
529         if (fd2 < 0) {
530                 SETTING_TRACE("file creation failed: %s", dest_file_path);
531                 close(fd);
532                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
533         }
534
535         while (read(fd, buf, sizeof(buf) - 1) > 0) {
536                 write(fd2, buf, sizeof(buf) - 1);
537         }
538
539         close(fd2);
540         close(fd);
541
542         if (chmod(dest_file_path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
543                 SETTING_TRACE("chmod failed: %s", dest_file_path);
544         }
545
546         return SYSTEM_SETTINGS_ERROR_NONE;
547 }
548
549 static int system_setting_remove_oldest_extended_wallpaper()
550 {
551         SETTING_TRACE_BEGIN;
552         DIR *dp;
553         struct dirent *dirp;
554         char *min_image_name = NULL;
555         unsigned int min_image_num = 0;
556         unsigned int temp_image_num = 0;
557         int image_count = 0;
558
559         if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
560                 SETTING_TRACE("opendir error");
561                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
562         }
563
564         while ((dirp = readdir(dp))) {
565                 if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
566                         continue;
567
568                 if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
569                     != SYSTEM_SETTINGS_ERROR_NONE) {
570                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
571                 }
572
573                 if ((image_count == 0) || (min_image_num > temp_image_num)) {
574                         min_image_num = temp_image_num;
575                         min_image_name = dirp->d_name;
576                 }
577
578                 image_count++;
579         }
580
581         char buf[512];
582         if (min_image_name) {
583                 snprintf(buf, sizeof(buf) - 1, _TZ_SYS_DATA"/setting/wallpaper/%s", min_image_name);
584                 if (remove(buf) < 0) {  /* remove oldest image */
585                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
586                 }
587         }
588
589         return SYSTEM_SETTINGS_ERROR_NONE;
590 }
591
592 static int system_setting_check_extended_wallpaper(const char *file_path)
593 {
594         char buffer[512];
595         SETTING_TRACE_BEGIN;
596         if (!file_path || !strlen(file_path))
597                 return 0;
598         snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT));
599         return (strstr(file_path, buffer) != NULL);
600 }
601
602 #define WALLPAPER_MAX_COUNT             10
603 #endif
604
605 int system_setting_set_wallpaper_home_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
606 {
607         SETTING_TRACE_BEGIN;
608         char *vconf_value;
609         vconf_value = (char *)value;
610
611         bool isok  = dl_is_supported_image_type_load(vconf_value);
612         if (!isok) {
613                 /* not supported */
614                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
615                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
616         } else {
617                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
618         }
619
620         /* error handling here */
621         if (_is_file_accessible(vconf_value) != 0)
622                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
623 #ifdef TIZEN_MOBILE
624         if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
625                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
626         }
627 #endif
628
629 #ifdef TIZEN_WEARABLE
630         if (system_setting_check_extended_wallpaper(vconf_value)) {     /* New extended wallpaper */
631                 DIR *dp = NULL;
632                 struct dirent *dirp;
633                 unsigned int max_image_num = 0;
634                 unsigned int temp_image_num = 0;
635                 int image_count = 0;
636
637                 if ((dp = opendir(_TZ_SYS_DATA"/setting/wallpaper")) == NULL) {
638                         SETTING_TRACE("Setting - dir open error!");
639                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
640                 }
641
642                 /* Check a max number of wallpapers */
643                 while ((dirp = readdir(dp))) {
644                         if (!strcmp(dirp->d_name, ".") || !strcmp(dirp->d_name, ".."))
645                                 continue;
646
647                         if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num)
648                             != SYSTEM_SETTINGS_ERROR_NONE) {
649                                 if (dp)
650                                         closedir(dp);
651                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
652                         }
653
654                         if ((image_count == 0) || (max_image_num < temp_image_num)) {
655                                 max_image_num = temp_image_num;
656                         }
657
658                         image_count++;
659                 }
660                 if (dp)
661                         closedir(dp);
662
663                 /* Numbering rule: Gear is odd number */
664                 max_image_num = (max_image_num % 2 == 0) ? max_image_num + 1
665                                                         : max_image_num + 2;
666
667                 char file_name_buffer[512];
668                 snprintf(file_name_buffer, sizeof(file_name_buffer) - 1,
669                                         _TZ_SYS_DATA"/setting/wallpaper/extended_wallpaper_%d.jpg", max_image_num);
670
671                 /* Copy image to _TZ_SYS_DATA/setting/wallpaper/ */
672                 if (system_setting_copy_extended_wallpaper(file_name_buffer, vconf_value)
673                     != SYSTEM_SETTINGS_ERROR_NONE) {
674                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
675                 }
676
677                 /* remove oldest wallpaper */
678                 if (image_count >= WALLPAPER_MAX_COUNT) {
679                         if (system_setting_remove_oldest_extended_wallpaper()
680                             != SYSTEM_SETTINGS_ERROR_NONE) {
681                                 remove(file_name_buffer);
682                                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
683                         }
684                 }
685
686                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, file_name_buffer)) {
687                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
688                 }
689
690                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT,
691                                                                                                         VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) {
692                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
693                 }
694         } else {
695                 if (system_setting_vconf_set_value_string(VCONFKEY_BGSET, vconf_value)) {
696                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
697                 }
698         }
699 #endif
700
701         return SYSTEM_SETTINGS_ERROR_NONE;
702 }
703
704 int system_setting_set_wallpaper_lock_screen(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
705 {
706         SETTING_TRACE_BEGIN;
707         char *vconf_value;
708         vconf_value = (char *)value;
709
710         bool isok  = dl_is_supported_image_type_load(vconf_value);
711         if (!isok) {
712                 /* not supported */
713                 SETTING_TRACE("path : %s is not supported file format", vconf_value);
714                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
715         } else {
716                 SETTING_TRACE("path : %s is SUPPORT file format", vconf_value);
717         }
718
719         /* error handling here */
720         if (_is_file_accessible(vconf_value) != 0)
721                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
722
723         if (system_setting_vconf_set_value_string(VCONFKEY_IDLE_LOCK_BGSET, vconf_value)) {
724                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
725         }
726
727         return SYSTEM_SETTINGS_ERROR_NONE;
728 }
729
730 int system_setting_set_font_size(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
731 {
732         SETTING_TRACE_BEGIN;
733         int *vconf_value;
734         vconf_value = (int *)value;
735
736         if (*vconf_value < 0 || *vconf_value > SYSTEM_SETTINGS_FONT_SIZE_GIANT) {
737                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
738         }
739
740         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, *vconf_value)) {
741                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
742         }
743         dl_font_size_set();
744         SETTING_TRACE_END;
745         return SYSTEM_SETTINGS_ERROR_NONE;
746 }
747 /**
748  * [internal API]
749  */
750 void *font_conf_doc_parse(char *doc_name, char *font_name)
751 {
752         SETTING_TRACE_BEGIN;
753         xmlDocPtr doc = NULL;
754         xmlNodePtr cur = NULL;
755         xmlNodePtr cur2 = NULL;
756         xmlNodePtr cur3 = NULL;
757         xmlChar *key = NULL;
758
759         doc = xmlParseFile(doc_name);
760
761         cur = xmlDocGetRootElement(doc);
762
763         if (cur == NULL) {
764                 xmlFreeDoc(doc);
765                 doc = NULL;
766                 return NULL;
767         }
768
769         if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) {
770                 xmlFreeDoc(doc);
771                 doc = NULL;
772                 return NULL;
773         }
774
775         cur = cur->xmlChildrenNode;
776
777         bool is_changed = false;
778         while (cur != NULL) {
779                 if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) {
780                         cur2 = cur->xmlChildrenNode;
781                         while (cur2 != NULL) {
782                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) {
783                                         xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name");
784                                         /* if name is not 'family', break */
785                                         if (xmlStrcmp(name, (const xmlChar *)"family")) {
786                                                 xmlFree(name);
787                                                 name = NULL;
788                                                 break;
789                                         }
790                                         xmlFree(name);
791                                         name = NULL;
792
793                                         cur3 = cur2->xmlChildrenNode;
794                                         while (cur3 != NULL) {
795                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) {
796                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
797                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
798                                                         xmlFree(key);
799                                                         key = NULL;
800                                                         is_changed = true;
801                                                 }
802                                                 cur3 = cur3->next;
803                                         }
804                                 }
805                                 cur2 = cur2->next;
806                         }
807                 } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) {
808                         cur2 = cur->xmlChildrenNode;
809                         while (cur2 != NULL) {
810                                 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) {
811                                         xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name);
812                                         key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1);
813                                         xmlFree(key);
814                                         key = NULL;
815                                         is_changed = true;
816                                 } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) {
817                                         cur3 = cur2->xmlChildrenNode;
818                                         while (cur3 != NULL) {
819                                                 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) {
820                                                         xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name);
821                                                         key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
822                                                         xmlFree(key);
823                                                         key = NULL;
824                                                         is_changed = true;
825                                                         cur3 = cur3->next;
826                                                         return doc;
827                                                 }
828                                                 cur3 = cur3->next;
829                                         }
830                                 }
831                                 cur2 = cur2->next;
832                         }
833                 }
834                 cur = cur->next;
835         }
836
837         if (is_changed) {
838                 return doc;
839         } else {
840                 xmlFreeDoc(doc);
841                 doc = NULL;
842                 return NULL;
843         }
844 }
845
846 int system_setting_set_font_type(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
847 {
848         SETTING_TRACE_BEGIN;
849         char *font_name = NULL;
850         font_name = (char *)value;
851
852         /* get current font list */
853         int is_found = dl_is_available_font(font_name);
854
855         if (is_found) {
856                 SETTING_TRACE("found font : %s ", font_name);
857         } else {
858                 SETTING_TRACE(" NOT found font : %s ", font_name);
859                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
860         }
861
862         bool bsave = dl_font_config_set(font_name);
863
864         if (!bsave) {
865                 SETTING_TRACE(" font type save error by font_config_set() ");
866                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
867         } else {
868                 SETTING_TRACE(" save OK - font_config_set() ");
869         }
870
871         xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name);
872         if (doc != NULL) {
873                 xmlSaveFormatFile(SETTING_FONT_CONF_FILE, doc, 0);
874                 xmlFreeDoc(doc);
875                 doc = NULL;
876         }
877
878         dl_font_config_set_notification();
879
880         char *vconf_value;
881         vconf_value = (char *)value;
882
883         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, vconf_value)) {
884                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
885         }
886         return SYSTEM_SETTINGS_ERROR_NONE;
887 }
888
889 int system_setting_set_motion_activation(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
890 {
891         SETTING_TRACE_BEGIN;
892         bool *vconf_value;
893         vconf_value = (bool *)value;
894         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_MOTION_ACTIVATION, *vconf_value)) {
895                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
896         }
897         return SYSTEM_SETTINGS_ERROR_NONE;
898 }
899
900 int system_setting_set_usb_debugging_option(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
901 {
902         SETTING_TRACE_BEGIN;
903         bool *vconf_value;
904         vconf_value = (bool *)value;
905         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, *vconf_value)) {
906                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
907         }
908         return SYSTEM_SETTINGS_ERROR_NONE;
909
910 }
911
912 int system_setting_set_3g_data_network(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
913 {
914         SETTING_TRACE_BEGIN;
915         bool *vconf_value;
916         vconf_value = (bool *)value;
917         if (system_setting_vconf_set_value_bool(VCONFKEY_3G_ENABLE, *vconf_value)) {
918                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
919         }
920
921         return SYSTEM_SETTINGS_ERROR_NONE;
922 }
923
924 static int category_func(const char *name, void *user_data)
925 {
926         SETTING_TRACE_BEGIN;
927         static char *category = "lock-screen";
928         if (name && !strcmp(name, category)) {
929                 SETTING_TRACE(" SAME ");
930                 return -1;
931         } else {
932                 SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category);
933                 return 0;
934         }
935
936         return 0;
937 }
938
939 /**
940  *
941  * set 'swipe type' if current lockscreen app is 'com.samsung.lockscreen'
942  *
943  */
944 int system_setting_set_lockscreen_app(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
945 {
946         SETTING_TRACE_BEGIN;
947         char *vconf_value;
948         vconf_value = (char *)value;            /* ex) com.samsung.lockscreen */
949
950         int r = 0;
951         pkgmgrinfo_appinfo_h handle;
952         r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle);
953         if (r != PMINFO_R_OK) {
954                 SETTING_TRACE("*** pkginfo failed ");
955                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
956         } else {
957                 SETTING_TRACE("%x", handle);
958         }
959
960         int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen");
961         if (ret != PMINFO_R_OK) {
962                 pkgmgrinfo_appinfo_destroy_appinfo(handle);
963                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
964         }
965
966         pkgmgrinfo_appinfo_destroy_appinfo(handle);
967         /*----------------------------------------------------------------------------------- */
968         int locktype = -1;
969         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) {
970                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
971         }
972
973         if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD)
974                 return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE;
975
976         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, vconf_value)) {
977                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
978         }
979
980         if (vconf_value && strcmp(vconf_value, "com.samsung.lockscreen") == 0) {
981                 if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE)) {
982                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
983                 }
984         }
985         return SYSTEM_SETTINGS_ERROR_NONE;
986 }
987
988 /*/////////////////////////////////////////////////////////////////////////////////////////////// */
989 /* */
990
991 int system_setting_set_changed_callback_incoming_call_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
992 {
993         SETTING_TRACE_BEGIN;
994         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
995 }
996
997 int system_setting_unset_changed_callback_incoming_call_ringtone(system_settings_key_e key)
998 {
999         SETTING_TRACE_BEGIN;
1000         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, 0);
1001 }
1002
1003 int system_setting_set_changed_callback_email_alert_ringtone(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1004 {
1005         SETTING_TRACE_BEGIN;
1006         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, 0, user_data);
1007 }
1008
1009 int system_setting_unset_changed_callback_email_alert_ringtone(system_settings_key_e key)
1010 {
1011         SETTING_TRACE_BEGIN;
1012         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1013 }
1014
1015 int system_setting_set_changed_callback_wallpaper_home_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1016 {
1017         SETTING_TRACE_BEGIN;
1018         return system_setting_vconf_set_changed_cb(VCONFKEY_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, 0, user_data);
1019 }
1020
1021 int system_setting_unset_changed_callback_wallpaper_home_screen(system_settings_key_e key)
1022 {
1023         SETTING_TRACE_BEGIN;
1024         return system_setting_vconf_unset_changed_cb(VCONFKEY_BGSET, 0);
1025 }
1026
1027 int system_setting_set_changed_callback_wallpaper_lock_screen(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1028 {
1029         SETTING_TRACE_BEGIN;
1030         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, SYSTEM_SETTINGS_KEY_WALLPAPER_LOCK_SCREEN, 0, user_data);
1031 }
1032
1033 int system_setting_unset_changed_callback_wallpaper_lock_screen(system_settings_key_e key)
1034 {
1035         SETTING_TRACE_BEGIN;
1036         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_BGSET, 0);
1037 }
1038
1039 int system_setting_set_changed_callback_font_size(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1040 {
1041         SETTING_TRACE_BEGIN;
1042         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, SYSTEM_SETTINGS_KEY_FONT_SIZE, 1, user_data);
1043 }
1044
1045 int system_setting_unset_changed_callback_font_size(system_settings_key_e key)
1046 {
1047         SETTING_TRACE_BEGIN;
1048         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, 1);
1049 }
1050
1051 int system_setting_set_changed_callback_usb_debugging_option(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1052 {
1053         SETTING_TRACE_BEGIN;
1054         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, 1, user_data);
1055 }
1056
1057 int system_setting_unset_changed_callback_usb_debugging_option(system_settings_key_e key)
1058 {
1059         SETTING_TRACE_BEGIN;
1060         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_USB_DEBUG_MODE_BOOL, 1);
1061 }
1062
1063 int system_setting_set_changed_callback_3g_data_network(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1064 {
1065         SETTING_TRACE_BEGIN;
1066         return system_setting_vconf_set_changed_cb(VCONFKEY_3G_ENABLE, SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, 1, user_data);
1067 }
1068
1069 int system_setting_unset_changed_callback_3g_data_network(system_settings_key_e key)
1070 {
1071         SETTING_TRACE_BEGIN;
1072         return system_setting_vconf_unset_changed_cb(VCONFKEY_3G_ENABLE, 1);
1073 }
1074
1075 int system_setting_set_changed_callback_lockscreen_app(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1076 {
1077         SETTING_TRACE_BEGIN;
1078         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP, 1, user_data);
1079 }
1080
1081 int system_setting_unset_changed_callback_lockscreen_app(system_settings_key_e key)
1082 {
1083         SETTING_TRACE_BEGIN;
1084         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, 1);
1085 }
1086
1087
1088 /**
1089  * @todo need to add custom event notification method
1090  */
1091 int system_setting_set_changed_callback_font_type(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1092 {
1093         SETTING_TRACE_BEGIN;
1094         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, SYSTEM_SETTINGS_KEY_FONT_TYPE, 2, user_data);
1095 }
1096
1097 int system_setting_unset_changed_callback_font_type(system_settings_key_e key)
1098 {
1099         SETTING_TRACE_BEGIN;
1100         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, 2);
1101 }
1102
1103 /* TODO : 2th argument, callback, is not in use. */
1104 int system_setting_set_changed_callback_motion_activation(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1105 {
1106         SETTING_TRACE_BEGIN;
1107         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, 3, user_data);
1108 }
1109
1110 int system_setting_unset_changed_callback_motion_activation(system_settings_key_e key)
1111 {
1112         SETTING_TRACE_BEGIN;
1113         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_MOTION_ACTIVATION, 3);
1114 }
1115
1116 /*//////////////////////////////////////////////////////////////////////////////////////// */
1117 /*--------------------------------------- */
1118 int system_setting_get_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1119 {
1120         SETTING_TRACE_BEGIN;
1121         char *vconf_value = NULL;
1122         if (system_setting_vconf_get_value_string(VCONFKEY_REGIONFORMAT, &vconf_value)) {
1123                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1124         }
1125
1126         /* parsing validation */
1127         /* en_US.UTF-8 */
1128         char arr[20];
1129         snprintf(arr, 20, "%s", vconf_value);
1130         arr[5] = '\0';
1131         *value = strdup(arr);
1132         free(vconf_value);
1133         vconf_value = NULL;
1134
1135         return SYSTEM_SETTINGS_ERROR_NONE;
1136 }
1137
1138 int system_setting_set_locale_country(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1139 {
1140         SETTING_TRACE_BEGIN;
1141         char *vconf_value = NULL;
1142         vconf_value = (char *)value;
1143
1144         char *ext = "UTF-8";
1145
1146         char arr[20];
1147         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1148
1149         if (system_setting_vconf_set_value_string(VCONFKEY_REGIONFORMAT, arr)) {
1150                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1151         }
1152         return SYSTEM_SETTINGS_ERROR_NONE;
1153 }
1154
1155 int system_setting_set_changed_callback_locale_country(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1156 {
1157         SETTING_TRACE_BEGIN;
1158         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT, SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, 3, user_data);
1159 }
1160
1161 int system_setting_unset_changed_callback_locale_country(system_settings_key_e key)
1162 {
1163         SETTING_TRACE_BEGIN;
1164         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT, 3);
1165 }
1166
1167
1168 /*--------------------------------------- */
1169 int system_setting_get_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1170 {
1171         SETTING_TRACE_BEGIN;
1172         char *vconf_value = NULL;
1173         if (system_setting_vconf_get_value_string(VCONFKEY_LANGSET, &vconf_value)) {
1174                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1175         }
1176
1177         /* parsing validation */
1178         /* en_US.UTF-8 */
1179         char arr[20];
1180         snprintf(arr, 20, "%s", vconf_value);
1181         arr[5] = '\0';
1182         *value = strdup(arr);
1183         free(vconf_value);
1184         vconf_value = NULL;
1185         return SYSTEM_SETTINGS_ERROR_NONE;
1186 }
1187
1188 int system_setting_set_locale_language(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1189 {
1190         SETTING_TRACE_BEGIN;
1191         char *vconf_value = NULL;
1192         vconf_value = (char *)value;
1193
1194         char *ext = "UTF-8";
1195
1196         char arr[20];
1197         snprintf(arr, 20, "%s.%s", vconf_value, ext);
1198
1199         if (system_setting_vconf_set_value_string(VCONFKEY_LANGSET, arr)) {
1200                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1201         }
1202         return SYSTEM_SETTINGS_ERROR_NONE;
1203 }
1204
1205 int system_setting_set_changed_callback_locale_language(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1206 {
1207         SETTING_TRACE_BEGIN;
1208         /*return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 3, user_data ); */
1209         return system_setting_vconf_set_changed_cb(VCONFKEY_LANGSET, SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, 100, user_data);
1210 }
1211
1212 int system_setting_unset_changed_callback_locale_language(system_settings_key_e key)
1213 {
1214         SETTING_TRACE_BEGIN;
1215         return system_setting_vconf_unset_changed_cb(VCONFKEY_LANGSET, 100);
1216 }
1217
1218 /*--------------------------------------- */
1219 int system_setting_get_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1220 {
1221         SETTING_TRACE_BEGIN;
1222         int vconf_value;
1223
1224         if (system_setting_vconf_get_value_int(VCONFKEY_REGIONFORMAT_TIME1224, &vconf_value)) {
1225                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1226         }
1227
1228         bool ret_value = true;
1229         if (vconf_value == VCONFKEY_TIME_FORMAT_12)
1230                 ret_value = false;
1231         else if (vconf_value == VCONFKEY_TIME_FORMAT_24)
1232                 ret_value = true;
1233
1234         *value = (void *)ret_value;
1235
1236         return SYSTEM_SETTINGS_ERROR_NONE;
1237 }
1238
1239 int system_setting_set_locale_timeformat_24hour(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1240 {
1241         SETTING_TRACE_BEGIN;
1242         bool *vconf_value;
1243
1244         vconf_value = (bool *)value;
1245
1246         if (*vconf_value) {
1247                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_24)) {
1248                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1249                 }
1250
1251         } else {
1252                 if (system_setting_vconf_set_value_int(VCONFKEY_REGIONFORMAT_TIME1224, VCONFKEY_TIME_FORMAT_12)) {
1253                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1254                 }
1255
1256         }
1257
1258         return SYSTEM_SETTINGS_ERROR_NONE;
1259 }
1260
1261 int system_setting_set_changed_callback_locale_timeformat_24hour(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1262 {
1263         SETTING_TRACE_BEGIN;
1264         return system_setting_vconf_set_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, 3, user_data);
1265 }
1266
1267 int system_setting_unset_changed_callback_locale_timeformat_24hour(system_settings_key_e key)
1268 {
1269         SETTING_TRACE_BEGIN;
1270         return system_setting_vconf_unset_changed_cb(VCONFKEY_REGIONFORMAT_TIME1224, 3);
1271 }
1272
1273 int system_setting_get_locale_timezone(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1274 {
1275         SETTING_TRACE_BEGIN;
1276 #if 0
1277         char tzpath[256];
1278         ssize_t len = readlink(SETTING_TZONE_SYMLINK_PATH, tzpath, sizeof(tzpath) - 1);
1279         if (len != -1) {
1280                 tzpath[len] = '\0';
1281         } else {
1282                 SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH");
1283                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1284         }
1285         /* "/usr/share/zoneinfo/Asia/Seoul" */
1286         SETTING_TRACE("tzpath : %s ", &tzpath[20]);
1287         *value = strdup(&tzpath[20]);
1288 #else
1289         *value = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
1290 #endif
1291         return SYSTEM_SETTINGS_ERROR_NONE;
1292 }
1293
1294 int system_setting_set_changed_callback_locale_timezone_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1295 {
1296         SETTING_TRACE_BEGIN;
1297         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1298 }
1299
1300 int system_setting_unset_changed_callback_locale_timezone_changed(system_settings_key_e key)
1301 {
1302         SETTING_TRACE_BEGIN;
1303         return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1304 }
1305
1306
1307 int system_setting_get_time_changed(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1308 {
1309         SETTING_TRACE_BEGIN;
1310         time_t cur_tick;
1311         cur_tick = time(NULL);
1312         *value = (void *)cur_tick;
1313         /* struct tm * localtime = time (cur_tick); */
1314         /* printf("%s\n", ctime(&cur_tick); */
1315         return SYSTEM_SETTINGS_ERROR_NONE;
1316
1317 }
1318
1319 int system_setting_set_changed_callback_time_changed(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1320 {
1321         SETTING_TRACE_BEGIN;
1322         return system_setting_vconf_set_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, SYSTEM_SETTINGS_KEY_TIME_CHANGED, 3, user_data);
1323 }
1324
1325 int system_setting_unset_changed_callback_time_changed(system_settings_key_e key)
1326 {
1327         SETTING_TRACE_BEGIN;
1328         return system_setting_vconf_unset_changed_cb(VCONFKEY_SYSTEM_TIME_CHANGED, 3);
1329 }
1330
1331
1332
1333 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1334 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1335 {
1336         SETTING_TRACE_BEGIN;
1337         bool vconf_value;
1338
1339         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1340                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1341         }
1342         *value = (void *)vconf_value;
1343
1344         return SYSTEM_SETTINGS_ERROR_NONE;
1345 }
1346
1347 int system_setting_set_changed_callback_sound_lock(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1348 {
1349         SETTING_TRACE_BEGIN;
1350         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, SYSTEM_SETTINGS_KEY_SOUND_LOCK, 3, user_data);
1351 }
1352
1353 int system_setting_unset_changed_callback_sound_lock(system_settings_key_e key)
1354 {
1355         SETTING_TRACE_BEGIN;
1356         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, 3);
1357 }
1358
1359 /**
1360  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1361  *
1362  * a == false, b == false --> silent mode
1363  * a == true, b == false --> sound mode
1364  * a == false, b == true --> vibration mode
1365  */
1366 int system_setting_get_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1367 {
1368         SETTING_TRACE_BEGIN;
1369         bool sound_cond;
1370         bool vib_cond;
1371
1372         bool vconf_value;
1373         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &sound_cond)) {
1374                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1375         }
1376
1377         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vib_cond)) {
1378                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1379         }
1380
1381         if (sound_cond == false && vib_cond == false) {
1382                 vconf_value = true;
1383                 *value = (void *)vconf_value;
1384         } else {
1385                 vconf_value = false;
1386                 *value = (void *)vconf_value;
1387         }
1388         return SYSTEM_SETTINGS_ERROR_NONE;
1389 }
1390
1391 /**
1392  * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL
1393  *
1394  * a == false, b == false --> silent mode
1395  * a == true, b == false --> sound mode
1396  */
1397 int system_setting_set_sound_silent_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1398 {
1399         SETTING_TRACE_BEGIN;
1400         bool *vconf_value;
1401
1402         vconf_value = (bool *)value;
1403
1404         bool vconf_sound = false;
1405         bool vconf_vib = false;
1406
1407         if (*vconf_value) {
1408                 vconf_sound = false;
1409                 vconf_vib = false;
1410         } else {
1411                 vconf_sound = true;
1412                 vconf_vib = false;
1413         }
1414
1415         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, vconf_sound)) {
1416                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1417         }
1418         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, vconf_vib)) {
1419                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1420         }
1421
1422         return SYSTEM_SETTINGS_ERROR_NONE;
1423 }
1424
1425
1426
1427 /* TODO */
1428 int system_setting_set_changed_callback_sound_silent_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1429 {
1430         SETTING_TRACE_BEGIN;
1431         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, 3, user_data);
1432 }
1433
1434 /* TODO */
1435 int system_setting_unset_changed_callback_sound_silent_mode(system_settings_key_e key)
1436 {
1437         SETTING_TRACE_BEGIN;
1438         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, 3);
1439 }
1440
1441 /* SYSTEM_SETTINGS_KEY_SOUND_TOUCH */
1442 int system_setting_get_sound_touch(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1443 {
1444         SETTING_TRACE_BEGIN;
1445         bool vconf_value;
1446
1447         int ret = system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, &vconf_value);
1448         if (ret != SYSTEM_SETTINGS_ERROR_NONE) {
1449                 return ret;
1450         }
1451         *value = (void *)vconf_value;
1452         return ret;
1453 }
1454
1455 int system_setting_set_changed_callback_sound_touch(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1456 {
1457         SETTING_TRACE_BEGIN;
1458         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, SYSTEM_SETTINGS_KEY_SOUND_TOUCH, 2, user_data);
1459 }
1460
1461 int system_setting_unset_changed_callback_sound_touch(system_settings_key_e key)
1462 {
1463         SETTING_TRACE_BEGIN;
1464         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_TOUCH_SOUNDS_BOOL, 2);
1465 }
1466
1467 #if 0
1468 /* SYSTEM_SETTINGS_KEY_SOUND_LOCK */
1469 int system_setting_get_sound_lock(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1470 {
1471         bool vconf_value;
1472
1473         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_SOUND_LOCK_BOOL, &vconf_value)) {
1474                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1475         }
1476         *value = (void *)vconf_value;
1477
1478         return SYSTEM_SETTINGS_ERROR_NONE;
1479 }
1480 #endif
1481
1482 int system_setting_get_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1483 {
1484         SETTING_TRACE_BEGIN;
1485         bool vconf_value;
1486
1487         if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &vconf_value)) {
1488                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1489         }
1490         *value = (void *)vconf_value;
1491
1492         return SYSTEM_SETTINGS_ERROR_NONE;
1493 }
1494
1495 int system_setting_set_auto_rotation_mode(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1496 {
1497         SETTING_TRACE_BEGIN;
1498         bool *vconf_value;
1499         vconf_value = (bool *)value;
1500         if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, *vconf_value)) {
1501                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1502         }
1503
1504         return SYSTEM_SETTINGS_ERROR_NONE;
1505 }
1506
1507 int system_setting_set_changed_callback_auto_rotation_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1508 {
1509         SETTING_TRACE_BEGIN;
1510         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1511 }
1512
1513 int system_setting_unset_changed_callback_auto_rotation_mode(system_settings_key_e key)
1514 {
1515         SETTING_TRACE_BEGIN;
1516         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, 2);
1517 }
1518
1519 int system_setting_get_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1520 {
1521         SETTING_TRACE_BEGIN;
1522         int vconf_value;
1523
1524         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &vconf_value)) {
1525                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1526         }
1527         *value = (void *)vconf_value;
1528
1529         return SYSTEM_SETTINGS_ERROR_NONE;
1530 }
1531
1532
1533 int system_setting_set_screen_backlight_time(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1534 {
1535         SETTING_TRACE_BEGIN;
1536         int *vconf_value;
1537         vconf_value = (int *)value;
1538
1539         if (!(*vconf_value > 0 && *vconf_value < 600)) {
1540                 SETTING_TRACE(" ERR Betweeny here  0 ~ 600");
1541                 return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
1542         }
1543
1544         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, *vconf_value)) {
1545                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1546         }
1547         SETTING_TRACE_END;
1548         return SYSTEM_SETTINGS_ERROR_NONE;
1549 }
1550
1551 int system_setting_set_changed_callback_screen_backlight_time(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1552 {
1553         SETTING_TRACE_BEGIN;
1554         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, SYSTEM_SETTINGS_KEY_DISPLAY_SCREEN_ROTATION_AUTO, 2, user_data);
1555 }
1556
1557 int system_setting_unset_changed_callback_screen_backlight_time(system_settings_key_e key)
1558 {
1559         SETTING_TRACE_BEGIN;
1560         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, 2);
1561 }
1562
1563 int system_setting_get_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1564 {
1565         SETTING_TRACE_BEGIN;
1566         char *vconf_value = NULL;
1567         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, &vconf_value)) {
1568                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1569         }
1570
1571         *value = vconf_value;
1572         return SYSTEM_SETTINGS_ERROR_NONE;
1573 }
1574
1575 int system_setting_set_sound_notification(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1576 {
1577         SETTING_TRACE_BEGIN;
1578         char *vconf_value = NULL;
1579         vconf_value = (char *)value;
1580
1581         int is_load = _is_file_accessible(vconf_value);
1582         if (is_load == 0) {
1583                 if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, vconf_value)) {
1584                         return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1585                 }
1586         } else {
1587                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1588         }
1589
1590         return SYSTEM_SETTINGS_ERROR_NONE;
1591 }
1592
1593 int system_setting_set_changed_callback_sound_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1594 {
1595         SETTING_TRACE_BEGIN;
1596         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, 0, user_data);
1597 }
1598
1599 int system_setting_unset_changed_callback_sound_notification(system_settings_key_e key)
1600 {
1601         SETTING_TRACE_BEGIN;
1602         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_RINGTONE_PATH_STR, 0);
1603 }
1604
1605 int system_setting_get_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1606 {
1607         SETTING_TRACE_BEGIN;
1608         int vconf_value;
1609
1610         if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, &vconf_value)) {
1611                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1612         }
1613         *value = (void *)vconf_value;
1614
1615         return SYSTEM_SETTINGS_ERROR_NONE;
1616 }
1617
1618 int system_setting_set_notification_repetition_period(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1619 {
1620         SETTING_TRACE_BEGIN;
1621         int *vconf_value;
1622         vconf_value = (int *)value;
1623
1624         if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, *vconf_value)) {
1625                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1626         }
1627         SETTING_TRACE_END;
1628         return SYSTEM_SETTINGS_ERROR_NONE;
1629 }
1630
1631 int system_setting_set_changed_callback_notification_repetition_period(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1632 {
1633         SETTING_TRACE_BEGIN;
1634         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);
1635 }
1636
1637 int system_setting_unset_changed_callback_notification_repetition_period(system_settings_key_e key)
1638 {
1639         SETTING_TRACE_BEGIN;
1640         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_NOTI_MSG_ALERT_REP_TYPE_INT, 1);
1641 }
1642
1643 int system_setting_get_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1644 {
1645         SETTING_TRACE_BEGIN;
1646         char *vconf_value = NULL;
1647         if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, &vconf_value)) {
1648                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1649         }
1650
1651         *value = vconf_value;
1652         return SYSTEM_SETTINGS_ERROR_NONE;
1653 }
1654
1655 int system_setting_set_device_name(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1656 {
1657         SETTING_TRACE_BEGIN;
1658         char *vconf_value = NULL;
1659         vconf_value = (char *)value;
1660
1661         if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) {
1662                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1663         }
1664
1665         return SYSTEM_SETTINGS_ERROR_NONE;
1666 }
1667
1668 int system_setting_set_changed_callback_device_name(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1669 {
1670         SETTING_TRACE_BEGIN;
1671         return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, SYSTEM_SETTINGS_KEY_DEVICE_NAME, 0, user_data);
1672 }
1673
1674 int system_setting_unset_changed_callback_device_name(system_settings_key_e key)
1675 {
1676         SETTING_TRACE_BEGIN;
1677         return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVICE_NAME_STR, 0);
1678 }
1679
1680 /*---------------------------------------------- */
1681 int system_setting_get_network_flight_mode(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1682 {
1683         SETTING_TRACE_BEGIN;
1684         bool vconf_value;
1685         if (system_setting_vconf_get_value_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &vconf_value)) {
1686                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1687         }
1688         *value = (void *)vconf_value;
1689
1690         return SYSTEM_SETTINGS_ERROR_NONE;
1691 }
1692
1693 int system_setting_set_changed_callback_network_flight_mode(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1694 {
1695         SETTING_TRACE_BEGIN;
1696         return system_setting_vconf_set_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, SYSTEM_SETTINGS_KEY_NETWORK_FLIGHT_MODE, 3, user_data);
1697 }
1698
1699 int system_setting_unset_changed_callback_network_flight_mode(system_settings_key_e key)
1700 {
1701         SETTING_TRACE_BEGIN;
1702         return system_setting_vconf_unset_changed_cb(VCONFKEY_TELEPHONY_FLIGHT_MODE, 3);
1703 }
1704
1705 int system_setting_get_network_wifi_notification(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1706 {
1707         SETTING_TRACE_BEGIN;
1708         int vconf_value;
1709         if (system_setting_vconf_get_value_int(VCONFKEY_WIFI_ENABLE_QS, &vconf_value)) {
1710                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1711         }
1712         bool bret ;
1713         bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false;
1714
1715         *value = (void *)bret;
1716         return SYSTEM_SETTINGS_ERROR_NONE;
1717 }
1718
1719 int system_setting_set_changed_callback_network_wifi_notification(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1720 {
1721         SETTING_TRACE_BEGIN;
1722         return system_setting_vconf_set_changed_cb(VCONFKEY_WIFI_ENABLE_QS, SYSTEM_SETTINGS_KEY_NETWORK_WIFI_NOTIFICATION, 4, user_data);
1723 }
1724
1725 int system_setting_unset_changed_callback_network_wifi_notification(system_settings_key_e key)
1726 {
1727         SETTING_TRACE_BEGIN;
1728         return system_setting_vconf_unset_changed_cb(VCONFKEY_WIFI_ENABLE_QS, 4);
1729 }
1730
1731 int system_setting_get_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void **value)
1732 {
1733         int vconf_value;
1734
1735         if (system_setting_vconf_get_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, &vconf_value)) {
1736                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1737         }
1738         *value = (void *)vconf_value;
1739
1740         return SYSTEM_SETTINGS_ERROR_NONE;
1741 }
1742
1743 int system_setting_set_lock_state(system_settings_key_e key, system_setting_data_type_e data_type, void *value)
1744 {
1745         SETTING_TRACE_BEGIN;
1746         int *vconf_value;
1747         vconf_value = (int *)value;
1748
1749         if (system_setting_vconf_set_value_int(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, *vconf_value)) {
1750                 return SYSTEM_SETTINGS_ERROR_IO_ERROR;
1751         }
1752         SETTING_TRACE_END;
1753         return SYSTEM_SETTINGS_ERROR_NONE;
1754 }
1755
1756 int system_setting_set_changed_callback_lock_state(system_settings_key_e key, system_settings_changed_cb callback, void *user_data)
1757 {
1758         return system_setting_vconf_set_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, SYSTEM_SETTINGS_KEY_LOCK_STATE, 4, user_data);
1759 }
1760
1761 int system_setting_unset_changed_callback_lock_state(system_settings_key_e key)
1762 {
1763         return system_setting_vconf_unset_changed_cb(VCONFKEY_IDLE_LOCK_STATE_READ_ONLY, 4);
1764 }
1765
1766