int pid = amd_app_status_get_pid(app_status);
uid_t uid;
proc_context *ctx;
- int operation_state;
ctx = __find_proc_context(pid);
if (ctx) {
__watchdog.proc_contexts = g_list_append(__watchdog.proc_contexts, ctx);
+ return AMD_NOTI_CONTINUE;
+}
+
+static int __on_app_status_app_start(const char *msg, int arg1, int arg2,
+ void *arg3, bundle *arg4)
+{
+ pid_t pid = arg1;
+ proc_context *ctx;
+ int operation_state;
+ int ret;
+
operation_state = _watchdog_config_get_operation_state();
- if (operation_state == WATCHDOG_ENABLE_BY_DEFAULT) {
- __watchdog_set_timer(ctx);
- ctx->watchdog_enable = true;
- _watchdog_logger_print("ENABLE", "pid(%d), appid(%s)",
- pid, amd_app_status_get_appid(app_status));
+ if (operation_state != WATCHDOG_ENABLE_BY_DEFAULT)
+ return AMD_NOTI_CONTINUE;
+
+ ctx = __find_proc_context(pid);
+ if (ctx == NULL) {
+ _E("Failed to find proc status. pid(%d)", pid);
+ return AMD_NOTI_CONTINUE;
}
+ ret = __send_request(ctx, WATCHDOG_ENABLE, __watchdog.interval);
+ _W("pid(%d), result(%d)", pid, ret);
+
+ __watchdog_set_timer(ctx);
+ ctx->watchdog_enable = true;
+ _watchdog_logger_print("ENABLE", "pid(%d)", pid);
+
return AMD_NOTI_CONTINUE;
}
amd_noti_listen(AMD_NOTI_MSG_APP_STATUS_ADD,
__on_app_status_add);
+ amd_noti_listen(AMD_NOTI_MSG_APP_STATUS_APP_START,
+ __on_app_status_app_start);
amd_noti_listen(AMD_NOTI_MSG_APP_STATUS_CLEANUP,
__on_app_status_cleanup);
amd_noti_listen(AMD_NOTI_MSG_SIGNAL_SEND_WATCHDOG_START,