4 * Copyright 2012 Samsung Electronics Co., Ltd
6 * Licensed under the Flora License, Version 1.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.tizenopensource.org/license
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 #include <efl_assist.h>
25 #include <appcore-efl.h>
27 #include <pkgmgr-info.h>
28 /*#include <package-manager.h> */
31 #include <dd-display.h>
32 #include <dd-deviced.h>
37 #include <mode-syspopup.h>
38 #include <mode-syspopup-alarmmgr.h>
39 #include <dd-haptic.h>
41 #include <tapi_common.h>
43 #include <ITapiModem.h>
44 #include <TapiUtility.h>
46 #include <sound_manager.h>
47 #include <app_preference.h>
48 #include <bundle_internal.h>
49 #include <notification_text_domain.h>
50 #include <notification_internal.h>
51 #include <setting-debug.h>
52 #include <setting-common-data-error.h>
54 #include "setting-common-general-func.h"
57 void play_text(struct appdata *ad, const char *text);
59 static bool is_recovery = false;
60 static int normal_settings[22] = { -1, -1, -1, -1, -1, -1, -1, -3, -1, -1, -1, -1, -1 /*and pws profile*/, -1, -1, -1, -1, -1, -1, -1, 0, 0};
61 static int powerful_settings_def[22] = {0, 0, 0, 20, 0, 15, 0, 0, 0, 1, 1, -1, -1 /*and pws profile*/, -1, -1, -1, -1, -1, -1, -1, 0, 0};
62 static int powerful_settings[22] = { -2, -2, -2, -2, -2, -2, -2, -4, -2, -2, -2, -2, -2 /*and pws profile*/, -1, -1, -1, -1, -1, -1, -1, 0, 0};
63 static int emergency_settings[22] = {0, 0, 0, 20, 0, 15, 0, 0, 1, 1, 1, 1, 1 /*and pws profile*/, 0, 0, 0, 0, 0, 0, 0, 1, 1};
64 /*brightness default as 20 changed 20131127 */
65 /*lcd freq default as 1 in setting spec */
67 /* default value for power saving
68 * Power saving mode default
70 Apps opening effect : Off
71 Use GPS satellites : Off
72 ----------------------------------------
75 Screen timeout : 15sec
77 Touch key light duration : Always off
79 ----------------------------------------
80 CPU max frequency limit : On
86 static Eina_List *mini_list;
87 static int __mode_reboot_noti_method();
88 static int __mode_syspopup_app_terminate(void *data);
91 /*dbus for CPU freq control*/
92 static int __append_param(DBusMessage *msg, const char *sig, char *param[])
95 DBusMessageIter cont_iter;
100 if (sig == NULL || param == NULL)
103 dbus_message_iter_init_append(msg, &iter);
104 for (ch = (char *)sig, i = 0; *ch != '\0'; ++i, ++ch) {
105 _DBG("sig : %c", *ch);
108 int_type = atoi(param[i]);
109 _DBG("param[%2d] : %d", i, int_type);
110 dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &int_type);
114 _DBG("param[%2d] : %s", i, str_type);
115 dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &str_type);
124 static DBusMessage *__invoke_dbus_method(const char *dest, const char *path,
125 const char *interface, const char *method,
126 const char *sig, char *param[])
129 DBusConnection *conn;
134 conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
136 _DBG("dbus_bus_get error");
139 msg = dbus_message_new_method_call(dest, path, interface, method);
141 _DBG("dbus_message_new_method_call error");
144 r = __append_param(msg, sig, param);
146 _DBG("append_param error");
149 dbus_error_init(&err);
150 reply = dbus_connection_send_with_reply_and_block(conn, msg, DBUS_REPLY_TIMEOUT, &err);
151 dbus_message_unref(msg);
152 if (dbus_error_is_set(&err)) {
153 _DBG("dbus_connection_send_with_reply_and_block error");
154 _DBG("error [%s:%s]", err.name, err.message);
155 dbus_error_free(&err);
161 int __set_LCD_freq_control(int value)
168 char temp1[2] = {0,};
172 dbus_error_init(&err);
174 snprintf(temp1, 2, "%1d", 0); /*kernal parsing setting with value 0 */
176 _DBG("set as [%s]", temp1);
178 snprintf(temp, 3, "%1d", value);
180 _DBG("set as [%s]", temp);
184 msg = __invoke_dbus_method(BUS_NAME, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_NAME, "ii", arr);
186 if (!dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID)) {
187 _DBG("no message : [%s:%s]", err.name, err.message);
188 ret = -1; /*RETURN FAIL */
190 _DBG("%s-%s : %d", DEVICED_INTERFACE_DISPLAY, METHOD_NAME, state);
192 dbus_message_unref(msg);
196 return ret; /*succuess */
199 static Eina_Bool _LCD_freq_ctrl(void *data)
201 struct appdata *ad = data;
202 _DBG("_LCD_freq_ctrl");
204 /*lcd freq ctrl, it effect flickering while progressing on change home */
205 /*get master key psmode */
207 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
209 _DBG("ad->type: %s, vconfkey : %d", ad->type, m_key);
210 if (!strcmp(ad->type, MODE_SYSTEM_POPUP_EMERGENCY) || !strcmp(ad->type, MODE_SYSTEM_POPUP_EMERGENCY_SETTING)) {
211 if (ad->is_lcd_ctrl) {
212 /*normal -> emergency */
213 _DBG("set LCD FRQ ON, 40");
214 __set_LCD_freq_control(LCD_FRQ_CONTROL_ON);
216 } else if (!strcmp(ad->type, MODE_SYSTEM_POPUP_NORMAL) || !strcmp(ad->type, MODE_SYSTEM_POPUP_NORMAL_SETTING)) {
217 /*except powerful -> normal */
218 if (!ad->is_lcd_ctrl) {
219 /*emergency -> normal */
220 _DBG("set LCD FRQ OFF, 60");
221 __set_LCD_freq_control(LCD_FRQ_CONTROL_OFF);
227 static Eina_Bool _LCD_freq_ctrl_handler(void *data)
229 struct appdata *ad = data;
230 _DBG("_LCD_freq_ctrl_handler");
234 ad->lcd_freq_timer = NULL;
238 /*mini app term start*/
244 void list_destroy_running_pid(Evas_Object *win)
248 Eina_List *list = evas_object_data_del(win, DATA_KEY_RUNNING_LIST);
249 if (NULL == list) return;
252 EINA_LIST_FREE(list, p) {
253 if (NULL == p) continue;
254 if (p->appid) free(p->appid);
258 eina_list_free(list);
261 static int _running_app_info_cb(const aul_app_info *ainfo, void *data)
263 retv_if(NULL == ainfo, 0);
264 retv_if(NULL == ainfo->pkg_name, 0);
265 retv_if(NULL == data, 0);
267 Evas_Object *win = data;
268 pid_s *p = calloc(1, sizeof(pid_s));
269 retv_if(NULL == p, 0);
271 char *appid = strdup(ainfo->pkg_name);
272 goto_if(NULL == appid, ERROR);
277 Eina_List *rlist = evas_object_data_get(win, DATA_KEY_RUNNING_LIST);
278 rlist = eina_list_append(rlist, p);
279 evas_object_data_set(win, DATA_KEY_RUNNING_LIST, rlist);
288 int list_create_running_pid(Evas_Object *win)
290 _DBG("list_create_running_pid");
291 list_destroy_running_pid(win);
293 if (AUL_R_OK != aul_app_get_running_app_info(_running_app_info_cb, win)) {
295 if (AUL_R_OK != aul_get_running_app_info_from_memory(_running_app_info_cb, win)) {
297 _DBG("Cannot get the running apps' info");
303 int list_get_running_pid(Evas_Object *win, const char *appid)
305 Eina_List *list = NULL;
306 const Eina_List *l = NULL;
307 const Eina_List *ln = NULL;
310 retv_if(NULL == win, -1);
311 retv_if(NULL == appid, -1);
313 list = evas_object_data_get(win, DATA_KEY_RUNNING_LIST);
315 retv_if(0 != list_create_running_pid(win), -1);
316 list = evas_object_data_get(win, DATA_KEY_RUNNING_LIST);
317 /* It's possible to be no running apps */
318 if (NULL == list) return -1;
321 EINA_LIST_FOREACH_SAFE(list, l, ln, p) {
322 if (NULL == p) continue;
323 if (NULL == p->appid) continue;
324 if (!strcmp(p->appid, appid)) return p->pid;
330 #define APPID_PHONE "org.tizen.phone"
331 #define APPID_CONTACTS "org.tizen.contacts" /*it is different appid in 'Phone' mini app P140623-06536 */
332 int _mini_apps_cb(pkgmgrinfo_appinfo_h handle, void *user_data)
334 retv_if(NULL == handle, 0);
337 pkgmgrinfo_appinfo_get_appid(handle, &appid);
338 retv_if(NULL == appid, 0);
340 _DBG("appid[%s]", appid);
341 if (appid && !strcmp(appid, APPID_PHONE)) {
342 mini_list = eina_list_append(mini_list, strdup(APPID_CONTACTS));
344 mini_list = eina_list_append(mini_list, strdup(appid));
349 #define MINIAPP_CATEGORY "http://samsung.com/category/floatingapp"
350 Eina_List *_miniapp_create(void)
352 /* Get info from AIL */
353 pkgmgrinfo_appinfo_filter_h filter = NULL;
357 ret = pkgmgrinfo_appinfo_filter_create(&filter);
359 _DBG("pkgmgrinfo_appinfo_filter_create() failed");
361 ret = pkgmgrinfo_appinfo_filter_add_string(filter, PMINFO_APPINFO_PROP_APP_CATEGORY, MINIAPP_CATEGORY);
362 ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, _mini_apps_cb, NULL);
363 ret = pkgmgrinfo_appinfo_filter_count(filter, &count);
366 pkgmgrinfo_appinfo_filter_destroy(filter);
374 void _mini_terminate(int pid)
376 _DBG("Terminate: (%d)", pid);
378 if (aul_terminate_pid(pid) < 0) {
379 _ERR("aul_terminate_pid fail");
384 void _mini_destroy(void)
386 mini_list = eina_list_free(mini_list);
389 void _terminate_miniapp(void *data)
391 struct appdata *ad = data;
392 mini_list = _miniapp_create(); /*list create */
393 ret_if(NULL == mini_list);
397 EINA_LIST_FOREACH(mini_list, l, appid) {
398 _DBG("terminate miniapp [%s]", appid);
399 if (!appid) continue;
400 int pid = list_get_running_pid(ad->win, appid);
401 if (pid) _mini_terminate(pid);
404 /*mini app term end*/
408 static void __help_popup_language_change_cb(void *data, Evas_Object *obj, void *source)
410 /*char *string_id = (char *)data;
411 char *message = _(string_id);
412 helpui_set_popup_text(obj, message);*/
415 static void syspop_help_popup_circle_block_create(Evas_Object *win, Evas_Object *parent, Evas_Object **circle,
416 Evas_Object **popup, char *string_id, int x, int y, Evas_Coord_Rectangle *rect)
420 int launching_effect_set(Evas_Object *win, int flag)
422 Ecore_X_Window xwin, root;
423 Ecore_X_Atom effect_enable_atom;
424 int is_enable = flag;
425 root = ecore_x_window_root_first_get();
426 effect_enable_atom = ecore_x_atom_get("_NET_CM_EFFECT_ENABLE");
427 if (!effect_enable_atom) {
428 _DBG("Cannot create _NET_CM_EFFECT_ENABLE atom... \n\n");
432 /* is_enable (0: effect disable, 1: effect enable) */
433 ecore_x_window_prop_card32_set(root, effect_enable_atom, &is_enable, 1);
438 int launching_effect_get(Evas_Object *win, int *flag)
440 Ecore_X_Window xwin, root;
441 Ecore_X_Atom effect_enable_atom;
443 root = ecore_x_window_root_first_get();
444 effect_enable_atom = ecore_x_atom_get("_NET_CM_EFFECT_ENABLE");
445 if (!effect_enable_atom) {
446 _DBG("Cannot create _NET_CM_EFFECT_ENABLE atom... \n\n");
450 /* is_enable (0: effect disable, 1: effect enable) */
451 (void)ecore_x_window_prop_card32_get(root, effect_enable_atom, &is_enable, 1);
457 static void mode_remove_noti(void *data, char *package)
459 struct appdata *ad = data;
460 notification_error_e ret = NOTIFICATION_ERROR_NONE;
461 ret = notification_delete_all_by_type(package, NOTIFICATION_TYPE_ONGOING); /*pkg ex : "setting-blockingmode-efl" */
462 if (ret != NOTIFICATION_ERROR_NONE) {
463 _DBG("Fail to notification_delete_all_by_type [%d]", ret);
468 static void mode_create_noti(void *data, const char *key_str, const char *package, const char *title)
470 struct appdata *ad = data;
471 notification_h noti = NULL;
472 notification_error_e ret = NOTIFICATION_ERROR_NONE;
475 mode_remove_noti(ad, package);
477 noti = notification_new(NOTIFICATION_TYPE_ONGOING,
478 NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
480 _DBG("Fail to notification_new [%d]", ret);
484 ret = notification_set_layout(noti, NOTIFICATION_LY_ONGOING_EVENT);
485 if (ret != NOTIFICATION_ERROR_NONE) {
486 _DBG("Fail to notification_set_layout [%d]", ret);
490 if (!strcmp("setting-firewall-efl", package)) {
491 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, IMG_Firewall);
492 if (ret != NOTIFICATION_ERROR_NONE) {
493 _DBG("Fail to notification_set_image [%d]", ret);
496 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, INDI_IMG_Firewall);
497 if (ret != NOTIFICATION_ERROR_NONE) {
498 _DBG("Fail to notification_set_image [%d]", ret);
503 ret = notification_set_text(noti,
504 NOTIFICATION_TEXT_TYPE_TITLE,
506 title, NOTIFICATION_VARIABLE_TYPE_NONE);
507 if (ret != NOTIFICATION_ERROR_NONE) {
508 _DBG("Fail to notification_set_text [%d]", ret);
512 ret = notification_set_text(noti,
513 NOTIFICATION_TEXT_TYPE_CONTENT,
515 key_str, NOTIFICATION_VARIABLE_TYPE_NONE);
516 if (ret != NOTIFICATION_ERROR_NONE) {
517 _DBG("Fail to notification_set_text [%d]", ret);
521 ret = notification_set_text_domain(noti, SETTING_PACKAGE, SETTING_LOCALEDIR);
522 if (ret != NOTIFICATION_ERROR_NONE) {
523 _DBG("Fail to notification_set_text [%d]", ret);
527 ret = notification_set_pkgname(noti, package); /*pkg ex : "setting-blockingmode-efl" */
528 if (ret != NOTIFICATION_ERROR_NONE) {
529 _DBG("Fail to notification_set_pkgname [%d]", ret);
533 ret = notification_set_application(noti, package); /*pkg ex : "setting-blockingmode-efl" */
534 if (ret != NOTIFICATION_ERROR_NONE) {
535 _DBG("Fail to notification_set_application [%d]", ret);
539 ret = notification_insert(noti, &ad->noti_id);
540 if (ret != NOTIFICATION_ERROR_NONE) {
541 _DBG("Fail to notification_insert [%d]", ret);
545 ret = notification_free(noti);
546 if (ret != NOTIFICATION_ERROR_NONE) {
547 _DBG("Fail to notification_free [%d]", ret);
554 ret = notification_free(noti);
555 if (ret != NOTIFICATION_ERROR_NONE) {
556 _DBG("Fail to notification_free [%d]", ret);
561 static void mode_create_noti_with_no_msg(void *data, const char *key_str, const char *package, const char *title)
563 struct appdata *ad = data;
564 notification_h noti = NULL;
565 notification_error_e ret = NOTIFICATION_ERROR_NONE;
568 mode_remove_noti(ad, package);
570 noti = notification_new(NOTIFICATION_TYPE_ONGOING,
571 NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
573 _DBG("Fail to notification_new [%d]", ret);
577 ret = notification_set_layout(noti, NOTIFICATION_LY_NOTI_THUMBNAIL);
578 if (ret != NOTIFICATION_ERROR_NONE) {
579 _DBG("Fail to notification_set_layout [%d]", ret);
583 if (!strcmp(PKG_BLOCKING_MODE, package)) {
584 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, IMG_BlockingMode);
585 if (ret != NOTIFICATION_ERROR_NONE) {
586 _DBG("Fail to notification_set_image [%d]", ret);
589 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, INDI_IMG_BlockingMode);
590 if (ret != NOTIFICATION_ERROR_NONE) {
591 _DBG("Fail to notification_set_image [%d]", ret);
596 ret = notification_set_text(noti,
597 NOTIFICATION_TEXT_TYPE_TITLE,
599 title, NOTIFICATION_VARIABLE_TYPE_NONE);
600 if (ret != NOTIFICATION_ERROR_NONE) {
601 _DBG("Fail to notification_set_text [%d]", ret);
605 ret = notification_set_text(noti,
606 NOTIFICATION_TEXT_TYPE_CONTENT,
608 key_str, NOTIFICATION_VARIABLE_TYPE_NONE);
609 if (ret != NOTIFICATION_ERROR_NONE) {
610 _DBG("Fail to notification_set_text [%d]", ret);
614 ret = notification_set_text_domain(noti, SETTING_PACKAGE, SETTING_LOCALEDIR);
615 if (ret != NOTIFICATION_ERROR_NONE) {
616 _DBG("Fail to notification_set_text [%d]", ret);
620 ret = notification_set_pkgname(noti, package); /*pkg ex : "setting-blockingmode-efl" */
621 if (ret != NOTIFICATION_ERROR_NONE) {
622 _DBG("Fail to notification_set_pkgname [%d]", ret);
626 ret = notification_set_application(noti, package); /*pkg ex : "setting-blockingmode-efl" */
627 if (ret != NOTIFICATION_ERROR_NONE) {
628 _DBG("Fail to notification_set_application [%d]", ret);
632 ret = notification_insert(noti, &ad->noti_id);
633 if (ret != NOTIFICATION_ERROR_NONE) {
634 _DBG("Fail to notification_insert [%d]", ret);
638 ret = notification_free(noti);
639 if (ret != NOTIFICATION_ERROR_NONE) {
640 _DBG("Fail to notification_free [%d]", ret);
647 ret = notification_free(noti);
648 if (ret != NOTIFICATION_ERROR_NONE) {
649 _DBG("Fail to notification_free [%d]", ret);
654 void _mode_backup_settings(void *data)
657 struct appdata *ad = data;
664 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &val);
665 _DBG("VCONFKEY_SETAPPL_PSMODE [%d]", val);
666 ret = preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_PSMODE, val);
667 _DBG("PREFKEY_SAVINGPOWER_BACKUP_PSMODE [%d]", ret);
670 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &val);
671 _DBG("VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU [%d]", val);
672 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_CPU_PERF, val);
673 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_CPU_PERF [%d]", ret);
675 /*Wallpaper change */
676 str1 = vconf_get_str(VCONF_HOMESCREEN_PATH);
677 ret = preference_set_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HOMESCREEN_PATH, str1);
679 str2 = vconf_get_str(VCONF_LOCKSCREEN_PATH);
680 ret = preference_set_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LOCKSCREEN_PATH, str2);
684 vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &val);
685 _DBG("VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL [%d]", val);
686 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TIMEOUT, val);
687 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TIMEOUT [%d]", ret);
688 /*Auto Brightness : ON/OFF */
689 vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &val);
690 _DBG("VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT [%d]", val);
691 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_BRIGHT, val);
692 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_BRIGHT [%d]", ret);
694 vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &val);
695 _DBG("VCONFKEY_SETAPPL_LCD_BRIGHTNESS [%d]", val);
696 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_BRIGHT, val);
697 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_BRIGHT [%d]", ret);
698 /*Auto rotate screen */
699 vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &val);
700 _DBG("VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL [%d]", val);
701 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_ROTATE, val);
702 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_ROTATE [%d]", ret);
705 vconf_get_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, &val);
706 _DBG("VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL [%d]", val);
707 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HAPTIC_FEEDBACK, val); /*on/off */
708 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HAPTIC_FEEDBACK [%d]", ret);
709 /*Launching effect */
710 launching_effect_get(ad->win, &val);
711 _DBG("launching_effect_get [%d]", val);
712 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LAUNCH_EFFECT, val);
713 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LAUNCH_EFFECT [%d]", ret);
715 /*pkg backup : cluster or easy */
716 char *pkg_home = NULL;
717 pkg_home = vconf_get_str(VCONF_PKG_PATH);
719 _DBG("pkghome [%s]", pkg_home);
720 ret = preference_set_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_PKG_HOME, pkg_home);
721 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_PKG_HOME [%d]", ret);
724 /*vconf_get_int(VCONF_FAKE_KEY, &val); */
725 /*ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_FAKE_EFFECT, val); */
726 /*setting_retm_if(ret != PREFERENCE_ERROR_NONE, "*** [ERR] PREFKEY_SAVINGPOWER_NORMAL_BACKUP_FAKE_EFFECT ***"); */
729 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_GRAYTONE, &val);
730 _DBG("VCONFKEY_SETAPPL_WINDOW_GRAYTONE [%d]", val);
731 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GRAYTONE, val);
732 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GRAYTONE [%d]", ret);
735 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_FPS, &val);
736 _DBG("VCONFKEY_SETAPPL_WINDOW_FPS [%d]", val);
737 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_FPS, val);
738 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_FPS [%d]", ret);
741 vconf_get_int(VCONFKEY_LOCATION_ENABLED, &val);
742 _DBG("VCONFKEY_LOCATION_ENABLED [%d]", val);
743 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GPS, val);
744 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GPS [%d]", ret);
746 /*touch key ligh duration */
747 vconf_get_int(VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION, &val);
748 _DBG("VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION [%d]", val);
749 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TOUCH_KEY_LIGHT, val);
750 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TOUCH_KEY_LIGHT [%d]", ret);
752 /*end for power saving profile */
754 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LED_INDICATOR_NOTI, val);
755 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LED_INDICATOR_NOTI [%d]", ret);
757 /*Net-restriction mode - syspopup #20 */
758 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, &val);
759 _DBG("VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE [%d]", val);
760 ret = preference_set_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_NET_RESRICT_MODE, val);
761 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_NET_RESRICT_MODE [%d]", ret);
763 /*default power saving need 1 time */
764 ret = preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, &val);
765 _DBG("PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR : ret [%d], val [%d]", ret, val);
766 if (ret != PREFERENCE_ERROR_NONE) {
767 preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, 1);
771 void _mode_power_backup_settings(void *data)
774 struct appdata *ad = data;
781 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &val);
782 _DBG("VCONFKEY_SETAPPL_PSMODE [%d]", val);
783 ret = preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_PSMODE, val);
784 _DBG("PREFKEY_SAVINGPOWER_BACKUP_PSMODE [%d]", ret);
787 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &val);
788 _DBG("VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU [%d]", val);
789 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_CPU_PERF, val);
790 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_CPU_PERF [%d]", ret);
792 /*Wallpaper change */
793 str1 = vconf_get_str(VCONF_HOMESCREEN_PATH);
794 ret = preference_set_string(PREFKEY_SAVINGPOWER_POWER_BACKUP_HOMESCREEN_PATH, str1);
795 /*setting_retm_if(ret != PREFERENCE_ERROR_NONE, "*** [ERR] PREFKEY_SAVINGPOWER_POWER_BACKUP_HOMESCREEN_PATH ***"); */
797 str2 = vconf_get_str(VCONF_LOCKSCREEN_PATH);
798 ret = preference_set_string(PREFKEY_SAVINGPOWER_POWER_BACKUP_LOCKSCREEN_PATH, str2);
799 /*setting_retm_if(ret != PREFERENCE_ERROR_NONE, "*** [ERR] PREFKEY_SAVINGPOWER_POWER_BACKUP_LOCKSCREEN_PATH ***"); */
803 vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &val);
804 _DBG("VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL [%d]", val);
805 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_TIMEOUT, val);
806 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_TIMEOUT [%d]", ret);
807 /*Auto Brightness : ON/OFF */
808 vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &val);
809 _DBG("VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT [%d]", val);
810 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_BRIGHT, val);
811 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_BRIGHT [%d]", ret);
813 vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &val);
814 _DBG("VCONFKEY_SETAPPL_LCD_BRIGHTNESS [%d]", val);
815 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_BRIGHT, val);
816 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_BRIGHT [%d]", ret);
817 /*Auto rotate screen */
818 vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &val);
819 _DBG("VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL [%d]", val);
820 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_ROTATE, val);
821 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_ROTATE [%d]", ret);
824 vconf_get_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, &val);
825 _DBG("VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL [%d]", val);
826 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_HAPTIC_FEEDBACK, val); /*on/off */
827 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_HAPTIC_FEEDBACK [%d]", ret);
829 /*Launching effect */
830 launching_effect_get(ad->win, &val);
831 _DBG("launching_effect_get [%d]", val);
832 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_LAUNCH_EFFECT, val);
833 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_LAUNCH_EFFECT [%d]", ret);
835 /*pkg backup : cluster or easy */
836 char *pkg_home = NULL;
837 pkg_home = vconf_get_str(VCONF_PKG_PATH);
839 _DBG("pkghome [%s]", pkg_home);
840 ret = preference_set_string(PREFKEY_SAVINGPOWER_POWER_BACKUP_PKG_HOME, pkg_home);
841 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_PKG_HOME [%d]", ret);
845 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_GRAYTONE, &val);
846 _DBG("VCONFKEY_SETAPPL_WINDOW_GRAYTONE [%d]", val);
847 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_GRAYTONE, val);
848 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_GRAYTONE [%d]", ret);
851 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_FPS, &val);
852 _DBG("VCONFKEY_SETAPPL_WINDOW_FPS [%d]", val);
853 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_FPS, val);
854 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_FPS [%d]", ret);
857 vconf_get_int(VCONFKEY_LOCATION_ENABLED, &val);
858 _DBG("VCONFKEY_LOCATION_ENABLED [%d]", val);
859 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_GPS, val);
860 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_GPS [%d]", ret);
862 /*touch key ligh duration */
863 vconf_get_int(VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION, &val);
864 _DBG("VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION [%d]", val);
865 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_TOUCH_KEY_LIGHT, val);
866 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_TOUCH_KEY_LIGHT [%d]", ret);
868 /*end for power saving profile */
870 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_LED_INDICATOR_NOTI, val);
871 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_LED_INDICATOR_NOTI [%d]", ret);
873 /*Net-restriction mode - syspopup #20 */
874 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, &val);
875 _DBG("VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE [%d]", val);
876 ret = preference_set_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_NET_RESRICT_MODE, val);
877 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_NET_RESRICT_MODE [%d]", ret);
881 void _mode_apply_settings(void *data, int *set)
884 struct appdata *ad = data;
885 int val, crt_val, ret;
888 /*/////////////////////////////// */
889 /* power saving mode content order */
890 /*/////////////////////////////// */
892 /*Haptic feedback #1 */
893 vconf_get_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, &crt_val);
896 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HAPTIC_FEEDBACK, &val);
897 } else if (val == -2) {
898 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_HAPTIC_FEEDBACK, &val);
900 if (val != crt_val) {
901 vconf_set_bool(VCONFKEY_SETAPPL_HAPTIC_FEEDBACK_STATUS_BOOL, val);
902 _DBG("set haptic feedback : %d", val);
905 /*Launching effect #2 */
906 launching_effect_get(ad->win, &crt_val);
909 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LAUNCH_EFFECT, &val);
912 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_LAUNCH_EFFECT, &val);
914 if (val != crt_val) {
915 launching_effect_set(ad->win, val);
916 _DBG("set launching effect %d", val);
920 vconf_get_int(VCONFKEY_LOCATION_ENABLED, &crt_val);
921 _DBG("get GPS %d", crt_val);
924 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GPS, &val);
925 _DBG("get GPS %d", val);
928 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_GPS, &val);
929 _DBG("get GPS %d", val);
931 if (val != crt_val) {
932 vconf_set_int(VCONFKEY_LOCATION_ENABLED, val);
933 _DBG("set GPS %d", val);
937 /*add check auto brightness routine */
938 vconf_get_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, &crt_val);
942 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_BRIGHT, &auto_br);
946 _DBG("check1 auto_br [%d]", auto_br);
947 if (auto_br == SETTING_BRIGHTNESS_AUTOMATIC_ON) {
948 /*prev : auto on, fix to auto status last */
949 ret = vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON);
951 } else if (auto_br == SETTING_BRIGHTNESS_AUTOMATIC_OFF) {
952 /*auto to off and set bright */
953 ret = vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF);
954 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_BRIGHT, &val);
956 } else if (val == -2) {
958 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_BRIGHT, &auto_br);
962 _DBG("check1 auto_br [%d]", auto_br);
963 if (auto_br == SETTING_BRIGHTNESS_AUTOMATIC_ON) {
964 /*prev : auto on, fix to auto status last */
965 ret = vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_ON);
967 } else if (auto_br == SETTING_BRIGHTNESS_AUTOMATIC_OFF) {
968 /*auto to off and set bright */
969 ret = vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF);
970 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_BRIGHT, &val);
973 /*normal to power saving or emergency(val != -1), get auto brightness off */
974 ret = vconf_set_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, SETTING_BRIGHTNESS_AUTOMATIC_OFF);
977 if (val != -1 && val != -2) {
978 ret = display_set_brightness_with_setting(val);
979 _DBG("set Brightness %d, ret = %d", val, ret);
980 ret = vconf_set_int(VCONFKEY_SETAPPL_LCD_BRIGHTNESS, val);
983 /*Auto rotate screen #5 */
984 vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &crt_val);
987 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_AUTO_ROTATE, &val);
990 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_AUTO_ROTATE, &val);
992 if (val != crt_val) {
993 vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, val);
994 _DBG("set Auto rotate screen %d", val);
998 vconf_get_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, &crt_val);
1001 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TIMEOUT, &val);
1004 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_TIMEOUT, &val);
1006 if (val != crt_val) {
1007 vconf_set_int(VCONFKEY_SETAPPL_LCD_TIMEOUT_NORMAL, val);
1008 _DBG("set time out %d", val);
1011 /*Touch key light duration #8 */
1012 vconf_get_int(VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION, &crt_val);
1013 _DBG("VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION %d", crt_val);
1016 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TOUCH_KEY_LIGHT, &val);
1017 _DBG("PREFKEY_SAVINGPOWER_NORMAL_BACKUP_TOUCH_KEY_LIGHT %d", val);
1020 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_TOUCH_KEY_LIGHT, &val);
1021 _DBG("PREFKEY_SAVINGPOWER_POWER_BACKUP_TOUCH_KEY_LIGHT %d", val);
1023 if (val != crt_val) {
1024 vconf_set_int(VCONFKEY_SETAPPL_TOUCHKEY_LIGHT_DURATION, val);
1025 _DBG("set Touch key light duration %d", val);
1028 /*gray scale tone #9 */
1029 /*gray scale tone for power saving mode! */
1030 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_GRAYTONE, &crt_val);
1033 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_GRAYTONE, &val);
1036 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_GRAYTONE, &val);
1038 if (val != crt_val) {
1039 vconf_set_bool(VCONFKEY_SETAPPL_WINDOW_GRAYTONE, val);
1040 _DBG("set gray scale tone %d", val);
1043 /*CPU max freq #10 */
1044 /*cpu limit on for power saving mode! */
1045 vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &crt_val);
1048 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_CPU_PERF, &val);
1051 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_CPU_PERF, &val);
1054 if (val != crt_val) {
1055 vconf_set_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, val);
1056 _DBG("set CPU frequency limit %d", val);
1059 /*Screen Output (D.FPS) #11 */
1060 /*screen output for power saving mode! */
1061 vconf_get_bool(VCONFKEY_SETAPPL_WINDOW_FPS, &crt_val);
1064 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_FPS, &val);
1067 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_FPS, &val);
1069 if (val != crt_val) {
1070 vconf_set_bool(VCONFKEY_SETAPPL_WINDOW_FPS, val);
1071 _DBG("set FPS %d", val);
1074 /*Eco. wallpaper (Wallpaper change) #12 */
1080 crt_str1 = vconf_get_str(VCONF_HOMESCREEN_PATH);
1081 crt_str2 = vconf_get_str(VCONF_LOCKSCREEN_PATH);
1083 ret = preference_get_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HOMESCREEN_PATH, &str1);
1084 ret = preference_get_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_LOCKSCREEN_PATH, &str2);
1085 } else if (val == -2) {
1086 ret = preference_get_string(PREFKEY_SAVINGPOWER_POWER_BACKUP_HOMESCREEN_PATH, &str1);
1087 ret = preference_get_string(PREFKEY_SAVINGPOWER_POWER_BACKUP_LOCKSCREEN_PATH, &str2);
1088 } else { /* value ==1 and other cases -> set to default value */
1089 str1 = strdup(HOMESCREEN_FILE);
1090 str2 = strdup(LOCKSCREEN_FILE);
1094 if (strcmp(str1, crt_str1) != 0) {
1095 vconf_set_str(VCONF_HOMESCREEN_PATH, str1);
1096 _DBG("set eco home screen wallpaper");
1100 if (strcmp(str2, crt_str2) != 0) {
1101 vconf_set_str(VCONF_LOCKSCREEN_PATH, str2);
1102 _DBG("set eco lock screen wallpaper");
1110 /*END of the Power saving profile set */
1112 /*pkghome -for HOMESCREEN #13 */
1114 char *crt_str = NULL;
1116 crt_str = vconf_get_str(VCONF_PKG_PATH);
1119 vconf_get_bool(VCONFKEY_SETAPPL_HOMESCREEN_EASYMODE_BOOL, &chk_easy);
1121 /*easy-mode :on -> off mode did not go back to current, just keep easy home state */
1122 str = strdup(PKG_EASYHOME); /*get curren pkg home path -> easy-mode */
1124 /*off on easy-mode */
1125 /*ret = preference_get_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_PKG_HOME, &str); */
1126 str = strdup(PKG_CLUSTERHOME);
1128 } else if (val == -2) {
1130 vconf_get_bool(VCONFKEY_SETAPPL_HOMESCREEN_EASYMODE_BOOL, &chk_easy);
1132 /*easy-mode :on -> off mode did not go back to current, just keep easy home state */
1133 str = strdup(PKG_EASYHOME); /*get curren pkg home path -> easy-mode */
1135 /*off on easy-mode */
1136 /*ret = preference_get_string(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_PKG_HOME, &str); */
1137 str = strdup(PKG_CLUSTERHOME);
1139 } else if (val == 1) {
1140 str = strdup(PKG_EMERGENCY);
1144 if (str != NULL && strcmp(str, crt_str) != 0) {
1145 vconf_set_str(VCONF_PKG_PATH, str);
1151 /*ENDOF POWER SAVING PROFILES */
1156 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_HANDS_FREE_MODE, &val);
1159 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_HANDS_FREE_MODE, &val);
1162 /*Net-restriction mode - syspopup #20 */
1163 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, &crt_val);
1166 ret = preference_get_int(PREFKEY_SAVINGPOWER_NORMAL_BACKUP_NET_RESRICT_MODE, &val);
1169 ret = preference_get_int(PREFKEY_SAVINGPOWER_POWER_BACKUP_NET_RESRICT_MODE, &val);
1172 if (val != crt_val) {
1173 vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, val);
1174 /*todo mode-syspopup */
1175 _DBG("set Net-restriction mode %d", val);
1178 /*mini app terminate - syspopup #21 */
1181 _DBG("emergency terminate mini");
1182 _terminate_miniapp(ad);
1186 /*///////////////// */
1187 /*/ blocking mode /// */
1188 /*///////////////// */
1190 /* rotation policy with lock screen */
1191 static void lcd_state_changed(keynode_t *key, void *data)
1194 struct appdata *ad = data;
1199 state = vconf_keynode_get_int(key);
1200 if (state != VCONFKEY_PM_STATE_LCDOFF)
1203 if (vconf_ignore_key_changed(VCONFKEY_PM_STATE, lcd_state_changed) != 0)
1204 _DBG("vconf key ignore failed");
1210 static void __def_response_cb(void *data, Evas_Object *obj,
1213 _DBG(" REMOVE THE POPUP OBJECT BY THIS FUNCTION ");
1215 evas_object_del(obj);
1220 void __popup_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
1222 _DBG("__popup_del_cb");
1224 Ecore_X_Display *disp = ecore_x_display_get();
1225 Ecore_X_Window xwin = elm_win_xwindow_get(obj);
1226 int ret = utilx_ungrab_key(disp, xwin, KEY_HOME);
1228 _DBG("KEY_HOME ungrab error ret[%d]", ret);
1231 ret = utilx_ungrab_key(disp, xwin, KEY_BACK);
1233 _DBG("KEY_BACK ungrab error ret[%d]", ret);
1236 ret = utilx_ungrab_key(disp, xwin, KEY_POWER);
1238 _DBG("KEY_POWER ungrab error ret[%d]", ret);
1241 ret = utilx_ungrab_key(disp, xwin, KEY_VOLUMEUP);
1243 _DBG("KEY_VOLUMEUP ungrab error ret[%d]", ret);
1246 ret = utilx_ungrab_key(disp, xwin, KEY_VOLUMEDOWN);
1248 _DBG("KEY_VOLUMEDOWN ungrab error ret[%d]", ret);
1253 static void __popup_event_set(Evas_Object *popup, void *data,
1254 _cb_func response_cb,
1255 int timeout,/*to control the timeout time */
1256 bool blocked_flag,/*to control whether to block the screen */
1257 bool keygrab_flag/*to control whether to block the 'Home key' */
1260 _DBG("__popup_event_set");
1263 evas_object_smart_callback_add(popup, "timeout", response_cb, data);
1265 evas_object_smart_callback_add(popup, "timeout", __def_response_cb, data);
1269 if (!blocked_flag) {/*not blocked_flag == TRUE !!! */
1271 evas_object_smart_callback_add(popup, "block,clicked", response_cb, data);
1273 evas_object_smart_callback_add(popup, "block,clicked", __def_response_cb, data);
1279 Ecore_X_Display *disp = ecore_x_display_get();
1280 Ecore_X_Window xwin = elm_win_xwindow_get(popup);
1281 int ret = utilx_grab_key(disp, xwin, KEY_HOME, TOP_POSITION_GRAB);
1283 _DBG("KEY_HOME grab error ret[%d]", ret);
1286 ret = utilx_grab_key(disp, xwin, KEY_BACK, TOP_POSITION_GRAB);
1288 _DBG("KEY_BACK grab error ret[%d]", ret);
1291 ret = utilx_grab_key(disp, xwin, KEY_POWER, TOP_POSITION_GRAB);
1293 _DBG("KEY_POWER grab error ret[%d]", ret);
1296 ret = utilx_grab_key(disp, xwin, KEY_VOLUMEUP, TOP_POSITION_GRAB);
1298 _DBG("KEY_VOLUMEUP grab error ret[%d]", ret);
1301 ret = utilx_grab_key(disp, xwin, KEY_VOLUMEDOWN, TOP_POSITION_GRAB);
1303 _DBG("KEY_VOLUMEDOWN grab error ret[%d]", ret);
1306 evas_object_event_callback_add(popup, EVAS_CALLBACK_DEL, __popup_del_cb, NULL);
1310 static Evas_Object *__add_progressbar(void *data, Evas_Object *parent,
1311 char *progressbar_style,
1312 char *progressbar_title,
1313 char *progressbar_lable)
1315 _DBG("__add_progressbar");
1318 Evas_Object *progressbar;
1320 Evas_Object *layout;
1322 ad = (struct appdata *) data;
1323 popup = ea_center_popup_add(parent);
1325 layout = elm_layout_add(popup);
1326 elm_layout_file_set(layout, POPUP_EDJ, "popup_processingview_1button"); /*u can use add button or not */
1327 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1329 /* [UI] progress icon */
1330 progressbar = elm_progressbar_add(popup);
1331 elm_progressbar_pulse(progressbar, EINA_TRUE);
1332 elm_object_style_set(progressbar, progressbar_style);
1333 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
1334 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
1335 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1336 evas_object_show(progressbar);
1338 elm_object_part_content_set(layout, "elm.swallow.content", progressbar);
1340 elm_object_part_text_set(layout, "elm.text", progressbar_lable);
1342 elm_object_content_set(popup, layout);
1346 Evas_Object *progressbar;
1347 Evas_Object *layout;
1351 popup = elm_popup_add(parent);
1352 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1354 Evas_Object *box = elm_box_add(popup);
1355 elm_box_horizontal_set(box, EINA_TRUE);
1356 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1357 evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
1358 elm_box_align_set(box, 0.5, 0.5);
1359 elm_box_padding_set(box, 16, 0);
1361 progressbar = elm_progressbar_add(popup);
1362 elm_progressbar_pulse(progressbar, EINA_TRUE);
1363 elm_object_style_set(progressbar, "process_large");
1364 evas_object_show(progressbar);
1365 elm_box_pack_end(box, progressbar);
1367 label = elm_label_add(popup);
1368 elm_object_text_set(label, progressbar_lable);
1369 evas_object_show(label);
1370 elm_box_pack_end(box, label);
1372 Evas_Object *table = elm_table_add(popup);
1373 evas_object_show(table);
1374 elm_table_homogeneous_set(table, EINA_FALSE);
1376 Evas_Object *rect_up;
1377 rect_up = evas_object_rectangle_add(evas_object_evas_get(popup));
1378 evas_object_size_hint_min_set(rect_up, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(32));
1380 Evas_Object *rect_down;
1381 rect_down = evas_object_rectangle_add(evas_object_evas_get(popup));
1382 evas_object_size_hint_min_set(rect_down, ELM_SCALE_SIZE(100), ELM_SCALE_SIZE(37));
1385 elm_table_pack(table, rect_up, 0, 0, 1, 1);/* rect as a padding */
1386 elm_table_pack(table, box, 0, 1, 1, 1);
1387 elm_table_pack(table, rect_down, 0, 2, 1, 1);/* rect as a padding */
1388 evas_object_show(box);
1389 elm_object_content_set(popup, table);
1391 evas_object_show(popup);
1395 static Evas_Object *__add_double_line_progressbar(void *data, Evas_Object *parent,
1396 char *progressbar_style,
1397 char *progressbar_title,
1398 char *progressbar_lable)
1400 _DBG("__add_double_line_progressbar");
1403 Evas_Object *layout;
1404 Evas_Object *progressbar = NULL;
1405 popup = ea_center_popup_add(parent);
1406 /* [UI] add lable */
1407 if (progressbar_lable) {
1408 label = elm_label_add(popup);
1409 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
1410 elm_object_text_set(label, _(progressbar_lable));
1411 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
1412 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
1413 evas_object_show(label);
1415 layout = elm_layout_add(popup);
1416 elm_layout_file_set(layout, POPUP_EDJ, "popup_processingview");
1417 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1419 /* [UI] progress icon */
1420 if (progressbar_style) {
1421 progressbar = elm_progressbar_add(popup);
1422 elm_progressbar_pulse(progressbar, EINA_TRUE);
1423 elm_object_style_set(progressbar, progressbar_style);
1424 elm_progressbar_horizontal_set(progressbar, EINA_TRUE);
1425 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
1426 evas_object_size_hint_weight_set(progressbar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1427 evas_object_show(progressbar);
1430 elm_object_part_content_set(layout, "elm.swallow.content", progressbar);
1431 elm_object_part_content_set(layout, "elm.swallow.text", label);
1433 elm_object_content_set(popup, layout);
1438 Evas_Object *__popup_with_progressbar(void *data, Evas_Object *popup,
1439 Evas_Object *parent,
1440 char *progressbar_style,
1443 _cb_func response_cb,
1447 bool dobule_line_flag)
1449 if (dobule_line_flag) {
1450 popup = __add_double_line_progressbar(data, parent, progressbar_style,
1453 popup = __add_progressbar(data, parent, progressbar_style,
1455 elm_object_style_set(popup, "no_effect");
1459 elm_popup_timeout_set(popup, timeout);
1461 __popup_event_set(popup, data, response_cb, timeout, blocked_flag, keygrab_flag);
1462 evas_object_show(popup);
1466 Evas_Object *_create_bg(Evas_Object *parent, Evas_Object *win, const char *bg_style)
1469 if (parent == NULL) {
1472 Evas_Object *bg = elm_bg_add(parent);
1477 elm_object_style_set(bg, bg_style);
1478 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
1480 elm_win_resize_object_add(parent, bg); /*regarding window resize */
1481 /*elm_bg_file_set(bg, DEFAULT_BG_PATH, NULL); */
1482 evas_object_show(bg);
1486 char *mode_syspopup_gettext(const char *s)
1488 /* fisrt find in app pg */
1493 char *p = dgettext(PACKAGE, s);
1495 if (p && !strcmp(s, p)) { /* not found */
1496 /* find in system pkg */
1497 p = dgettext("sys_string", s);
1500 if (p && !strcmp(s, p)) { /* not found */
1501 /* find in system pkg */
1502 p = dgettext("setting", s);
1507 int myterm(bundle *b, void *data)
1512 int mytimeout(bundle *b, void *data)
1517 syspopup_handler handler = {
1518 .def_term_fn = myterm,
1519 .def_timeout_fn = mytimeout
1522 /* Release evas object */
1523 void release_evas_object(Evas_Object **obj)
1525 if (!obj || !(*obj))
1527 evas_object_del(*obj);
1532 static void ea_popup_back_cb_overide(void *data, Evas_Object *obj, void *event_info)
1534 ea_popup_back_cb(data, obj, event_info);
1536 if (NULL == data) return;
1537 struct appdata *ad = data;
1538 __mode_syspopup_app_terminate(ad);
1541 static void timeout_response_cb(void *data, Evas_Object *obj, void *event_info)
1543 ea_popup_back_cb(data, obj, event_info);
1545 if (NULL == data) return;
1546 struct appdata *ad = data;
1549 evas_object_del(ad->popup);
1552 __mode_syspopup_app_terminate(ad);
1555 static void __progress_popup_cb(void *data, Evas_Object *obj, void *event_info)
1557 if (NULL == data) return;
1558 struct appdata *ad = data;
1559 _DBG("progress popup cb");
1561 /* have operating delay in emergency to cluster, exit point was after progress */
1562 if (vconf_ignore_key_changed(VCONFKEY_PM_STATE, lcd_state_changed) != 0)
1563 _DBG("vconf key ignore failed");
1565 is_recovery = false;
1567 /*refresh indicator */
1568 __mode_reboot_noti_method();
1574 play_timeout_update_cb(void *data)
1576 if (NULL == data) return EINA_FALSE;
1577 struct appdata *ad = data;
1578 play_text(ad, _("IDS_ST_BODY_A_PERSON_YOU_HAVE_GRANTED_AUTHORITY_TO_IS_TRYING_TO_REMOTELY_ENABLE_EMERGENCY_MODE_ON_THIS_DEVICE_MSG"));
1579 ad->play_timer = NULL;
1584 static void __mode_syspopup_emergency_cb(void *data, Evas_Object *obj, void *event_info)
1586 struct appdata *ad = data;
1591 /*delete old help */
1592 if (ad->help_type != HELP_NONE) {
1593 if (ad->help_circle) {
1594 evas_object_del(ad->help_circle);
1595 ad->help_circle = NULL;
1597 if (ad->help_popup) {
1598 evas_object_del(ad->help_popup);
1599 ad->help_popup = NULL;
1603 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1604 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1605 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK")) || !strcmp(btn_str, _("IDS_ST_BUTTON_ENABLE"))) {
1606 /*make complete flag */
1607 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
1608 if (ret) _ERR("check export xml");
1611 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
1612 if (m_key == SETTING_PSMODE_NORMAL) {
1614 _mode_backup_settings(ad);
1615 } else if (m_key == SETTING_PSMODE_POWERFUL) {
1617 _mode_power_backup_settings(ad);
1619 release_evas_object(&(ad->popup));
1620 ad->bg = _create_bg(ad->win, NULL, "group_list");
1622 ad->enable_popup = __popup_with_progressbar(ad, ad->enable_popup, ad->win, PROGRESSBAR_STYLE,
1623 NULL, _("IDS_ST_POP_ENABLING_EMERGENCY_MODE_ING"), __progress_popup_cb, 3/*0*/, TRUE, TRUE, TRUE); /* 2 seconds to wait in maximum */
1625 /*assistive light off, P140422-06240 */
1626 ret = led_set_brightness_with_noti(0, TRUE);
1628 _DBG(">>>led SET TO ZERO err [%d]", ret);
1630 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
1632 _DBG("*** [ERR] Failed to disable popup off reminder %d***", ret);
1637 _mode_apply_settings(ad, emergency_settings);
1639 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_EMERGENCY) == 0) {
1640 _DBG("set on SETTING_PSMODE_EMERGENCY");
1643 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1650 /*evas_object_del(ad->win); */
1653 static void __mode_syspopup_powerful_cb(void *data, Evas_Object *obj, void *event_info)
1655 struct appdata *ad = data;
1660 /*delete old help */
1661 if (ad->help_type != HELP_NONE) {
1662 if (ad->help_circle) {
1663 evas_object_del(ad->help_circle);
1664 ad->help_circle = NULL;
1666 if (ad->help_popup) {
1667 evas_object_del(ad->help_popup);
1668 ad->help_popup = NULL;
1672 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1673 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1674 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1676 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
1677 if (m_key == SETTING_PSMODE_NORMAL) {
1679 _mode_backup_settings(ad);
1683 int ret = preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, &first);
1686 _mode_apply_settings(ad, powerful_settings_def);
1687 preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, 0);
1689 _mode_apply_settings(ad, powerful_settings);
1690 _DBG("right to set powerful");
1692 /* set to default */
1694 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
1695 if (ret) _DBG("vconf_get_bool failed");
1696 /*emergency mode -> normal */
1697 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_POWERFUL) == 0) {
1698 _DBG("set on SETTING_PSMODE_POWERFUL");
1700 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1703 /*evas_object_del(ad->win); */
1708 static void __mode_syspopup_netrestrictionmode_change_on_cb(void *data, Evas_Object *obj, void *event_info)
1710 struct appdata *ad = data;
1715 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1716 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1718 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1721 if (vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, 1) == 0) {
1722 _DBG("network_restrict_mode vconf set 1");
1724 _DBG("network_restrict_mode vconf set failed");
1726 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1727 _DBG("Cancel button");
1735 static void __mode_syspopup_netrestrictionmode_change_off_cb(void *data, Evas_Object *obj, void *event_info)
1737 struct appdata *ad = data;
1742 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1743 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1745 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1748 if (vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, 0) == 0) {
1749 _DBG("network_restrict_mode vconf set 0");
1751 _DBG("network_restrict_mode vconf set failed");
1753 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1754 _DBG("Cancel button");
1762 static void __mode_syspopup_normal_cb(void *data, Evas_Object *obj, void *event_info)
1764 _DBG("__mode_syspopup_normal_cb");
1765 struct appdata *ad = data;
1770 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1771 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1772 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK")) || !strcmp(btn_str, _("IDS_ST_BUTTON_DISABLE"))) {
1773 /*using normal cb as 1) emergency -> normal or 2) emergency -> powerful , after[K] concept back_mode needed */
1775 preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_PSMODE, &back_mode);
1778 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
1779 if (m_key == SETTING_PSMODE_POWERFUL) {
1781 _mode_power_backup_settings(ad);
1783 /*evas_object_hide(ad->popup); */
1784 release_evas_object(&(ad->popup));
1785 ad->bg = _create_bg(ad->win, NULL, "group_list");
1787 ad->disable_popup = __popup_with_progressbar(ad, ad->disable_popup, ad->win, PROGRESSBAR_STYLE,
1788 NULL, _(KeyStr_Loading), __progress_popup_cb, 3/*0*/, TRUE, TRUE, FALSE); /* 2 seconds to wait in maximum */
1792 if (back_mode == SETTING_PSMODE_NORMAL) {
1793 /*make complete flag */
1794 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
1795 if (ret) _ERR("check export xml");
1796 /*torch light off with diable emergency/ups mode, P140507-03841 */
1797 int t_ret = led_set_brightness_with_noti(0, TRUE);
1799 _DBG(">>>led SET TO ZERO err [%d]", t_ret);
1801 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
1803 _DBG("*** [ERR] Failed to disable popup off reminder %d***", t_ret);
1806 int b_network_lcd_off;
1807 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, &b_network_lcd_off);
1808 if (b_network_lcd_off) {
1809 vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, EINA_FALSE);
1811 _mode_apply_settings(ad, normal_settings);
1815 if (back_mode == SETTING_PSMODE_POWERFUL) {
1818 int ret = preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, &first);
1820 _mode_apply_settings(ad, powerful_settings_def);
1821 preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, 0);
1823 _mode_apply_settings(ad, powerful_settings);
1824 _DBG("right to set powerful");
1828 /* set to default */
1831 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
1832 if (ret) _DBG("vconf_get_bool failed");
1833 if (back_mode == SETTING_PSMODE_NORMAL) {
1834 /*emergency mode -> normal */
1835 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_NORMAL) == 0) {
1836 _DBG("set on SETTING_PSMODE_NORMAL");
1838 } else if (back_mode == SETTING_PSMODE_POWERFUL) {
1839 /*emergency mode -> power saving */
1840 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_POWERFUL) == 0) {
1841 _DBG("set on SETTING_PSMODE_POWERFUL");
1848 if (ad->lcd_freq_timer) {
1849 ecore_timer_del(ad->lcd_freq_timer);
1850 ad->lcd_freq_timer = NULL;
1852 ad->is_lcd_ctrl = EINA_FALSE;
1853 ad->lcd_freq_timer = ecore_timer_add(2.7, (Ecore_Task_Cb)_LCD_freq_ctrl_handler, ad);
1857 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1864 /*evas_object_del(ad->win); */
1867 static void __mode_blockingmode_popup_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data)
1869 struct appdata *ad = data;
1870 _DBG("__mode_blockingmode_popup_cb");
1872 evas_object_del(ad->popup);
1877 static void __mode_syspopup_blockingmode_cb(void *data, Evas_Object *obj, void *event_info)
1879 struct appdata *ad = data;
1884 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1885 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1886 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1889 app_control_h app_control = NULL;
1890 app_control_create(&app_control);
1891 if (app_control == NULL) {
1892 _DBG("the app_control is NULL");
1897 ret = app_control_set_app_id(app_control, "setting-blockingmode-efl");
1898 if (ret != APP_CONTROL_ERROR_NONE) {
1899 _DBG("app_control_set_app_id fail : %d", ret);
1901 app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1902 ret = app_control_send_launch_request(app_control, NULL, NULL);
1903 if (ret != APP_CONTROL_ERROR_NONE) {
1904 _DBG("app_control_send_launch_request fail : %d", ret);
1906 app_control_destroy(app_control);
1907 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1911 evas_object_del(ad->popup);
1914 /*evas_object_del(ad->win); */
1919 static void __mode_syspopup_drivingmode_cb(void *data, Evas_Object *obj, void *event_info)
1921 struct appdata *ad = data;
1926 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1927 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1928 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1931 app_control_h app_control = NULL;
1932 app_control_create(&app_control);
1933 if (app_control == NULL) {
1934 _DBG("the app_control is NULL");
1939 ret = app_control_set_app_id(app_control, "setting-drivingmode-efl");
1940 if (ret != APP_CONTROL_ERROR_NONE) {
1941 _DBG("app_control_set_app_id fail : %d", ret);
1943 app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
1944 ret = app_control_send_launch_request(app_control, NULL, NULL);
1945 if (ret != APP_CONTROL_ERROR_NONE) {
1946 _DBG("app_control_send_launch_request fail : %d", ret);
1948 app_control_destroy(app_control);
1949 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
1953 evas_object_del(ad->popup);
1956 /*evas_object_del(ad->win); */
1962 static void __mode_syspopup_mobiledata_cb(void *data, Evas_Object *obj, void *event_info)
1964 struct appdata *ad = data;
1969 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
1970 setting_retm_if(NULL == btn_str, "btn_str is NULL");
1971 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK"))) {
1975 if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_MOBILEDATA_ON)) {
1976 /*enable mobile data */
1977 ret = vconf_set_bool(VCONFKEY_3G_ENABLE, 1);
1979 _DBG("*** [ERR] Failed to enable mobile data with error code %d***", ret);
1981 if (ad->popup_chk && elm_check_state_get(ad->popup_chk)) {
1982 ret = vconf_set_bool(VCONFKEY_SETAPPL_MOBILE_DATA_ON_REMINDER, 0);
1984 _DBG("*** [ERR] Failed to disable popup on reminder %d***", ret);
1989 /*disable mobile data*/
1990 ret = vconf_set_bool(VCONFKEY_3G_ENABLE, 0);
1992 _DBG("*** [ERR] Failed to enable mobile data with error code %d***", ret);
1994 if (ad->popup_chk && elm_check_state_get(ad->popup_chk)) {
1995 ret = vconf_set_bool(VCONFKEY_SETAPPL_MOBILE_DATA_OFF_REMINDER, 0);
1997 _DBG("*** [ERR] Failed to disable popup off reminder %d***", ret);
2002 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
2010 static void __mode_syspopup_flightmode_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
2012 _DBG("flight mode result:%d", result);
2016 static void __mode_syspopup_flightmode_cb(void *data, Evas_Object *obj, void *event_info)
2018 struct appdata *ad = data;
2023 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
2024 setting_retm_if(NULL == btn_str, "btn_str is NULL");
2025 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK")) || !strcmp(btn_str, _("IDS_ST_BUTTON_ENABLE"))) {
2029 TapiHandle *tapi_handle = tel_init(NULL);
2031 _DBG("*** [ERR] tel_init failed ***");
2038 vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall_state);
2039 if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_FLIGHTMODE_ON)) {
2040 /*enable flight mode on*/
2041 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, __mode_syspopup_flightmode_tapi_event_cb, ad);
2042 if (ret != TAPI_API_SUCCESS) {
2043 _DBG("*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2047 if (firewall_state) {
2048 mode_remove_noti(ad, "setting-firewall-efl");
2051 /*disable flight mode*/
2052 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, __mode_syspopup_flightmode_tapi_event_cb, ad);
2053 if (ret != TAPI_API_SUCCESS) {
2054 _DBG("*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2056 if (firewall_state) {
2057 mode_create_noti(ad, "IDS_ST_BODY_CONFIGURE_FIREWALL_SETTINGS", "setting-firewall-efl", "IDS_ST_BODY_FIREWALL_ENABLED_ABB");
2061 if ((ret = tel_deinit(tapi_handle)) != TAPI_API_SUCCESS) {
2062 _DBG("failed to deinitialized tapi handler:%d", ret);
2065 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
2069 /*evas_object_del(ad->win); */
2075 static void _text_rotation_changed(void *data, Evas_Object *obj, void *event_info)
2078 Evas_Object *win = obj;
2079 Evas_Object *layout = data;
2081 rot = elm_win_rotation_get(win);
2082 if (rot == 90 || rot == 270)
2083 elm_layout_file_set(layout, POPUP_EDJ, "label_layout_landscape");
2085 elm_layout_file_set(layout, POPUP_EDJ, "label_layout");
2088 static Eina_Bool _help_handler(void *data)
2090 struct appdata *ad = data;
2091 Evas_Coord_Rectangle rect = {0,};
2092 evas_object_geometry_get(ad->help_eo, &rect.x, &rect.y, &rect.w, &rect.h);
2093 if (ad->help_type != HELP_NONE) {
2094 syspop_help_popup_circle_block_create(ad->win, ad->popup,
2095 &ad->help_circle, &ad->help_popup,
2096 _(MODE_SYSTEM_POPUP_MSG),
2097 rect.x + rect.w / 2, rect.y + rect.h / 2, &rect);
2099 ad->help_timer = NULL;
2103 static void _help_rotation_changed(void *data, Evas_Object *obj, void *event_info)
2105 struct appdata *ad = (struct appdata *)data;
2106 /*delete old help */
2107 if (ad->help_circle) {
2108 evas_object_del(ad->help_circle);
2109 ad->help_circle = NULL;
2111 if (ad->help_popup) {
2112 evas_object_del(ad->help_popup);
2113 ad->help_popup = NULL;
2116 if (ad->help_type != HELP_NONE) {
2117 if (ad->help_timer) {
2118 ecore_timer_del(ad->help_timer);
2119 ad->help_timer = NULL;
2121 ad->help_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_help_handler, ad);
2125 static void _ultra_popup_cb(void *data, Evas_Object *obj, void *event_info)
2127 struct appdata *ad = data;
2132 /*delete old help */
2133 if (ad->help_type != HELP_NONE) {
2134 if (ad->help_circle) {
2135 evas_object_del(ad->help_circle);
2136 ad->help_circle = NULL;
2138 if (ad->help_popup) {
2139 evas_object_del(ad->help_popup);
2140 ad->help_popup = NULL;
2144 char *btn_str = elm_entry_markup_to_utf8(elm_object_text_get(obj));
2145 setting_retm_if(NULL == btn_str, "btn_str is NULL");
2146 if (!strcmp(btn_str, _("IDS_ST_BUTTON_OK")) || !strcmp(btn_str, _("IDS_ST_BUTTON_ENABLE"))) {
2147 /*make complete flag */
2148 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2149 if (ret) _ERR("check export xml");
2151 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
2152 if (m_key == SETTING_PSMODE_NORMAL) {
2154 _mode_backup_settings(ad);
2155 } else if (m_key == SETTING_PSMODE_POWERFUL) {
2157 _mode_power_backup_settings(ad);
2160 release_evas_object(&(ad->popup));
2161 ad->bg = _create_bg(ad->win, NULL, "group_list");
2163 ad->enable_popup = __popup_with_progressbar(ad, ad->enable_popup, ad->win, PROGRESSBAR_STYLE,
2164 NULL, _("IDS_ST_TPOP_ENABLING_ULTRA_POWER_SAVING_MODE_ING"), __progress_popup_cb, 3/*0*/, TRUE, TRUE, TRUE); /* 2 seconds to wait in maximum */
2166 /*assistive light off, P140422-06240 */
2167 ret = led_set_brightness_with_noti(0, TRUE);
2169 _DBG(">>>led SET TO ZERO err [%d]", ret);
2171 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
2173 _DBG("*** [ERR] Failed to disable popup off reminder %d***", ret);
2177 /*set ultra == emergency*/
2178 _mode_apply_settings(ad, emergency_settings);
2180 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_EMERGENCY) == 0) {
2181 _DBG("set upsm, in indicator");
2184 } else if (!strcmp(btn_str, _("IDS_ST_BUTTON_CANCEL_ABB"))) {
2193 void _set_battery(Evas_Object *battery, int percent)
2195 int stage = ((double) percent) / 100 * 35;
2196 stage = stage == 0 ? 1 : stage;
2198 char stage_txt[16] = { '\0' };
2199 snprintf(stage_txt, sizeof(stage_txt), "%02d", stage);
2201 char percent_txt[16] = { '\0' };
2202 snprintf(percent_txt, sizeof(percent_txt), "%d%%", percent);
2204 /*batt level image set */
2205 elm_object_signal_emit(battery, stage_txt, "batt_image");
2207 /*batt percent text */
2208 elm_object_part_text_set(battery, "text2", percent_txt);
2211 void _set_stand_by_time(Evas_Object *stand_by_time, int percent)
2213 int stage = ((double) percent) / 100 * 36; /*battery percent value */
2214 double sbt_val = ((double) percent) * 2.80f; /*estimated time value */
2216 stage = stage == 0 ? 1 : stage;
2218 char stage_txt[16] = { '\0' };
2219 snprintf(stage_txt, sizeof(stage_txt), "%02d", stage);
2221 char percent_txt[16] = { '\0' };
2223 double decimal = sbt_val / 24.0f - (int)sbt_val / 24.0f;
2224 if (decimal == 0.0) {
2225 snprintf(percent_txt, sizeof(percent_txt), "%d%s", (int)(sbt_val / 24.0f), _("IDS_ST_MBODY_DAYS_M_WEEKDAY"));
2227 snprintf(percent_txt, sizeof(percent_txt), "%.1f%s", sbt_val / 24.0f, _("IDS_ST_MBODY_DAYS_M_WEEKDAY"));
2229 } else if (sbt_val > 1) {
2230 snprintf(percent_txt, sizeof(percent_txt), "%dh%dm", (int)sbt_val, (int)(sbt_val / 0.6f));
2232 snprintf(percent_txt, sizeof(percent_txt), "%dm", (int)(sbt_val / 0.6f));
2235 elm_object_signal_emit(stand_by_time, stage_txt, "standby_lev_img");
2236 elm_object_part_text_set(stand_by_time, "text_r3", percent_txt);
2239 Evas_Object *_ultra_popup_with_btn(void *data,
2240 Evas_Object *parent,
2243 _cb_func response_cb,
2244 int timeout, int btn_num)
2246 _DBG("_ultra_popup_with_btn");
2247 struct appdata *ad = data;
2251 Evas_Object *popup = ad->popup;
2254 Evas_Object *layout = elm_layout_add(popup);
2255 int rotation = elm_win_rotation_get(parent);
2256 if (rotation == 90 || rotation == 270)
2257 elm_layout_file_set(layout, UPMS_EDJ, "label_layout_landscape");
2259 elm_layout_file_set(layout, UPMS_EDJ, "label_layout");
2260 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2262 Evas_Object *inner_layout = elm_layout_add(popup);
2263 elm_layout_file_set(inner_layout, UPMS_EDJ, "inner_layout");
2264 evas_object_size_hint_weight_set(inner_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2266 Evas_Object *scroller = elm_scroller_add(layout);
2267 elm_object_style_set(scroller, "list_effect");
2268 elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
2269 elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
2270 evas_object_show(scroller);
2271 elm_object_content_set(scroller, inner_layout);
2274 /*1) battery image, text */
2276 elm_object_part_text_set(inner_layout, "text1" , _("IDS_ST_BODY_BATTERY_PERCENTAGE_ABB"));
2278 Evas_Object *img = NULL;
2279 img = elm_image_add(inner_layout);
2280 elm_image_file_set(img, "/usr/apps/org.tizen.setting/res/icons/savingpower/popup/battery/A01-11_popup_battery_bg.png", NULL);
2281 elm_object_part_content_set(inner_layout, "def_image", img);
2282 /*batt level image, text */
2284 if (vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, &percent))
2285 _DBG("Cannot get the vconf value for VCONFKEY_SYSMAN_BATTERY_CAPACITY");
2286 _set_battery(inner_layout, percent);
2288 /*2) standby time image, text */
2289 /*text r1, r2 -> text r1 */
2290 elm_object_part_text_set(inner_layout, "text_r1" , _("IDS_ST_BODY_ESTIMATED_MAX_STANDBY_TIME_ABB"));
2291 /*elm_object_part_text_set(inner_layout, "text_r2" ,"standby time"); */
2293 Evas_Object *standby_img = NULL;
2294 standby_img = elm_image_add(inner_layout);
2295 elm_image_file_set(standby_img, "/usr/apps/org.tizen.setting/res/icons/savingpower/popup/standby_time/A01-11_popup_time_bg.png", NULL);
2296 elm_object_part_content_set(inner_layout, "standby_image", standby_img);
2297 /*standby time image, text */
2298 /*_set_stand_by_time(inner_layout, percent);*/
2300 /* label for long typing popup */
2301 Evas_Object *label = elm_label_add(popup);
2302 elm_object_style_set(label, "popup/default");
2303 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
2305 char ultra_desc[1024] = {0, };
2306 snprintf(ultra_desc, sizeof(ultra_desc), "%s", text);
2307 elm_object_text_set(label, ultra_desc);
2308 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
2309 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
2310 evas_object_show(label);
2312 elm_object_part_content_set(inner_layout, "guide_text", label);
2314 elm_object_part_content_set(layout, "elm.swallow.content", scroller);
2316 elm_object_content_set(popup, layout);
2317 evas_object_smart_callback_add(elm_object_top_widget_get(popup), "rotation,changed", _text_rotation_changed, layout);
2320 elm_object_part_text_set(popup, "title,text", _(title));
2323 elm_popup_timeout_set(popup, timeout);
2325 if (btn_num > 0) { /*the case popup has button or buttons */
2326 Evas_Object *btn1 = elm_button_add(popup);
2327 elm_object_style_set(btn1, "popup");
2328 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2329 elm_object_part_content_set(popup, "button1", btn1); /*right */
2330 evas_object_smart_callback_add(btn1, "clicked", response_cb, ad);
2331 Evas_Object *btn2 = elm_button_add(popup);
2332 elm_object_style_set(btn2, "popup");
2333 elm_object_text_set(btn2, _("IDS_ST_BUTTON_ENABLE"));
2334 elm_object_part_content_set(popup, "button2", btn2); /*left */
2335 evas_object_smart_callback_add(btn2, "clicked", response_cb, ad);
2336 evas_object_show(popup);
2338 evas_object_show(popup);
2343 static Evas_Object *mode_syspopup_create_popup_with_label_check(void *data,
2344 Evas_Object *parent,
2348 Evas_Object **check,
2349 Evas_Smart_Cb response_cb,
2351 const char *btn_left, const char *btn_right)
2353 _DBG("ENTER mode_syspopup_create_popup_with_label_check");
2354 struct appdata *ad = data;
2355 if (!ad) return NULL;
2356 Evas_Object *popup = elm_popup_add(parent);
2358 ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
2359 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2361 elm_object_part_text_set(popup, "title,text", _(title));
2364 Evas_Object *btn1 = elm_button_add(popup);
2365 elm_object_style_set(btn1, "popup");
2366 elm_object_text_set(btn1, _(btn_left));
2367 elm_object_part_content_set(popup, "button1", btn1);
2369 evas_object_smart_callback_add(btn1, "clicked", response_cb, ad);
2373 Evas_Object *btn2 = elm_button_add(popup);
2374 elm_object_style_set(btn2, "popup");
2375 elm_object_text_set(btn2, _(btn_right));
2376 elm_object_part_content_set(popup, "button2", btn2);
2378 evas_object_smart_callback_add(btn2, "clicked", response_cb, ad);
2381 evas_object_show(popup);
2384 ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
2385 /*setting_add_hardkey_features(popup, data); */
2386 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2389 elm_object_part_text_set(popup, "title,text", _(title));
2393 elm_popup_timeout_set(popup, timeout);
2396 Evas_Object *label = NULL;
2397 label = elm_label_add(popup);
2398 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
2400 char arr[2048] = {'\0',};
2401 snprintf(arr, 2048, "<color=#000000>%s</color>", _(content));
2402 elm_object_text_set(label, arr);
2404 evas_object_color_set(label, 0, 0, 0, 255);
2405 evas_object_show(label);
2407 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
2408 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
2410 Evas_Object *layout = elm_layout_add(popup);
2411 elm_layout_file_set(layout, MODE_POPUP_EDJ, "popup_checkview_setting");
2412 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2415 *check = elm_check_add(popup);
2417 elm_object_style_set(*check, "multiline");
2419 elm_object_text_set(*check, _(check_str));
2422 elm_object_style_set(*check, "multiline");
2423 elm_object_text_set(*check, "Don't ask again Don't ask again Don't ask again Don't ask again Don't ask again Don't ask again ");
2425 evas_object_size_hint_align_set(*check, EVAS_HINT_FILL, EVAS_HINT_FILL);
2426 evas_object_size_hint_weight_set(*check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2427 evas_object_show(*check);
2429 Evas_Object *box = elm_box_add(popup);
2430 elm_box_horizontal_set(box, EINA_TRUE);
2431 elm_box_pack_end(box, *check);
2434 Evas_Object *lbl = elm_label_add(popup);
2435 elm_object_text_set(lbl, _(check_str));
2436 evas_object_show(lbl);
2437 elm_box_pack_end(box, lbl);
2439 elm_box_padding_set(box, 30, 0);
2440 evas_object_show(box);
2442 elm_object_part_content_set(layout, "elm.swallow.end", box);
2445 elm_object_part_content_set(layout, "elm.swallow.content", label);
2448 elm_object_content_set(popup, layout);
2449 evas_object_data_set(popup, "check_str", check_str);
2454 btn1 = elm_button_add(popup);
2455 elm_object_style_set(btn1, "popup");
2456 elm_object_text_set(btn1, _(btn_left));
2457 elm_object_part_content_set(popup, "button1", btn1);
2459 evas_object_smart_callback_add(btn1, "clicked", response_cb, ad);
2463 btn2 = elm_button_add(popup);
2464 elm_object_style_set(btn2, "popup");
2465 elm_object_text_set(btn2, _(btn_right));
2466 elm_object_part_content_set(popup, "button2", btn2);
2468 evas_object_smart_callback_add(btn2, "clicked", response_cb, ad);
2471 evas_object_show(popup);
2475 void fini_tts(struct appdata *ad)
2480 tts_state_e current_state;
2481 tts_get_state(ad->tts, ¤t_state);
2483 if (TTS_STATE_READY == current_state) {
2484 result = tts_unprepare(ad->tts);
2485 if (TTS_ERROR_NONE != result) {
2486 _ERR("Fail to prepare function : ret(%d)\n", result);
2490 result = tts_destroy(ad->tts);
2491 if (TTS_ERROR_NONE != result) {
2492 _ERR("Fail to destroy handle : result(%d)", result);
2498 void __tts_completed_cb(tts_h tts, int utt_id, void *user_data)
2500 fini_tts(user_data);
2503 void init_tts(struct appdata *ad)
2506 int result = tts_create(&(ad->tts));
2507 if (TTS_ERROR_NONE != result) {
2508 _ERR("Fail to get handle : result(%d)", result);
2511 result = tts_set_utterance_completed_cb(ad->tts, __tts_completed_cb, ad);
2512 if (TTS_ERROR_NONE != result) {
2513 _ERR("Fail to set callback : ret(%d)\n", result);
2515 result = tts_set_mode(ad->tts, TTS_MODE_DEFAULT);
2516 if (TTS_ERROR_NONE != result) {
2517 _ERR("Fail to set tts mode : ret(%d)\n", result);
2519 result = tts_prepare(ad->tts);/*async API,need to wait until TTS_STATE_READY */
2520 if (TTS_ERROR_NONE != result) {
2521 _ERR("Fail to prepare function : ret(%d)\n", result);
2526 void play_text(struct appdata *ad, const char *text)
2530 if (!ad || !ad->tts) {
2531 _ERR("ad or tts == NULL");
2535 setting_retm_if(NULL == ad->tts, "ad->tts is NULL");
2536 ret = tts_stop(ad->tts);
2537 if (TTS_ERROR_NONE != ret) {
2538 _ERR("failed to call tts_stop: %d", ret);
2541 setting_retm_if(NULL == text, "text is NULL");
2542 ret = tts_add_text(ad->tts, text, NULL,
2543 TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &utt_id);
2544 if (TTS_ERROR_NONE != ret) {
2545 _ERR("failed to call tts_add_text: %d", ret);
2548 ret = tts_play(ad->tts);
2549 if (TTS_ERROR_NONE != ret) {
2550 _ERR("failed to call tts_play: %d", ret);
2555 static void __mode_syspopup_add(struct appdata *ad)
2560 Evas_Object *popup = NULL;
2562 Evas_Object *btn2 = NULL;
2564 /*evas_object_show(ad->win); */
2566 popup = elm_popup_add(ad->win);
2569 if (popup == NULL) {
2570 _ERR("elm_popup_add failed..!!");
2575 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
2576 if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_EMERGENCY)) {
2577 vconf_set_int(VCONFKEY_SETAPPL_EMERGENCY_UI_MODE, EMERGENCY_UI_MODE_EMERGENCY);
2578 elm_object_part_text_set(popup, "title,text", _(KeyStr_Enable_emergency_Mode));
2579 Evas_Object *layout = elm_layout_add(popup);
2580 int rotation = elm_win_rotation_get(ad->win);
2581 if (rotation == 90 || rotation == 270)
2582 elm_layout_file_set(layout, POPUP_EDJ, "label_layout_landscape");
2584 elm_layout_file_set(layout, POPUP_EDJ, "label_layout");
2585 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2586 /* label for long typing popup */
2587 Evas_Object *label = elm_label_add(popup);
2588 elm_object_style_set(label, "popup/default");
2589 elm_label_line_wrap_set(label, ELM_WRAP_MIXED);
2590 elm_object_text_set(label, _(KeyStr_Survivor_Mode_POP_DESC));
2591 evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
2592 evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
2593 evas_object_show(label);
2595 Evas_Object *scroller = elm_scroller_add(layout);
2596 elm_object_style_set(scroller, "list_effect");
2597 elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE);
2598 elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
2599 evas_object_show(scroller);
2600 elm_object_content_set(scroller, label);
2602 elm_object_part_content_set(layout, "elm.swallow.content", scroller);
2604 elm_object_content_set(popup, layout);
2605 evas_object_smart_callback_add(elm_object_top_widget_get(popup), "rotation,changed", _text_rotation_changed, layout);
2607 btn1 = elm_button_add(popup);
2608 elm_object_style_set(btn1, "popup");
2609 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2610 elm_object_part_content_set(popup, "button1", btn1); /*right */
2611 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_emergency_cb, ad);
2612 btn2 = elm_button_add(popup);
2613 elm_object_style_set(btn2, "popup");
2614 elm_object_text_set(btn2, _("IDS_ST_BUTTON_ENABLE"));
2615 elm_object_part_content_set(popup, "button2", btn2); /*left */
2616 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_emergency_cb, ad);
2617 evas_object_show(popup);
2620 if (ad->help_type != HELP_NONE) {
2621 if (ad->help_timer) {
2622 ecore_timer_del(ad->help_timer);
2623 ad->help_timer = NULL;
2626 ad->help_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_help_handler, ad);
2628 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_ULTRA)) {
2629 vconf_set_int(VCONFKEY_SETAPPL_EMERGENCY_UI_MODE, EMERGENCY_UI_MODE_ULTRA_POWER_SAVING);
2630 char ultra_desc[1024] = {0, };
2631 snprintf(ultra_desc, sizeof(ultra_desc), "- %s<br>- %s<br>- %s<br>- %s",
2632 _(KeyStr_Survivor_Mode_POP_DESC1),
2633 _(KeyStr_Survivor_Mode_POP_DESC2),
2634 _(KeyStr_Survivor_Mode_POP_DESC3),
2635 _(KeyStr_Survivor_Mode_POP_DESC4));
2636 _ultra_popup_with_btn(ad, ad->win, "IDS_ST_HEADER_ULTRA_POWER_SAVING_MODE",
2640 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_EMERGENCY_SETTING)) {
2641 /*upsm in setting */
2642 /*make complete flag */
2643 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2644 if (ret) _ERR("check export xml");
2645 /*ultra power saving mode !! */
2647 evas_object_del(popup);
2651 if (m_key == SETTING_PSMODE_NORMAL) {
2653 _mode_backup_settings(ad);
2654 } else if (m_key == SETTING_PSMODE_POWERFUL) {
2656 _mode_power_backup_settings(ad);
2659 ad->is_lcd_ctrl = EINA_TRUE;
2662 /*assistive light off, P140422-06240 */
2663 ret = led_set_brightness_with_noti(0, TRUE);
2665 _DBG(">>>led SET TO ZERO err [%d]", ret);
2667 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
2669 _DBG("*** [ERR] Failed to disable popup off reminder %d***", ret);
2672 _mode_apply_settings(ad, emergency_settings);
2673 #if 1 /*---------following two invoking will cause KERNAL PANNIC */
2675 _DBG("set ultra power saving mode in setting");
2678 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_EMERGENCY_SAFETY)) {
2679 vconf_set_int(VCONFKEY_SETAPPL_EMERGENCY_UI_MODE, EMERGENCY_UI_MODE_EMERGENCY);
2681 /*make complete flag */
2682 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2683 if (ret) _ERR("check export xml");
2685 evas_object_del(popup);
2689 if (m_key == SETTING_PSMODE_NORMAL) {
2691 _mode_backup_settings(ad);
2692 } else if (m_key == SETTING_PSMODE_POWERFUL) {
2694 _mode_power_backup_settings(ad);
2697 /*assistive light off, P140422-06240 */
2698 ret = led_set_brightness_with_noti(0, TRUE);
2700 _DBG(">>>led SET TO ZERO err [%d]", ret);
2702 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
2704 _DBG("*** [ERR] Failed to disable popup off reminder %d***", ret);
2708 _mode_apply_settings(ad, emergency_settings);
2710 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_EMERGENCY) == 0) {
2711 _DBG("set on SETTING_PSMODE_EMERGENCY");
2715 if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_NORMAL)) {
2716 elm_object_style_set(popup, "transparent");
2717 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2719 int ultra_emergency;
2720 vconf_get_int(VCONFKEY_SETAPPL_EMERGENCY_UI_MODE, &ultra_emergency);
2722 if (ultra_emergency == 1) {
2723 elm_object_text_set(popup, _(KeyStr_Emergency_off_Mode_POP_DESC));
2724 elm_object_part_text_set(popup, "title,text", _("IDS_ST_HEADER_DISABLE_EMERGENCY_MODE_ABB"));
2725 } else if (ultra_emergency == 2) {
2726 elm_object_text_set(popup, _(KeyStr_Ultra_off_Mode_POP_DESC));
2727 elm_object_part_text_set(popup, "title,text", _("IDS_ST_HEADER_ULTRA_POWER_SAVING_MODE"));
2731 release_evas_object(&(ad->popup));
2732 ad->bg = _create_bg(ad->win, NULL, "group_list");
2735 ad->disable_popup = __popup_with_progressbar(ad, ad->disable_popup, ad->win, PROGRESSBAR_STYLE,
2736 NULL, _(KeyStr_Loading), __progress_popup_cb, 3/*0*/, TRUE, TRUE, FALSE); /* 2 seconds to wait in maximum */
2739 /*make complete flag */
2740 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2741 if (ret) _ERR("check export xml");
2742 /*torch light off with diable emergency/ups mode, P140507-03841 */
2743 int t_ret = led_set_brightness_with_noti(0, TRUE);
2745 _DBG(">>>led SET TO ZERO err [%d]", t_ret);
2747 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
2749 _DBG("*** [ERR] Failed to disable popup off reminder %d***", t_ret);
2753 int b_network_lcd_off;
2754 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, &b_network_lcd_off);
2755 if (b_network_lcd_off) {
2756 vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, EINA_FALSE);
2758 _mode_apply_settings(ad, normal_settings);
2760 /* set to default */
2762 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
2763 if (ret) _DBG("vconf_get_bool failed");
2764 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_NORMAL) == 0) {
2765 _DBG("set on SETTING_PSMODE_NORMAL");
2768 btn1 = elm_button_add(popup);
2769 elm_object_style_set(btn1, "popup");
2770 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2771 elm_object_part_content_set(popup, "button1", btn1); /*right */
2772 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_normal_cb, ad);
2773 btn2 = elm_button_add(popup);
2774 elm_object_style_set(btn2, "popup");
2775 elm_object_text_set(btn2, _("IDS_ST_BUTTON_DISABLE"));
2776 elm_object_part_content_set(popup, "button2", btn2); /*left */
2777 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_normal_cb, ad);
2778 evas_object_show(popup);
2780 if (vconf_notify_key_changed(VCONFKEY_PM_STATE, lcd_state_changed, ad) != 0)
2781 _DBG("vconf key notify failed");
2783 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_REMOVE_FLAG)) {
2784 int ret = remove_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2785 if (ret) _ERR("check remove xml");
2787 evas_object_del(popup);
2791 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_POWERFUL)) {
2793 int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight);
2794 if (ret) _DBG("vconf_get_bool failed");
2796 if (flight == EINA_TRUE) {
2797 /*cannot set with flight mode on */
2798 elm_object_style_set(popup, "transparent");
2799 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2800 elm_object_text_set(popup, _("IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON"));
2802 elm_popup_timeout_set(popup, 2.0);
2803 evas_object_smart_callback_add(popup, "block,clicked", timeout_response_cb, ad);
2804 evas_object_smart_callback_add(popup, "timeout", timeout_response_cb, ad);
2806 evas_object_show(popup);
2809 evas_object_del(popup);
2813 vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &m_key);
2814 if (m_key == SETTING_PSMODE_NORMAL) {
2816 _mode_backup_settings(ad);
2820 int ret = preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, &first);
2823 _mode_apply_settings(ad, powerful_settings_def);
2824 preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, 0);
2826 _mode_apply_settings(ad, powerful_settings);
2827 _DBG("right to set powerful");
2829 /* set to default */
2831 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
2832 if (ret) _DBG("vconf_get_bool failed");
2833 /*emergency mode -> normal */
2834 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_POWERFUL) == 0) {
2835 _DBG("set on SETTING_PSMODE_POWERFUL");
2838 evas_object_smart_callback_add(elm_object_top_widget_get(popup), "rotation,changed", _help_rotation_changed, ad);
2841 if (ad->help_type != HELP_NONE) {
2842 if (ad->help_timer) {
2843 ecore_timer_del(ad->help_timer);
2844 ad->help_timer = NULL;
2847 ad->help_timer = ecore_timer_add(0.5, (Ecore_Task_Cb)_help_handler, ad);
2850 if (vconf_notify_key_changed(VCONFKEY_PM_STATE, lcd_state_changed, ad) != 0)
2851 _DBG("vconf key notify failed");
2854 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_POWERFUL_SETTING)) {
2856 evas_object_del(popup);
2860 if (m_key == SETTING_PSMODE_NORMAL) {
2862 _mode_backup_settings(ad);
2867 int ret = preference_get_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, &first);
2869 _mode_apply_settings(ad, powerful_settings_def);
2870 preference_set_int(PREFKEY_SAVINGPOWER_BACKUP_FIRST_PWR, 0);
2872 _mode_apply_settings(ad, powerful_settings);
2873 _DBG("right to set powerful");
2876 /* set to default */
2878 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
2879 if (ret) _DBG("vconf_get_bool failed");
2880 /*emergency mode -> normal */
2881 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_POWERFUL) == 0) {
2882 _DBG("set on SETTING_PSMODE_POWERFUL");
2885 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_NORMAL_SETTING)) {
2886 /*make complete flag */
2887 int ret = export_xml(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml");
2888 if (ret) _ERR("check export xml");
2890 if (m_key == SETTING_PSMODE_POWERFUL) {
2892 _mode_power_backup_settings(ad);
2894 /*torch light off with diable emergency/ups mode, P140507-03841 */
2895 int t_ret = led_set_brightness_with_noti(0, TRUE);
2897 _DBG(">>>led SET TO ZERO err [%d]", t_ret);
2899 vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TORCH_LIGHT, EINA_FALSE);
2901 _DBG("*** [ERR] Failed to disable popup off reminder %d***", t_ret);
2905 int b_network_lcd_off;
2906 vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, &b_network_lcd_off);
2907 if (b_network_lcd_off) {
2908 vconf_set_bool(VCONFKEY_SETAPPL_NETWORK_PERMIT_WITH_LCD_OFF_LIMIT, EINA_FALSE);
2912 _mode_apply_settings(ad, normal_settings);
2913 /* set to default */
2916 ret = vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &opposite);
2917 if (ret) _DBG("vconf_get_bool failed");
2918 /*emergency mode -> normal */
2919 if (vconf_set_int(VCONFKEY_SETAPPL_PSMODE, SETTING_PSMODE_NORMAL) == 0) {
2920 _DBG("set on SETTING_PSMODE_NORMAL");
2923 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_BACKUP_SETTING)) {
2925 evas_object_del(popup);
2929 _mode_backup_settings(ad);
2931 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_FLIGHTMODE_ON)) {
2933 setting_set_i18n(MODE_SYSPOPUP_PACKAGE, MODE_SYSPOPUP_LOCALEDIR);
2934 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2936 _DBG("--------------------------------------------------------------");
2937 elm_object_text_set(popup, _(KeyStr_Fligtmode_Popup_On_Text));
2938 _DBG("--------------------------------------------------------------");
2940 elm_object_part_text_set(popup, "title,text", _(KeyStr_Fligtmode_Popup_Title));
2941 btn1 = elm_button_add(popup);
2942 elm_object_style_set(btn1, "popup");
2943 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2944 elm_object_part_content_set(popup, "button1", btn1); /*right */
2945 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_flightmode_cb, ad);
2946 btn2 = elm_button_add(popup);
2947 elm_object_style_set(btn2, "popup");
2948 elm_object_text_set(btn2, _("IDS_ST_BUTTON_ENABLE"));
2949 elm_object_part_content_set(popup, "button2", btn2); /*left */
2950 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_flightmode_cb, ad);
2951 evas_object_show(popup);
2953 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_FLIGHTMODE_OFF)) {
2955 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2957 elm_object_text_set(popup, _(KeyStr_Fligtmode_Popup_Off_Text));
2959 elm_object_part_text_set(popup, "title,text", _(KeyStr_Fligtmode_Popup_Title));
2960 btn1 = elm_button_add(popup);
2961 elm_object_style_set(btn1, "popup");
2962 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2963 elm_object_part_content_set(popup, "button1", btn1); /*right */
2964 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_flightmode_cb, ad);
2965 btn2 = elm_button_add(popup);
2966 elm_object_style_set(btn2, "popup");
2967 elm_object_text_set(btn2, _("IDS_ST_BUTTON_OK"));
2968 elm_object_part_content_set(popup, "button2", btn2); /*left */
2969 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_flightmode_cb, ad);
2970 evas_object_show(popup);
2972 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_NETRESTRICTIONMODE_CHANGE)) {
2974 /* Network restriction mode change */
2976 int ret = vconf_get_bool(VCONFKEY_SETAPPL_NETWORK_RESTRICT_MODE, &vconf_value);
2978 _DBG("network_restrict_mode vconf get failed");
2980 _DBG("network_restrict_mode vconf get %d", vconf_value);
2983 elm_object_style_set(popup, "transparent");
2984 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2988 elm_object_text_set(popup, _("IDS_QP_POP_NETWORK_RESTRICTION_MODE_WILL_BE_DISABLED_JPN"));
2991 elm_object_text_set(popup, _("IDS_QP_POP_IN_NETWORK_RESTRICTION_MODE_YOU_CAN_USE_ALL_YOUR_APPLICATIONS_WITHOUT_CONNECTING_TO_THE_NETWORK_YOU_CAN_ALSO_RECEIVE_CALLS_AND_SMS_MESSAGES_MSG_JPN"));
2993 elm_object_part_text_set(popup, "title,text", _("IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN"));
2994 btn1 = elm_button_add(popup);
2995 elm_object_style_set(btn1, "popup");
2996 elm_object_text_set(btn1, _("IDS_ST_BUTTON_CANCEL_ABB"));
2997 elm_object_part_content_set(popup, "button1", btn1); /*right */
2999 btn2 = elm_button_add(popup);
3000 elm_object_style_set(btn2, "popup");
3001 elm_object_text_set(btn2, _("IDS_ST_BUTTON_OK"));
3002 elm_object_part_content_set(popup, "button2", btn2); /*left */
3006 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_netrestrictionmode_change_off_cb, popup);
3007 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_netrestrictionmode_change_off_cb, popup);
3010 evas_object_smart_callback_add(btn1, "clicked", __mode_syspopup_netrestrictionmode_change_on_cb, popup);
3011 evas_object_smart_callback_add(btn2, "clicked", __mode_syspopup_netrestrictionmode_change_on_cb, popup);
3014 evas_object_show(popup);
3015 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_MOBILEDATA_ON)) {
3017 evas_object_del(ad->popup);
3020 ad->popup = mode_syspopup_create_popup_with_label_check(ad, ad->win, NULL,
3021 _(Data_packet_Popup_desc),
3022 KeyStr_DO_NOT_ASK_AGAIN,
3023 &(ad->popup_chk), __mode_syspopup_mobiledata_cb, 0,
3024 "IDS_ST_BUTTON_CANCEL_ABB", "IDS_ST_BUTTON_OK");
3027 } else if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_MOBILEDATA_OFF)) {
3029 evas_object_del(ad->popup);
3032 ad->popup = mode_syspopup_create_popup_with_label_check(ad, ad->win, NULL,
3033 KeyStr_MOBILEDATA_Popup_Off_Text,
3034 KeyStr_DO_NOT_ASK_AGAIN,
3035 &(ad->popup_chk), __mode_syspopup_mobiledata_cb, 0,
3036 "IDS_ST_BUTTON_CANCEL_ABB", "IDS_ST_BUTTON_OK");
3040 static int __mode_syspopup_reset(bundle *b, void *data)
3042 struct appdata *ad = data;
3048 /*recovery normal */
3049 ad->type = strdup(MODE_SYSTEM_POPUP_NORMAL);
3050 evas_object_show(ad->win);
3051 __mode_syspopup_add(ad);
3056 ad->b = bundle_dup(b);
3058 /* When syspopup is already loaded, remove the popup and load new popup */
3059 if (syspopup_has_popup(b)) {
3062 ret = syspopup_create(b, &handler, ad->win, ad);
3063 _DBG("ret = %d", ret);
3066 help = bundle_get_val(b, "help_type");
3068 ad->help_type = HELP_PS_MODE;
3071 val = bundle_get_val(b, "_MODE_SYSTEM_POPUP_TYPE_");
3073 ad->type = strdup(val);
3074 _INFO("type :%s", ad->type);
3076 if (ad->type && !strcmp(ad->type, MODE_SYSTEM_POPUP_POWERFUL)) {
3078 int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight);
3079 if (ret) _DBG("vconf_get_bool failed");
3082 evas_object_show(ad->win);
3085 evas_object_show(ad->win);
3089 _ERR("Unknown popup type");
3092 __mode_syspopup_add(ad);
3100 static int mode_reboot_create_noti_only(const char *key_str, const char *package, const char *title)
3102 notification_h noti = NULL;
3103 notification_error_e ret = NOTIFICATION_ERROR_NONE;
3105 /* not need to remove noti */
3106 noti = notification_new(NOTIFICATION_TYPE_ONGOING,
3107 NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE);
3109 _DBG("Fail to notification_new [%d]", ret);
3110 return SETTING_RETURN_FAIL;
3113 ret = notification_set_layout(noti, NOTIFICATION_LY_ONGOING_EVENT);
3114 if (ret != NOTIFICATION_ERROR_NONE) {
3115 _DBG("Fail to notification_set_layout [%d]", ret);
3119 if (!strcmp(PKG_BLOCKING_MODE, package)) {
3120 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, IMG_BlockingMode);
3121 if (ret != NOTIFICATION_ERROR_NONE) {
3122 _DBG("Fail to notification_set_image [%d]", ret);
3125 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, INDI_IMG_BlockingMode);
3126 if (ret != NOTIFICATION_ERROR_NONE) {
3127 _DBG("Fail to notification_set_image [%d]", ret);
3130 } else if (!strcmp(PKG_FIREWALL, package)) {
3131 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, IMG_Firewall);
3132 if (ret != NOTIFICATION_ERROR_NONE) {
3133 _DBG("Fail to notification_set_image [%d]", ret);
3136 ret = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, INDI_IMG_Firewall);
3137 if (ret != NOTIFICATION_ERROR_NONE) {
3138 _DBG("Fail to notification_set_image [%d]", ret);
3143 ret = notification_set_text(noti,
3144 NOTIFICATION_TEXT_TYPE_TITLE,
3146 title, NOTIFICATION_VARIABLE_TYPE_NONE);
3147 if (ret != NOTIFICATION_ERROR_NONE) {
3148 _DBG("Fail to notification_set_text [%d]", ret);
3152 ret = notification_set_text(noti,
3153 NOTIFICATION_TEXT_TYPE_CONTENT,
3155 key_str, NOTIFICATION_VARIABLE_TYPE_NONE);
3156 if (ret != NOTIFICATION_ERROR_NONE) {
3157 _DBG("Fail to notification_set_text [%d]", ret);
3161 ret = notification_set_text_domain(noti, SETTING_PACKAGE, SETTING_LOCALEDIR);
3162 if (ret != NOTIFICATION_ERROR_NONE) {
3163 _DBG("Fail to notification_set_text [%d]", ret);
3167 ret = notification_set_pkgname(noti, package); /*pkg ex : "setting-blockingmode-efl" */
3168 if (ret != NOTIFICATION_ERROR_NONE) {
3169 _DBG("Fail to notification_set_pkgname [%d]", ret);
3173 ret = notification_set_application(noti, package); /*pkg ex : "setting-blockingmode-efl" */
3174 if (ret != NOTIFICATION_ERROR_NONE) {
3175 _DBG("Fail to notification_set_application [%d]", ret);
3180 ret = notification_insert(noti, ¬i_id);
3181 if (ret != NOTIFICATION_ERROR_NONE) {
3182 _DBG("Fail to notification_insert [%d]", ret);
3186 ret = notification_free(noti);
3187 if (ret != NOTIFICATION_ERROR_NONE) {
3188 _DBG("Fail to notification_free [%d]", ret);
3195 ret = notification_free(noti);
3196 if (ret != NOTIFICATION_ERROR_NONE) {
3197 _DBG("Fail to notification_free [%d]", ret);
3203 * Check whether file existed or not
3205 * @param pszFilePathName [in] : File path (/Folder)
3206 * @return TRUE on success, FALSE on failure
3208 static int __is_file_exist(char *pszFilePathName)
3212 pFile = fopen(pszFilePathName, "r");
3213 if (pFile == NULL) {
3214 _DBG("fopen('%s')=NULL, File not existed.", pszFilePathName);
3218 _DBG("fopen('%s')!=NULL, File existed.", pszFilePathName);
3226 static int __mode_reboot_noti_method()
3228 /*get vconf to notif register */
3229 /*blockingmode, drivingmode, flightmode */
3230 int driving, firewall, ret;
3232 ret |= vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall);
3233 /*ret |= vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight); */
3234 _DBG("__mode_reboot_noti_method");
3235 printf("noti method start\n");
3237 printf("mode get vconf failed\n");
3240 /*set noti for on status */
3242 ret |= mode_reboot_create_noti_only("IDS_ST_BODY_INCOMING_CALLS_AND_NEW_NOTIFICATIONS_WILL_BE_READ_OUT_AUTOMATICALLY", PKG_DRIVING_MODE, "IDS_VC_MBODY_NOTIFICATION_READ_OUT");
3244 ret |= mode_reboot_create_noti_only("IDS_ST_BODY_CONFIGURE_FIREWALL_SETTINGS", PKG_FIREWALL, "IDS_ST_BODY_FIREWALL_ENABLED_ABB");
3245 /*if(flight) mode_reboot_create_noti_only ... not need to */
3247 return ret; /*zero for success */
3249 static void __win_del(void *data, Evas_Object *obj, void *event)
3254 static Evas_Object *__create_win(const char *name)
3256 _DBG("ENTER __create_win");
3260 Ecore_X_Window xwin;
3261 unsigned int val = 1;
3263 eo = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC);
3265 elm_win_title_set(eo, name);
3266 elm_win_borderless_set(eo, EINA_TRUE);
3267 elm_win_alpha_set(eo, EINA_TRUE);
3269 evas_object_smart_callback_add(eo, "delete,request", __win_del, NULL);
3271 ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
3272 evas_object_resize(eo, w, h);
3273 xwin = elm_win_xwindow_get(eo);
3274 ecore_x_window_prop_card32_set(xwin, ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL, &val, 1);
3281 static int __mode_syspopup_app_create(void *data)
3283 _DBG("ENTER __mode_syspopup_app_create");
3284 struct appdata *ad = data;
3288 ad->win = __create_win(PACKAGE);
3289 if (ad->win == NULL) {
3290 _ERR("Create win error");
3294 ad->ly_main = elm_layout_add(ad->win);
3295 evas_object_size_hint_weight_set(ad->ly_main, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3296 elm_layout_theme_set(ad->ly_main, "layout", "application", "default");
3298 evas_object_show(ad->ly_main);
3299 elm_win_resize_object_add(ad->win, ad->ly_main);
3300 evas_object_show(ad->win);
3302 /* init internationalization */
3303 setting_set_i18n(MODE_SYSPOPUP_PACKAGE, MODE_SYSPOPUP_LOCALEDIR);
3306 mode_syspopup_create_popup_with_label_check(ad, ad->ly_main, NULL,
3307 KeyStr_MOBILEDATA_Popup_Off_Text,
3308 KeyStr_DO_NOT_ASK_AGAIN,
3309 &(ad->popup_chk), __mode_syspopup_mobiledata_cb, 0,
3310 "IDS_ST_BUTTON_CANCEL_ABB", "IDS_ST_BUTTON_OK");
3316 static int __mode_syspopup_app_terminate(void *data)
3318 _DBG("__mode_syspopup_app_terminate");
3319 struct appdata *ad = data;
3325 if (vconf_ignore_key_changed(VCONFKEY_PM_STATE, lcd_state_changed) != 0)
3326 _DBG("vconf key ignore failed");
3331 evas_object_del(ad->win);
3335 if (ad->lcd_freq_timer) {
3336 ecore_timer_del(ad->lcd_freq_timer);
3337 ad->lcd_freq_timer = NULL;
3340 if (ad->play_timer) {
3341 ecore_timer_del(ad->play_timer);
3342 ad->play_timer = NULL;
3345 if (ad->disable_popup) {
3346 evas_object_del(ad->disable_popup);
3347 ad->disable_popup = NULL;
3350 if (ad->enable_popup) {
3351 evas_object_del(ad->enable_popup);
3352 ad->enable_popup = NULL;
3359 static int __mode_syspopup_app_pause(void *data)
3361 /*struct appdata *ad = data; */
3366 static int __mode_syspopup_resume(void *data)
3368 /*struct appdata *ad = data; */
3373 int main(int argc, char *argv[])
3376 #if REBOOT_METHOD_FROM_SHELL
3378 /*for(; i < argc;i++) _DBG("argv[%d]:%s", i, argv[i]); */
3381 if (argc >= 2) command = atoi(argv[1]);
3382 /*_DBG("[0]%s [1]%s [2]%s command=%d , argc = %d",argv[0], argv[1],argv[2],command, argc); */
3384 case 1:/* from sh */
3385 sleep(1); /*notification_is_service_ready */
3386 /*function for vconf get and notification register */
3387 if (!__mode_reboot_noti_method()) {
3390 /*function for recovery interrupt in emergency/upms work */
3391 if (__is_file_exist(DEFAULT_COMPLETE_CONFIG_FLAG_DIR"mode_perf.xml")) {
3392 /*should recovery!, set normal with reboot */
3398 _DBG("noti method failing");
3399 return 1; /*failing code from sh */
3404 _DBG("[in reboot-mode sys seq from shell]end:res[%d]\n", res);
3409 struct appcore_ops ops = {
3410 .create = __mode_syspopup_app_create,
3411 .terminate = __mode_syspopup_app_terminate,
3412 .pause = __mode_syspopup_app_pause,
3413 .resume = __mode_syspopup_resume,
3414 .reset = __mode_syspopup_reset,
3417 memset(&ad, 0x0, sizeof(struct appdata));
3420 return appcore_efl_main(PACKAGE, &argc, &argv, &ops);