power: send watchdog ping during power off 84/103784/1 accepted/tizen/3.0/common/20161212.060605 accepted/tizen/3.0/ivi/20161212.023858 accepted/tizen/3.0/mobile/20161212.023752 accepted/tizen/3.0/tv/20161212.023827 accepted/tizen/3.0/wearable/20161212.023840 submit/tizen_3.0/20161209.130513
authortaeyoung <ty317.kim@samsung.com>
Fri, 9 Dec 2016 11:04:24 +0000 (20:04 +0900)
committertaeyoung <ty317.kim@samsung.com>
Fri, 9 Dec 2016 11:04:24 +0000 (20:04 +0900)
- Power off operation takes time, and deviced can be
  killed by systemd. Thus deviced sends watchdog ping
  during power off.

Change-Id: I61421cf75bed47e71281af0339ba12522c6913e3
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/core/common.h
src/core/main.c
src/power/power-handler.c
src/telephony/telephony.c

index 5f99f44..b71352e 100644 (file)
@@ -154,6 +154,7 @@ void print_time(const char *prefix);
 int umount_partition(const char *path, const bool force);
 int get_privilege(pid_t pid, char *name, size_t len);
 bool is_emulator(void);
+void watchdog_notify(void);
 
 #endif /* __CORE_COMMON_H__ */
 
index e663a46..86395c8 100644 (file)
@@ -33,7 +33,7 @@
 #include "device-notifier.h"
 
 #define PIDFILE_PATH           "/var/run/.deviced.pid"
-#define WATCHDOG_TIMEOUT       10
+#define WATCHDOG_TIMEOUT       15
 
 static void writepid(char *pidpath)
 {
@@ -58,11 +58,16 @@ static void sig_usr1(int signo)
        ecore_main_loop_quit();
 }
 
-static Eina_Bool watchdog_cb(void *data)
+void watchdog_notify(void)
 {
        int ret = aw_notify();
        if (ret < 0)
-               _E("aw_notify failed");
+               _E("aw_notify failed(%d)", ret);
+}
+
+static Eina_Bool watchdog_cb(void *data)
+{
+       watchdog_notify();
        return ECORE_CALLBACK_RENEW;
 }
 
index 9f7a216..b647d76 100644 (file)
@@ -107,12 +107,6 @@ static int app_privileged(pid_t pid)
        return 0;
 }
 
-static void poweroff_stop_systemd_service(void)
-{
-       _D("systemd service stop");
-       umount2("/sys/fs/cgroup", MNT_FORCE |MNT_DETACH);
-}
-
 static int stop_systemd_journald(void)
 {
        int ret;
@@ -214,7 +208,7 @@ static void powerdown(void)
                        break;
        }
 
-       poweroff_stop_systemd_service();
+       watchdog_notify();
 
 #ifndef EMULATOR
        unmount_rw_partition();
@@ -282,6 +276,7 @@ static int poweroff(void)
        display_device_ops->exit(NULL);
        sync();
 
+       watchdog_notify();
        ret = telephony_off(POWER_OFF_DIRECT);
        if (ret < 0) {
                powerdown_ap(NULL);
@@ -309,6 +304,7 @@ static int power_reboot(void)
        display_device_ops->exit(NULL);
        sync();
 
+       watchdog_notify();
        ret = telephony_off(POWER_OFF_RESTART);
        if (ret < 0) {
                restart_ap(NULL);
@@ -420,6 +416,8 @@ static void poweroff_idler_cb(void *data)
 {
        enum poweroff_type val = (long)data;
 
+       watchdog_notify();
+
        make_power_flag(val, NULL);
 
        pm_lock_internal(INTERNAL_LOCK_POWEROFF, LCD_OFF, STAY_CUR_STATE, 0);
index b1452ea..c0893ec 100644 (file)
@@ -30,7 +30,7 @@
 #include "core/edbus-handler.h"
 #include "power/power-handler.h"
 
-#define TELEPHONY_NOTI_TIMEOUT 15000 /* milliseconds */
+#define TELEPHONY_NOTI_TIMEOUT 10000 /* milliseconds */
 
 static TapiHandle *tapi_handle;
 static enum poweroff_type type;