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.
24 #include <ITapiModem.h>
26 #include <tapi_event.h>
27 #include <tapi_common.h>
28 #include <syspopup_caller.h>
29 #include <sys/reboot.h>
32 #include <sys/mount.h>
33 #include "dd-deviced.h"
37 #include "device-node.h"
38 #include "predefine.h"
39 #include "proc/procmgr.h"
40 #include "vibrator/vibrator.h"
41 #include "core/data.h"
43 #include "display/poll.h"
46 #define CALL_EXEC_PATH PREFIX"/bin/call"
47 #define LOWMEM_EXEC_PATH PREFIX"/bin/lowmem-popup"
48 #define LOWBAT_EXEC_PATH PREFIX"/bin/lowbatt-popup"
49 #define USBCON_EXEC_PATH PREFIX"/bin/usb-server"
50 #define TVOUT_EXEC_PATH PREFIX"/bin/tvout-selector"
51 #define PWROFF_EXEC_PATH PREFIX"/bin/poweroff-popup"
52 #define MEMPS_EXEC_PATH PREFIX"/bin/memps"
53 #define HDMI_NOTI_EXEC_PATH PREFIX"/bin/hdmi_connection_noti"
54 #define LOWBAT_POPUP_NAME "lowbat-syspopup"
55 #define POWEROFF_POPUP_NAME "poweroff-syspopup"
56 #define HDMI_POPUP_NAME "hdmi-syspopup"
57 #define LOWMEM_POPUP_NAME "lowmem-syspopup"
59 /* wait for 5 sec as victim process be dead */
60 #define WAITING_INTERVAL 5
62 #define TVOUT_X_BIN "/usr/bin/xberc"
63 #define TVOUT_FLAG 0x00000001
64 #define MEMPS_LOG_FILE "/var/log/memps"
67 #define POWEROFF_DURATION 2
68 #define POWEROFF_ANIMATION_PATH "/usr/bin/boot-animation"
69 #define POWEROFF_NOTI_NAME "power_off_start"
71 #define WM_READY_PATH "/tmp/.wm_ready"
73 #define LOWBAT_OPT_WARNING 1
74 #define LOWBAT_OPT_POWEROFF 2
75 #define LOWBAT_OPT_CHARGEERR 3
76 #define LOWBAT_OPT_CHECK 4
78 static Ecore_Timer *lowbat_popup_id = NULL;
79 static int lowbat_popup_option = 0;
81 static struct timeval tv_start_poweroff;
82 static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
83 static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad);
84 int internal_poweroff_def_predefine_action(int argc, char **argv);
86 static int ss_flags = 0;
88 static Ecore_Timer *poweroff_timer_id = NULL;
89 static TapiHandle *tapi_handle = NULL;
90 static int power_off = 0;
92 static int __predefine_get_pid(const char *execpath)
95 struct dirent *dentry;
100 dp = opendir("/proc");
106 while ((dentry = readdir(dp)) != NULL) {
107 if (!isdigit(dentry->d_name[0]))
110 pid = atoi(dentry->d_name);
112 snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid);
113 fd = open(buf, O_RDONLY);
116 if (read(fd, buf2, PATH_MAX) < 0) {
122 if (!strcmp(buf2, execpath)) {
133 int is_power_off(void)
138 static void make_memps_log(char *file, pid_t pid, char *victim_name)
143 char new_log[NAME_MAX];
144 static pid_t old_pid = 0;
152 cur_tm = (struct tm *)malloc(sizeof(struct tm));
153 if (cur_tm == NULL) {
154 _E("Fail to memory allocation");
158 if (localtime_r(&now, cur_tm) == NULL) {
159 _E("Fail to get localtime");
164 _D("%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
165 pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
166 cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
168 snprintf(new_log, sizeof(new_log),
169 "%s_%s_%d_%.4d%.2d%.2d_%.2d%.2d%.2d.log", file, victim_name,
170 pid, (1900 + cur_tm->tm_year), 1 + cur_tm->tm_mon,
171 cur_tm->tm_mday, cur_tm->tm_hour, cur_tm->tm_min,
174 snprintf(params, sizeof(params), "-f %s", new_log);
175 ret = ss_launch_evenif_exist(MEMPS_EXEC_PATH, params);
176 /* will be removed, just for debugging */
179 fp = open_proc_oom_adj_file(ret, "w");
181 fprintf(fp, "%d", (-17));
188 static void remount_ro()
191 const char* table = "/etc/mtab";
192 const char mmtpoint[10][64];
194 int r = -1, foundmount=0;
196 fp = setmntent(table, "r");
201 while (mnt=getmntent(fp)) {
202 if (foundmount >= 10)
204 if (!strcmp(mnt->mnt_type, "ext4") && strstr(mnt->mnt_opts, "rw")) {
205 memset(mmtpoint[foundmount], 0, 64);
206 strncpy(mmtpoint[foundmount], mnt->mnt_dir, 63);
213 snprintf(buf, sizeof(buf), "fuser -c %s -k -15", mmtpoint[foundmount]);
215 umount2(mmtpoint[foundmount], MNT_DETACH);
219 static int lowmem_get_victim_pid()
224 if (device_get_property(DEVICE_TYPE_MEMORY, PROP_MEMORY_VICTIM_TASK, &pid) < 0) {
225 _E("Get victim task failed");
232 int lowmem_def_predefine_action(int argc, char **argv)
234 int pid, ret, oom_adj;
235 char appname[PATH_MAX];
240 if (!strcmp(argv[0], OOM_MEM_ACT)) {
241 pid = lowmem_get_victim_pid();
242 if (pid > 0 && pid != get_exec_pid(LOWMEM_EXEC_PATH) && pid != get_exec_pid(MEMPS_EXEC_PATH)) {
243 if ((get_cmdline_name(pid, appname, PATH_MAX)) ==
246 ("we will kill, lowmem lv2 = %d (%s)\n",
249 make_memps_log(MEMPS_LOG_FILE, pid, appname);
251 if(get_app_oomadj(pid, &oom_adj) < 0) {
252 _E("Failed to get oom_adj");
255 _D("%d will be killed with %d oom_adj value", pid, oom_adj);
259 if (oom_adj != OOMADJ_FOREGRD_LOCKED && oom_adj != OOMADJ_FOREGRD_UNLOCKED) {
266 bundle_add(b, "_APP_NAME_", appname);
267 ret = syspopup_launch("lowmem-syspopup", b);
270 _I("popup lauch failed\n");
274 if (set_app_oomadj(ret, OOMADJ_SU) < 0) {
275 _E("Failed to set oom_adj");
283 int usbcon_def_predefine_action(int argc, char **argv)
288 int bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
290 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_USB_ONLINE, &val) == 0) {
292 vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,
293 VCONFKEY_SYSMAN_USB_DISCONNECTED);
294 pm_unlock_internal(getpid(), LCD_OFF, STAY_CUR_STATE);
298 if ( vconf_get_int(VCONFKEY_SYSMAN_USB_STATUS, &val) == 0 && val == VCONFKEY_SYSMAN_USB_AVAILABLE)
301 vconf_set_int(VCONFKEY_SYSMAN_USB_STATUS,
302 VCONFKEY_SYSMAN_USB_AVAILABLE);
303 pm_lock_internal(getpid(), LCD_OFF, STAY_CUR_STATE, 0);
304 pid = ss_launch_if_noexist(USBCON_EXEC_PATH, NULL);
306 _E("usb predefine action failed\n");
311 _E("failed to get usb status\n");
315 int earjackcon_def_predefine_action(int argc, char **argv)
319 _I("earjack_normal predefine action\n");
320 if (device_get_property(DEVICE_TYPE_EXTCON, PROP_EXTCON_EARJACK_ONLINE, &val) == 0) {
321 return vconf_set_int(VCONFKEY_SYSMAN_EARJACK, val);
327 int lowbat_popup(void *data)
329 int ret = -1, state = 0;
330 ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
331 if (state == 1 || ret != 0) {
334 if (lowbat_popup_option == LOWBAT_OPT_WARNING || lowbat_popup_option == LOWBAT_OPT_CHECK) {
335 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
336 } else if(lowbat_popup_option == LOWBAT_OPT_POWEROFF) {
337 bundle_add(b, "_SYSPOPUP_CONTENT_", "poweroff");
338 } else if(lowbat_popup_option == LOWBAT_OPT_CHARGEERR) {
339 bundle_add(b, "_SYSPOPUP_CONTENT_", "chargeerr");
341 bundle_add(b, "_SYSPOPUP_CONTENT_", "check");
344 ret = syspopup_launch("lowbat-syspopup", b);
346 _I("popup lauch failed\n");
350 lowbat_popup_id = NULL;
351 lowbat_popup_option = 0;
354 _I("boot-animation running yet");
362 int predefine_control_launch(char *name, bundle *b)
365 static int launched_poweroff = 0;
367 if (strncmp(name, LOWBAT_POPUP_NAME, strlen(LOWBAT_POPUP_NAME)) == 0) {
368 if (launched_poweroff == 1) {
369 _E("will be foreced power off");
370 internal_poweroff_def_predefine_action(0,NULL);
374 if (lowbat_popup_option == LOWBAT_OPT_POWEROFF)
375 launched_poweroff = 1;
377 pid = __predefine_get_pid(LOWBAT_EXEC_PATH);
379 _E("pre launched %s destroy", LOWBAT_EXEC_PATH);
382 if (syspopup_launch(name, b) < 0)
386 if (strncmp(name, POWEROFF_POPUP_NAME, strlen(POWEROFF_POPUP_NAME)) == 0) {
387 if (syspopup_launch(name, b) < 0)
391 if (strncmp(name, HDMI_POPUP_NAME, strlen(HDMI_POPUP_NAME)) == 0) {
392 if (syspopup_launch(name, b) < 0)
396 if (strncmp(name, HDMI_NOTI_EXEC_PATH, strlen(HDMI_NOTI_EXEC_PATH)) == 0) {
397 if (ss_launch_if_noexist(name, "1") < 0)
400 //user mem lowmem-popup
401 if (strncmp(name, LOWMEM_POPUP_NAME, strlen(LOWMEM_POPUP_NAME)) == 0) {
402 if (syspopup_launch(name, b) < 0)
408 void predefine_pm_change_state(unsigned int s_bits)
410 pm_change_internal(getpid(), s_bits);
413 int lowbat_def_predefine_action(int argc, char **argv)
422 if (lowbat_popup_id != NULL) {
423 ecore_timer_del(lowbat_popup_id);
424 lowbat_popup_id = NULL;
429 if (!strcmp(argv[0],CRITICAL_LOW_BAT_ACT)) {
430 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
431 lowbat_popup_option = LOWBAT_OPT_CHECK;
432 } else if(!strcmp(argv[0],WARNING_LOW_BAT_ACT)) {
433 bundle_add(b, "_SYSPOPUP_CONTENT_", "warning");
434 lowbat_popup_option = LOWBAT_OPT_WARNING;
435 } else if(!strcmp(argv[0],POWER_OFF_BAT_ACT)) {
436 bundle_add(b, "_SYSPOPUP_CONTENT_", "poweroff");
437 lowbat_popup_option = LOWBAT_OPT_POWEROFF;
438 } else if(!strcmp(argv[0],CHARGE_ERROR_ACT)) {
439 bundle_add(b, "_SYSPOPUP_CONTENT_", "chargeerr");
440 lowbat_popup_option = LOWBAT_OPT_CHARGEERR;
443 ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &state);
444 if (state == 1 || ret != 0) {
445 if (predefine_control_launch("lowbat-syspopup", b) < 0) {
446 _E("popup lauch failed\n");
448 lowbat_popup_option = 0;
452 _I("boot-animation running yet");
453 lowbat_popup_id = ecore_timer_add(1, lowbat_popup, NULL);
459 Eina_Bool powerdown_ap_by_force(void *data)
462 int poweroff_duration = POWEROFF_DURATION;
465 if(tapi_handle != NULL)
467 tel_deinit(tapi_handle);
470 /* Getting poweroff duration */
471 buf = getenv("PWROFF_DUR");
472 if (buf != NULL && strlen(buf) < 1024)
473 poweroff_duration = atoi(buf);
474 if (poweroff_duration < 0 || poweroff_duration > 60)
475 poweroff_duration = POWEROFF_DURATION;
477 gettimeofday(&now, NULL);
478 /* Waiting until power off duration and displaying animation */
479 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
481 gettimeofday(&now, NULL);
484 _D("Power off by force\n");
485 /* give a chance to be terminated for each process */
489 reboot(RB_POWER_OFF);
493 static void powerdown_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
496 int poweroff_duration = POWEROFF_DURATION;
499 if (poweroff_timer_id) {
500 ecore_timer_del(poweroff_timer_id);
501 poweroff_timer_id = NULL;
504 tel_deregister_noti_event(tapi_handle,TAPI_NOTI_MODEM_POWER);
505 tel_deinit(tapi_handle);
510 /* Getting poweroff duration */
511 buf = getenv("PWROFF_DUR");
512 if (buf != NULL && strlen(buf) < 1024)
513 poweroff_duration = atoi(buf);
514 if (poweroff_duration < 0 || poweroff_duration > 60)
515 poweroff_duration = POWEROFF_DURATION;
517 gettimeofday(&now, NULL);
518 /* Waiting until power off duration and displaying animation */
519 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
521 gettimeofday(&now, NULL);
524 /* give a chance to be terminated for each process */
528 reboot(RB_POWER_OFF);
530 static void powerdown_res_cb(TapiHandle *handle, int result, void *data, void *user_data)
532 _D("poweroff command request : %d",result);
535 int poweroff_def_predefine_action(int argc, char **argv)
539 heynoti_publish(POWEROFF_NOTI_NAME);
541 while (retry_count < MAX_RETRY) {
542 if (ss_action_entry_call_internal(PREDEF_INTERNAL_POWEROFF, 0) < 0) {
543 _E("failed to request poweroff to system_server \n");
547 vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void*)poweroff_control_cb);
553 int internal_poweroff_def_predefine_action(int argc, char **argv)
557 system( LIBPATH"/system-server/shutdown.sh &");
560 gettimeofday(&tv_start_poweroff, NULL);
562 ret = tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, powerdown_ap, NULL);
564 if (ret != TAPI_API_SUCCESS) {
566 ("tel_register_event is not subscribed. error %d\n", ret);
567 powerdown_ap_by_force(NULL);
571 ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
572 if (ret != TAPI_API_SUCCESS) {
573 _E("tel_process_power_command() error %d\n", ret);
574 powerdown_ap_by_force(NULL);
577 poweroff_timer_id = ecore_timer_add(15, powerdown_ap_by_force, NULL);
579 powerdown_ap_by_force(NULL);
584 static void enter_flight_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
586 int bCurFlightMode = 0;
587 if (result != TAPI_POWER_FLIGHT_MODE_ENTER) {
588 _E("flight mode enter failed %d",result);
590 _D("enter flight mode result : %d",result);
591 if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
592 _D("Flight Mode is %d", bCurFlightMode);
594 _E("failed to get vconf key");
599 static void leave_flight_mode_cb(TapiHandle *handle, int result, void *data, void *user_data)
601 int bCurFlightMode = 0;
602 if (result != TAPI_POWER_FLIGHT_MODE_LEAVE) {
603 _E("flight mode leave failed %d",result);
605 _D("leave flight mode result : %d",result);
606 if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE,&bCurFlightMode) == 0) {
607 _D("Flight Mode is %d", bCurFlightMode);
609 _E("failed to get vconf key");
614 int entersleep_def_predefine_action(int argc, char **argv)
618 pm_change_internal(getpid(), LCD_NORMAL);
621 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
622 _E("request for changing into flight mode : %d\n", ret);
624 system("/etc/rc.d/rc.entersleep");
625 pm_change_internal(getpid(), POWER_OFF);
630 int leavesleep_def_predefine_action(int argc, char **argv)
634 pm_change_internal(getpid(), LCD_NORMAL);
637 ret = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL);
638 _E("request for changing into flight mode : %d\n", ret);
643 static void restart_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data);
645 Eina_Bool restart_ap_ecore(void *data)
647 restart_ap(tapi_handle,NULL,(void *)-1,NULL);
651 static void restart_ap(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
654 int poweroff_duration = POWEROFF_DURATION;
657 if (poweroff_timer_id) {
658 ecore_timer_del(poweroff_timer_id);
659 poweroff_timer_id = NULL;
663 if(tapi_handle != NULL)
665 tel_deregister_noti_event(tapi_handle,TAPI_NOTI_MODEM_POWER);
666 tel_deinit(tapi_handle);
671 vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void*)poweroff_control_cb);
675 buf = getenv("PWROFF_DUR");
676 if (buf != NULL && strlen(buf) < 1024)
677 poweroff_duration = atoi(buf);
678 if (poweroff_duration < 0 || poweroff_duration > 60)
679 poweroff_duration = POWEROFF_DURATION;
680 gettimeofday(&now, NULL);
681 while (now.tv_sec - tv_start_poweroff.tv_sec < poweroff_duration) {
683 gettimeofday(&now, NULL);
690 static void restart_ap_by_force(void *data)
693 int poweroff_duration = POWEROFF_DURATION;
696 if (poweroff_timer_id) {
697 ecore_timer_del(poweroff_timer_id);
698 poweroff_timer_id = NULL;
702 if(tapi_handle != NULL)
704 tel_deinit(tapi_handle);
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 heynoti_publish(POWEROFF_NOTI_NAME);
732 pm_change_internal(getpid(), LCD_NORMAL);
733 system(LIBPATH"/system-server/shutdown.sh &");
736 gettimeofday(&tv_start_poweroff, NULL);
739 tel_register_noti_event(tapi_handle, TAPI_NOTI_MODEM_POWER, restart_ap, NULL);
740 if (ret != TAPI_API_SUCCESS) {
742 ("tel_register_event is not subscribed. error %d\n", ret);
743 restart_ap_by_force((void *)-1);
748 ret = tel_process_power_command(tapi_handle, TAPI_PHONE_POWER_OFF, powerdown_res_cb, NULL);
749 if (ret != TAPI_API_SUCCESS) {
750 _E("tel_process_power_command() error %d\n", ret);
751 restart_ap_by_force((void *)-1);
755 poweroff_timer_id = ecore_timer_add(15, restart_ap_ecore, NULL);
759 int launching_predefine_action(int argc, char **argv)
766 /* current just launching poweroff-popup */
767 if (predefine_control_launch("poweroff-syspopup", NULL) < 0) {
768 _E("poweroff-syspopup launch failed");
774 int flight_mode_def_predefine_action(int argc, char **argv)
777 int err = TAPI_API_SUCCESS;
778 if (argc != 1 || argv[0] == NULL) {
779 _E("FlightMode Set predefine action failed");
782 bCurFlightMode = atoi(argv[0]);
783 if (bCurFlightMode == 1) {
784 err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_LEAVE, leave_flight_mode_cb, NULL);
785 } else if (bCurFlightMode == 0) {
786 err = tel_set_flight_mode(tapi_handle, TAPI_POWER_FLIGHT_MODE_ENTER, enter_flight_mode_cb, NULL);
788 if (err != TAPI_API_SUCCESS)
789 _E("FlightMode tel api action failed %d",err);
794 static void ss_action_entry_load_from_sodir()
797 struct dirent *dentry;
802 dp = opendir(PREDEFINE_SO_DIR);
804 _E("fail open %s", PREDEFINE_SO_DIR);
808 msg = malloc(sizeof(struct sysnoti));
817 while ((dentry = readdir(dp)) != NULL) {
818 if ((ext = strstr(dentry->d_name, ".so")) == NULL)
821 snprintf(tmp, sizeof(tmp), "%s/%s", PREDEFINE_SO_DIR,
825 msg->type = &(dentry->d_name[3]);
826 ss_action_entry_add(msg);
832 static void __tel_init_cb(keynode_t *key_nodes,void *data)
835 bTelReady = vconf_keynode_get_bool(key_nodes);
836 if (bTelReady == 1) {
837 vconf_ignore_key_changed(VCONFKEY_TELEPHONY_READY, (void*)__tel_init_cb);
838 tapi_handle = tel_init(NULL);
839 if (tapi_handle == NULL) {
840 _E("tapi init error");
843 _E("tapi is not ready yet");
846 static void poweroff_control_cb(keynode_t *in_key, struct ss_main_data *ad)
849 if (vconf_get_int(VCONFKEY_SYSMAN_POWER_OFF_STATUS, &val) != 0)
852 case VCONFKEY_SYSMAN_POWER_OFF_DIRECT:
853 ss_action_entry_call_internal(PREDEF_POWEROFF, 0);
855 case VCONFKEY_SYSMAN_POWER_OFF_POPUP:
856 ss_action_entry_call_internal(PREDEF_PWROFF_POPUP, 0);
858 case VCONFKEY_SYSMAN_POWER_OFF_RESTART:
859 ss_action_entry_call_internal(PREDEF_REBOOT, 0);
864 void ss_predefine_internal_init(void)
867 /* telephony initialize */
870 if (vconf_get_bool(VCONFKEY_TELEPHONY_READY,&bTelReady) == 0) {
871 if (bTelReady == 1) {
872 tapi_handle = tel_init(NULL);
873 if (tapi_handle == NULL) {
874 _E("tapi init error");
877 vconf_notify_key_changed(VCONFKEY_TELEPHONY_READY, (void *)__tel_init_cb, NULL);
880 _E("failed to get tapi vconf key");
883 ss_action_entry_add_internal(PREDEF_CALL, call_predefine_action, NULL,
886 ss_action_entry_add_internal(PREDEF_LOWMEM, lowmem_def_predefine_action,
888 ss_action_entry_add_internal(PREDEF_LOWBAT, lowbat_def_predefine_action,
890 ss_action_entry_add_internal(PREDEF_USBCON, usbcon_def_predefine_action,
892 ss_action_entry_add_internal(PREDEF_EARJACKCON,
893 earjackcon_def_predefine_action, NULL,
895 ss_action_entry_add_internal(PREDEF_POWEROFF,
896 poweroff_def_predefine_action, NULL, NULL);
897 ss_action_entry_add_internal(PREDEF_PWROFF_POPUP,
898 launching_predefine_action, NULL, NULL);
899 ss_action_entry_add_internal(PREDEF_REBOOT,
900 restart_def_predefine_action, NULL, NULL);
901 ss_action_entry_add_internal(PREDEF_FLIGHT_MODE,
902 flight_mode_def_predefine_action, NULL, NULL);
903 ss_action_entry_add_internal(PREDEF_INTERNAL_POWEROFF,
904 internal_poweroff_def_predefine_action, NULL, NULL);
905 ss_action_entry_add_internal(PREDEF_HAPTIC, haptic_def_predefine_action,
908 ss_action_entry_add_internal(PREDEF_LED,
909 led_def_predefine_action, NULL, NULL);
911 if (vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS, (void *)poweroff_control_cb, NULL) < 0) {
912 _E("Vconf notify key chaneged failed: KEY(%s)", VCONFKEY_SYSMAN_POWER_OFF_STATUS);
914 ss_action_entry_load_from_sodir();
916 /* check and set earjack init status */
917 earjackcon_def_predefine_action(0, NULL);