2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
26 #include <ITapiModem.h>
28 #include <tapi_event.h>
29 #include <tapi_common.h>
30 #include <syspopup_caller.h>
31 #include <sys/reboot.h>
34 #include <sys/mount.h>
37 #include "ss_launch.h"
39 #include "ss_device_handler.h"
40 #include "device-node.h"
41 #include "ss_predefine.h"
42 #include "ss_procmgr.h"
43 #include "ss_vibrator.h"
44 #include "include/ss_data.h"
45 #include "ss_common.h"
47 #define PREDEFINE_SO_DIR PREFIX"/lib/ss_predefine/"
49 #define CALL_EXEC_PATH PREFIX"/bin/call"
50 #define LOWMEM_EXEC_PATH PREFIX"/bin/lowmem-popup"
51 #define LOWBAT_EXEC_PATH PREFIX"/bin/lowbatt-popup"
52 #define USBCON_EXEC_PATH PREFIX"/bin/usb-server"
53 #define TVOUT_EXEC_PATH PREFIX"/bin/tvout-selector"
54 #define PWROFF_EXEC_PATH PREFIX"/bin/poweroff-popup"
55 #define MEMPS_EXEC_PATH PREFIX"/bin/memps"
56 #define HDMI_NOTI_EXEC_PATH PREFIX"/bin/hdmi_connection_noti"
57 #define LOWBAT_POPUP_NAME "lowbat-syspopup"
58 #define POWEROFF_POPUP_NAME "poweroff-syspopup"
59 #define HDMI_POPUP_NAME "hdmi-syspopup"
60 #define LOWMEM_POPUP_NAME "lowmem-syspopup"
62 /* wait for 5 sec as victim process be dead */
63 #define WAITING_INTERVAL 5
65 #define TVOUT_X_BIN "/usr/bin/xberc"
66 #define TVOUT_FLAG 0x00000001
67 #define MEMPS_LOG_FILE "/var/log/memps"
70 #define POWEROFF_DURATION 2
71 #define POWEROFF_ANIMATION_PATH "/usr/bin/boot-animation"
72 #define POWEROFF_NOTI_NAME "power_off_start"
74 #define WM_READY_PATH "/tmp/.wm_ready"
76 #define LOWBAT_OPT_WARNING 1
77 #define LOWBAT_OPT_POWEROFF 2
78 #define LOWBAT_OPT_CHARGEERR 3
79 #define LOWBAT_OPT_CHECK 4
81 static Ecore_Timer *lowbat_popup_id = NULL;
82 static int lowbat_popup_option = 0;
84 static struct timeval tv_start_poweroff;
85 static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
86 static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad);
87 int internal_poweroff_def_predefine_action(int argc, char **argv);
89 static int ss_flags = 0;
91 static Ecore_Timer *poweroff_timer_id = NULL;
92 static TapiHandle *tapi_handle = NULL;
93 static int power_off = 0;
95 static int __predefine_get_pid(const char *execpath)
98 struct dirent *dentry;
103 dp = opendir("/proc");
105 PRT_TRACE_ERR("open /proc");
109 while ((dentry = readdir(dp)) != NULL) {
110 if (!isdigit(dentry->d_name[0]))
113 pid = atoi(dentry->d_name);
115 snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid);
116 fd = open(buf, O_RDONLY);
119 if (read(fd, buf2, PATH_MAX) < 0) {
125 if (!strcmp(buf2, execpath)) {
136 int is_power_off(void)
141 static void make_memps_log(char *file, pid_t pid, char *victim_name)
146 char new_log[NAME_MAX];
147 static pid_t old_pid = 0;
155 cur_tm = (struct tm *)malloc(sizeof(struct tm));
156 if (cur_tm == NULL) {
157 PRT_TRACE_ERR("Fail to memory allocation");
161 if (localtime_r(&now, cur_tm) == NULL) {
162 PRT_TRACE_ERR("Fail to get localtime");
167 PRT_TRACE("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
168 pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
169 cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
171 snprintf(new_log, sizeof(new_log),
172 "%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
173 pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
174 cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
177 snprintf(params, sizeof(params), "-f %s", new_log);
178 ret = ss_launch_evenif_exist(MEMPS_EXEC_PATH, params);
179 /* will be removed, just for debugging */
182 fp = open_proc_oom_adj_file(ret, "w");
184 fprintf(fp, "%d", (-17));
191 static void remount_ro()
194 const char* table = "/etc/mtab";
195 const char mmtpoint[10][64];
197 int r = -1, foundmount=0;
199 fp = setmntent(table, "r");
204 while (mnt=getmntent(fp)) {
205 if (foundmount >= 10)
207 if (!strcmp(mnt->mnt_type, "ext4") && strstr(mnt->mnt_opts, "rw")) {
208 memset(mmtpoint[foundmount], 0, 64);
209 strncpy(mmtpoint[foundmount], mnt->mnt_dir, 63);
216 snprintf(buf, sizeof(buf), "fuser -c %s -k -15", mmtpoint[foundmount]);
218 umount2(mmtpoint[foundmount], MNT_DETACH);
222 static int lowmem_get_victim_pid()
227 if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_VICTIM_TASK, &pid) < 0) {
228 PRT_TRACE_ERR("Get victim task failed");
235 int lowmem_def_predefine_action(int argc, char **argv)
237 int pid, ret, oom_adj;
238 char appname[PATH_MAX];
243 if (!strcmp(argv[0], OOM_MEM_ACT)) {
244 pid = lowmem_get_victim_pid();
245 if (pid > 0 && pid != sysman_get_pid(LOWMEM_EXEC_PATH) && pid != sysman_get_pid(MEMPS_EXEC_PATH)) {
246 if ((sysman_get_cmdline_name(pid, appname, PATH_MAX)) ==
249 ("we will kill, lowmem lv2 = %d (%s)\n",
252 make_memps_log(MEMPS_LOG_FILE, pid, appname);
254 if(get_app_oomadj(pid, &oom_adj) < 0) {
255 PRT_TRACE_ERR("Failed to get oom_adj");
258 PRT_TRACE("%d will be killed with %d oom_adj value", pid, oom_adj);
262 if (oom_adj != OOMADJ_FOREGRD_LOCKED && oom_adj != OOMADJ_FOREGRD_UNLOCKED) {
269 bundle_add(b, "_APP_NAME_", appname);
270 ret = syspopup_launch("lowmem-syspopup", b);
273 PRT_TRACE_EM("popup lauch failed\n");
277 if (set_app_oomadj(ret, OOMADJ_SU) < 0) {
278 PRT_TRACE_ERR("Failed to set oom_adj");
286 int usbcon_def_predefine_action(int argc, char **argv)
291 int bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
293 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_USB_ONLINE, &val) == 0) {
295 vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,
296 VCONFKEY_SYSMAN_USB_DISCONNECTED);
297 pm_unlock_state(LCD_OFF, STAY_CUR_STATE);
301 if ( vconf_get_int(VCONFKEY_SYSMAN_USB_STATUS, &val) == 0 && val == VCONFKEY_SYSMAN_USB_AVAILABLE)
304 vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,
305 VCONFKEY_SYSMAN_USB_AVAILABLE);
306 pm_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
307 pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
309 PRT_TRACE_ERR("usb predefine action failed\n");
314 PRT_TRACE_ERR("failed to get usb status\n");
318 int earjackcon_def_predefine_action(int argc, char **argv)
322 PRT_TRACE_EM("earjack_normal predefine action\n");
323 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARJACK_ONLINE, &val) == 0) {
324 return vconf_set_int(VCONFKEY_SYSMAN_EARJACK, val);
330 int lowbat_popup(void *data)
332 int ret = -1, state = 0;
333 ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
334 if (state == 1 || ret != 0) {
337 if (lowbat_popup_option == LOWBAT_OPT_WARNING || lowbat_popup_option == LOWBAT_OPT_CHECK) {
338 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
339 } else if(lowbat_popup_option == LOWBAT_OPT_POWEROFF) {
340 bundle_add(b, "_SYSPOPUP_CONTENT_", "poweroff");
341 } else if(lowbat_popup_option == LOWBAT_OPT_CHARGEERR) {
342 bundle_add(b, "_SYSPOPUP_CONTENT_", "chargeerr");
344 bundle_add(b, "_SYSPOPUP_CONTENT_", "check");
347 ret = syspopup_launch("lowbat-syspopup", b);
349 PRT_TRACE_EM("popup lauch failed\n");
353 lowbat_popup_id = NULL;
354 lowbat_popup_option = 0;
357 PRT_TRACE_EM("boot-animation running yet");
365 int predefine_control_launch(char *name, bundle *b)
368 static int launched_poweroff = 0;
370 if (strncmp(name, LOWBAT_POPUP_NAME, strlen(LOWBAT_POPUP_NAME)) == 0) {
371 if (launched_poweroff == 1) {
372 PRT_TRACE_ERR("will be foreced power off");
373 internal_poweroff_def_predefine_action(0,NULL);
377 if (lowbat_popup_option == LOWBAT_OPT_POWEROFF)
378 launched_poweroff = 1;
380 pid = __predefine_get_pid(LOWBAT_EXEC_PATH);
382 PRT_TRACE_ERR("pre launched %s destroy", LOWBAT_EXEC_PATH);
385 if (syspopup_launch(name, b) < 0)
389 if (strncmp(name, POWEROFF_POPUP_NAME, strlen(POWEROFF_POPUP_NAME)) == 0) {
390 if (syspopup_launch(name, b) < 0)
394 if (strncmp(name, HDMI_POPUP_NAME, strlen(HDMI_POPUP_NAME)) == 0) {
395 if (syspopup_launch(name, b) < 0)
399 if (strncmp(name, HDMI_NOTI_EXEC_PATH, strlen(HDMI_NOTI_EXEC_PATH)) == 0) {
400 if (ss_launch_if_noexist(name, "1") < 0)
403 //user mem lowmem-popup
404 if (strncmp(name, LOWMEM_POPUP_NAME, strlen(LOWMEM_POPUP_NAME)) == 0) {
405 if (syspopup_launch(name, b) < 0)
411 void predefine_pm_change_state(unsigned int s_bits)
413 pm_change_state(s_bits);
416 int lowbat_def_predefine_action(int argc, char **argv)
425 if (lowbat_popup_id != NULL) {
426 ecore_timer_del(lowbat_popup_id);
427 lowbat_popup_id = NULL;
432 if (!strcmp(argv[0],CRITICAL_LOW_BAT_ACT)) {
433 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
434 lowbat_popup_option = LOWBAT_OPT_CHECK;
435 } else if(!strcmp(argv[0],WARNING_LOW_BAT_ACT)) {
436 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
437 lowbat_popup_option = LOWBAT_OPT_WARNING;
438 } else if(!strcmp(argv[0],POWER_OFF_BAT_ACT)) {
439 bundle_add(b, "_SYSPOPUP_CONTENT_", "poweroff");
440 lowbat_popup_option = LOWBAT_OPT_POWEROFF;
441 } else if(!strcmp(argv[0],CHARGE_ERROR_ACT)) {
442 bundle_add(b, "_SYSPOPUP_CONTENT_", "chargeerr");
443 lowbat_popup_option = LOWBAT_OPT_CHARGEERR;
446 ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
447 if (state == 1 || ret != 0) {
448 if (predefine_control_launch("lowbat-syspopup", b) < 0) {
449 PRT_TRACE_ERR("popup lauch failed\n");
451 lowbat_popup_option = 0;
455 PRT_TRACE_EM("boot-animation running yet");
456 lowbat_popup_id = ecore_timer_add(1, lowbat_popup, NULL);
462 Eina_Bool powerdown_ap_by_force(void *data)
465 int poweroff_duration = POWEROFF_DURATION;
468 if(tapi_handle != NULL)
470 tel_deinit(tapi_handle);
473 /* Getting poweroff duration */
474 buf = getenv("PWROFF_DUR");
475 if (buf != NULL && strlen(buf) < 1024)
476 poweroff_duration = atoi(buf);
477 if (poweroff_duration < 0 || poweroff_duration > 60)
478 poweroff_duration = POWEROFF_DURATION;
480 gettimeofday(&now, NULL);
481 /* Waiting until power off duration and displaying animation */
482 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
484 gettimeofday(&now, NULL);
487 PRT_TRACE("Power off by force\n");
488 /* give a chance to be terminated for each process */
492 reboot(RB_POWER_OFF);
496 static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
499 int poweroff_duration = POWEROFF_DURATION;
502 if (poweroff_timer_id) {
503 ecore_timer_del(poweroff_timer_id);
504 poweroff_timer_id = NULL;
507 tel_deregister_noti_event(tapi_handle,TAPI_NOTI_MODEM_POWER);
508 tel_deinit(tapi_handle);
511 PRT_TRACE("Power off \n");
513 /* Getting poweroff duration */
514 buf = getenv("PWROFF_DUR");
515 if (buf != NULL && strlen(buf) < 1024)
516 poweroff_duration = atoi(buf);
517 if (poweroff_duration < 0 || poweroff_duration > 60)
518 poweroff_duration = POWEROFF_DURATION;
520 gettimeofday(&now, NULL);
521 /* Waiting until power off duration and displaying animation */
522 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
524 gettimeofday(&now, NULL);
527 /* give a chance to be terminated for each process */
531 reboot(RB_POWER_OFF);
533 static void powerdown_res_cb(TapiHandle *handle, int result, void *data, void *user_data)
535 PRT_TRACE("poweroff command request : %d",result);
538 int poweroff_def_predefine_action(int argc, char **argv)
542 heynoti_publish(POWEROFF_NOTI_NAME);
544 while (retry_count < MAX_RETRY) {
545 if (ss_action_entry_call_internal(PREDEF_INTERNAL_POWEROFF, 0) < 0) {
546 PRT_TRACE_ERR("failed to request poweroff to system_server \n");
550 vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void*)poweroff_control_cb);
556 int internal_poweroff_def_predefine_action(int argc, char **argv)
560 system("/etc/rc.d/rc.shutdown &");
563 gettimeofday(&tv_start_poweroff, NULL);
565 ret = tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, powerdown_ap, NULL);
567 if (ret != TAPI_API_SUCCESS) {
569 ("tel_register_event is not subscribed. error %d\n", ret);
570 powerdown_ap_by_force(NULL);
574 ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
575 if (ret != TAPI_API_SUCCESS) {
576 PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret);
577 powerdown_ap_by_force(NULL);
580 poweroff_timer_id = ecore_timer_add(15, powerdown_ap_by_force, NULL);
582 powerdown_ap_by_force(NULL);
587 static void enter_flight_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
589 int bCurFlightMode = 0;
590 if (result != TAPI_POWER_FLIGHT_MODE_ENTER) {
591 PRT_TRACE_ERR("flight mode enter failed %d",result);
593 PRT_TRACE("enter flight mode result : %d",result);
594 if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
595 PRT_TRACE("Flight Mode is %d", bCurFlightMode);
597 PRT_TRACE_ERR("failed to get vconf key");
602 static void leave_flight_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
604 int bCurFlightMode = 0;
605 if (result != TAPI_POWER_FLIGHT_MODE_LEAVE) {
606 PRT_TRACE_ERR("flight mode leave failed %d",result);
608 PRT_TRACE("leave flight mode result : %d",result);
609 if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
610 PRT_TRACE("Flight Mode is %d", bCurFlightMode);
612 PRT_TRACE_ERR("failed to get vconf key");
617 int entersleep_def_predefine_action(int argc, char **argv)
621 pm_change_state(LCD_NORMAL);
624 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
625 PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret);
627 system("/etc/rc.d/rc.entersleep");
628 pm_change_state(POWER_OFF);
633 int leavesleep_def_predefine_action(int argc, char **argv)
637 pm_change_state(LCD_NORMAL);
640 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL);
641 PRT_TRACE_ERR("request for changing into flight mode : %d\n", ret);
646 static void restart_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
648 Eina_Bool restart_ap_ecore(void *data)
650 restart_ap(tapi_handle,NULL,(void *)-1,NULL);
654 static void restart_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
657 int poweroff_duration = POWEROFF_DURATION;
660 if (poweroff_timer_id) {
661 ecore_timer_del(poweroff_timer_id);
662 poweroff_timer_id = NULL;
666 if(tapi_handle != NULL)
668 tel_deregister_noti_event(tapi_handle,TAPI_NOTI_MODEM_POWER);
669 tel_deinit(tapi_handle);
673 PRT_INFO("Restart\n");
676 buf = getenv("PWROFF_DUR");
677 if (buf != NULL && strlen(buf) < 1024)
678 poweroff_duration = atoi(buf);
679 if (poweroff_duration < 0 || poweroff_duration > 60)
680 poweroff_duration = POWEROFF_DURATION;
681 gettimeofday(&now, NULL);
682 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
684 gettimeofday(&now, NULL);
691 static void restart_ap_by_force(void *data)
694 int poweroff_duration = POWEROFF_DURATION;
697 if (poweroff_timer_id) {
698 ecore_timer_del(poweroff_timer_id);
699 poweroff_timer_id = NULL;
703 if(tapi_handle != NULL)
705 tel_deinit(tapi_handle);
709 PRT_INFO("Restart\n");
712 buf = getenv("PWROFF_DUR");
713 if (buf != NULL && strlen(buf) < 1024)
714 poweroff_duration = atoi(buf);
715 if (poweroff_duration < 0 || poweroff_duration > 60)
716 poweroff_duration = POWEROFF_DURATION;
717 gettimeofday(&now, NULL);
718 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
720 gettimeofday(&now, NULL);
727 int restart_def_predefine_action(int argc, char **argv)
731 pm_change_state(LCD_NORMAL);
732 system("/etc/rc.d/rc.shutdown &");
735 gettimeofday(&tv_start_poweroff, NULL);
738 tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, restart_ap, NULL);
739 if (ret != TAPI_API_SUCCESS) {
741 ("tel_register_event is not subscribed. error %d\n", ret);
742 restart_ap_by_force((void *)-1);
747 ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
748 if (ret != TAPI_API_SUCCESS) {
749 PRT_TRACE_ERR("tel_process_power_command() error %d\n", ret);
750 restart_ap_by_force((void *)-1);
754 poweroff_timer_id = ecore_timer_add(15, restart_ap_ecore, NULL);
758 int launching_predefine_action(int argc, char **argv)
765 /* current just launching poweroff-popup */
766 if (predefine_control_launch("poweroff-syspopup", NULL) < 0) {
767 PRT_TRACE_ERR("poweroff-syspopup launch failed");
773 int flight_mode_def_predefine_action(int argc, char **argv)
776 int err = TAPI_API_SUCCESS;
777 if (argc != 1 || argv[0] == NULL) {
778 PRT_TRACE_ERR("FlightMode Set predefine action failed");
781 bCurFlightMode = atoi(argv[0]);
782 if (bCurFlightMode == 1) {
783 err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL);
784 } else if (bCurFlightMode == 0) {
785 err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
787 if (err != TAPI_API_SUCCESS)
788 PRT_TRACE_ERR("FlightMode tel api action failed %d",err);
793 static void ss_action_entry_load_from_sodir()
796 struct dirent *dentry;
801 dp = opendir(PREDEFINE_SO_DIR);
803 ERR("fail open %s", PREDEFINE_SO_DIR);
807 msg = malloc(sizeof(struct sysnoti));
809 ERR("Malloc failed");
816 while ((dentry = readdir(dp)) != NULL) {
817 if ((ext = strstr(dentry->d_name, ".so")) == NULL)
820 snprintf(tmp, sizeof(tmp), "%s/%s", PREDEFINE_SO_DIR,
824 msg->type = &(dentry->d_name[3]);
825 ss_action_entry_add(msg);
831 static void __tel_init_cb(keynode_t *key_nodes,void *data)
834 bTelReady = vconf_keynode_get_bool(key_nodes);
835 if (bTelReady == 1) {
836 vconf_ignore_key_changed(VCONFKEY_TELEPHONY_READY, (void*)__tel_init_cb);
837 tapi_handle = tel_init(NULL);
838 if (tapi_handle == NULL) {
839 PRT_TRACE_ERR("tapi init error");
842 PRT_TRACE_ERR("tapi is not ready yet");
845 static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad)
848 if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &val) != 0)
851 case VCONFKEY_SYSMAN_POWER_OFF_DIRECT:
852 ss_action_entry_call_internal(PREDEF_POWEROFF, 0);
854 case VCONFKEY_SYSMAN_POWER_OFF_POPUP:
855 ss_action_entry_call_internal(PREDEF_PWROFF_POPUP, 0);
860 void ss_predefine_internal_init(void)
863 /* telephony initialize */
866 if (vconf_get_bool(VCONFKEY_TELEPHONY_READY,&bTelReady) == 0) {
867 if (bTelReady == 1) {
868 tapi_handle = tel_init(NULL);
869 if (tapi_handle == NULL) {
870 PRT_TRACE_ERR("tapi init error");
873 vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, (void *)__tel_init_cb, NULL);
876 PRT_TRACE_ERR("failed to get tapi vconf key");
879 ss_action_entry_add_internal(PREDEF_CALL, call_predefine_action, NULL,
882 ss_action_entry_add_internal(PREDEF_LOWMEM, lowmem_def_predefine_action,
884 ss_action_entry_add_internal(PREDEF_LOWBAT, lowbat_def_predefine_action,
886 ss_action_entry_add_internal(PREDEF_USBCON, usbcon_def_predefine_action,
888 ss_action_entry_add_internal(PREDEF_EARJACKCON,
889 earjackcon_def_predefine_action, NULL,
891 ss_action_entry_add_internal(PREDEF_POWEROFF,
892 poweroff_def_predefine_action, NULL, NULL);
893 ss_action_entry_add_internal(PREDEF_PWROFF_POPUP,
894 launching_predefine_action, NULL, NULL);
895 ss_action_entry_add_internal(PREDEF_REBOOT,
896 restart_def_predefine_action, NULL, NULL);
897 ss_action_entry_add_internal(PREDEF_FLIGHT_MODE,
898 flight_mode_def_predefine_action, NULL, NULL);
899 ss_action_entry_add_internal(PREDEF_INTERNAL_POWEROFF,
900 internal_poweroff_def_predefine_action, NULL, NULL);
901 ss_action_entry_add_internal(PREDEF_HAPTIC, haptic_def_predefine_action,
904 if (vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void *)poweroff_control_cb, NULL) < 0) {
905 PRT_TRACE_ERR("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
907 ss_action_entry_load_from_sodir();
909 /* check and set earjack init status */
910 earjackcon_def_predefine_action(0, NULL);