From 08ac7eb782bc30c969cebba62a48a70cba340871 Mon Sep 17 00:00:00 2001 From: Yunhee Seo Date: Wed, 10 May 2023 16:42:30 +0900 Subject: [PATCH] display: misc: Relocate save_display_log()/print_info() to reduce plugin duplication To move display-lock/lock-detector files to core, save_display_log, print_info functions are also relocated. Because there is a dependence between files and functions. This function is added to below display-misc. void display_misc_save_display_log(const char *path); -> This function is called when the poweroff notify, sighup situation or dbus method is called to save display log. Change-Id: I8d8865aa3fc04ab3ac51e7e3106bdd3f42baf92e Signed-off-by: Yunhee Seo --- plugins/iot-headed/display/core.c | 112 ------------------- plugins/mobile/display/core.c | 112 ------------------- plugins/tv/display/core.c | 112 ------------------- plugins/wearable/display/core.c | 112 ------------------- src/display/core.h | 1 - src/display/{plugin-common => }/display-lock.c | 0 src/display/{plugin-common => }/display-lock.h | 0 src/display/display-misc.c | 136 ++++++++++++++++++++++++ src/display/display-misc.h | 1 + src/display/display-plugin.c | 1 + src/display/{plugin-common => }/lock-detector.c | 5 +- src/display/{plugin-common => }/lock-detector.h | 0 src/power/power-off.c | 2 +- 13 files changed, 142 insertions(+), 452 deletions(-) rename src/display/{plugin-common => }/display-lock.c (100%) rename src/display/{plugin-common => }/display-lock.h (100%) rename src/display/{plugin-common => }/lock-detector.c (98%) rename src/display/{plugin-common => }/lock-detector.h (100%) diff --git a/plugins/iot-headed/display/core.c b/plugins/iot-headed/display/core.c index 0278ef0..9cfcc87 100644 --- a/plugins/iot-headed/display/core.c +++ b/plugins/iot-headed/display/core.c @@ -927,118 +927,6 @@ void update_lcdoff_source(int source) _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno()); } -void print_info(int fd) -{ - int s_index = 0; - char buf[PATH_MAX + 255]; - int i = 1; - int ret; - char pname[PATH_MAX]; - PmLockNode *t; - GList *elem; - char time_buf[30]; - - if (fd < 0) - return; - - snprintf(buf, sizeof(buf), - "\n===========================================" - "===========================\n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", - states[S_NORMAL].timeout, - states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", - (get_trans_condition() & MASK_NORMAL) ? states[S_NORMAL].name : "-", - (get_trans_condition() & MASK_DIM) ? states[S_LCDDIM].name : "-", - (get_trans_condition() & MASK_OFF) ? states[S_LCDOFF].name : "-"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current State: %s\n", - states[get_pm_cur_state()].name); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - for (s_index = S_NORMAL; s_index < S_END; s_index++) { - SYS_G_LIST_FOREACH(get_cond_head(s_index), elem, t) { - display_misc_get_process_name((pid_t)t->pid, pname); - ctime_r(&t->time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - snprintf(buf, sizeof(buf), - " %d: [%s] locked by pid %d %s %s\n", - i++, states[s_index].name, t->pid, pname, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - } - } - - print_lock_info_list(fd); - -#ifdef ENABLE_PM_LOG - pm_history_print(fd, 250); -#endif -} - -void save_display_log(const char *path) -{ - int fd, ret; - char buf[255]; - time_t now_time; - char time_buf[30]; - - _D("internal state is saved!"); - - time(&now_time); - ctime_r(&now_time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - - fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if (fd != -1) { - snprintf(buf, sizeof(buf), - "\npm_state_log now-time : %d(s) %s\n\n", - (int)now_time, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - snprintf(buf, sizeof(buf), "pm_status_flag: %#x\n", get_pm_status_flag()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - if (disp_plgn->get_lock_screen_state ) { - snprintf(buf, sizeof(buf), "screen lock status : %d\n", - disp_plgn->get_lock_screen_state()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - } - print_info(fd); - close(fd); - } - - fd = open("/dev/console", O_WRONLY); - if (fd != -1) { - print_info(fd); - close(fd); - } -} - /* SIGHUP signal handler * For debug... print info to syslog */ diff --git a/plugins/mobile/display/core.c b/plugins/mobile/display/core.c index 19e752e..a35689d 100644 --- a/plugins/mobile/display/core.c +++ b/plugins/mobile/display/core.c @@ -937,118 +937,6 @@ void update_lcdoff_source(int source) _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno()); } -void print_info(int fd) -{ - int s_index = 0; - char buf[PATH_MAX + 255]; - int i = 1; - int ret; - char pname[PATH_MAX]; - PmLockNode *t; - GList *elem; - char time_buf[30]; - - if (fd < 0) - return; - - snprintf(buf, sizeof(buf), - "\n===========================================" - "===========================\n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", - states[S_NORMAL].timeout, - states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", - (get_trans_condition() & MASK_NORMAL) ? states[S_NORMAL].name : "-", - (get_trans_condition() & MASK_DIM) ? states[S_LCDDIM].name : "-", - (get_trans_condition() & MASK_OFF) ? states[S_LCDOFF].name : "-"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current State: %s\n", - states[get_pm_cur_state()].name); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - for (s_index = S_NORMAL; s_index < S_END; s_index++) { - SYS_G_LIST_FOREACH(get_cond_head(s_index), elem, t) { - display_misc_get_process_name((pid_t)t->pid, pname); - ctime_r(&t->time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - snprintf(buf, sizeof(buf), - " %d: [%s] locked by pid %d %s %s\n", - i++, states[s_index].name, t->pid, pname, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - } - } - - print_lock_info_list(fd); - -#ifdef ENABLE_PM_LOG - pm_history_print(fd, 250); -#endif -} - -void save_display_log(const char *path) -{ - int fd, ret; - char buf[255]; - time_t now_time; - char time_buf[30]; - - _D("internal state is saved!"); - - time(&now_time); - ctime_r(&now_time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - - fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if (fd != -1) { - snprintf(buf, sizeof(buf), - "\npm_state_log now-time : %d(s) %s\n\n", - (int)now_time, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - snprintf(buf, sizeof(buf), "pm_status_flag: %#x\n", get_pm_status_flag()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - if (disp_plgn->get_lock_screen_state ) { - snprintf(buf, sizeof(buf), "screen lock status : %d\n", - disp_plgn->get_lock_screen_state()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - } - print_info(fd); - close(fd); - } - - fd = open("/dev/console", O_WRONLY); - if (fd != -1) { - print_info(fd); - close(fd); - } -} - /* SIGHUP signal handler * For debug... print info to syslog */ diff --git a/plugins/tv/display/core.c b/plugins/tv/display/core.c index a008cbf..5f55e81 100644 --- a/plugins/tv/display/core.c +++ b/plugins/tv/display/core.c @@ -927,118 +927,6 @@ void update_lcdoff_source(int source) _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno()); } -void print_info(int fd) -{ - int s_index = 0; - char buf[PATH_MAX + 255]; - int i = 1; - int ret; - char pname[PATH_MAX]; - PmLockNode *t; - GList *elem; - char time_buf[30]; - - if (fd < 0) - return; - - snprintf(buf, sizeof(buf), - "\n===========================================" - "===========================\n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", - states[S_NORMAL].timeout, - states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", - (get_trans_condition() & MASK_NORMAL) ? states[S_NORMAL].name : "-", - (get_trans_condition() & MASK_DIM) ? states[S_LCDDIM].name : "-", - (get_trans_condition() & MASK_OFF) ? states[S_LCDOFF].name : "-"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current State: %s\n", - states[get_pm_cur_state()].name); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - for (s_index = S_NORMAL; s_index < S_END; s_index++) { - SYS_G_LIST_FOREACH(get_cond_head(s_index), elem, t) { - display_misc_get_process_name((pid_t)t->pid, pname); - ctime_r(&t->time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - snprintf(buf, sizeof(buf), - " %d: [%s] locked by pid %d %s %s\n", - i++, states[s_index].name, t->pid, pname, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - } - } - - print_lock_info_list(fd); - -#ifdef ENABLE_PM_LOG - pm_history_print(fd, 250); -#endif -} - -void save_display_log(const char *path) -{ - int fd, ret; - char buf[255]; - time_t now_time; - char time_buf[30]; - - _D("internal state is saved!"); - - time(&now_time); - ctime_r(&now_time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - - fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if (fd != -1) { - snprintf(buf, sizeof(buf), - "\npm_state_log now-time : %d(s) %s\n\n", - (int)now_time, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - snprintf(buf, sizeof(buf), "pm_status_flag: %#x\n", get_pm_status_flag()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - if (disp_plgn->get_lock_screen_state ) { - snprintf(buf, sizeof(buf), "screen lock status : %d\n", - disp_plgn->get_lock_screen_state()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - } - print_info(fd); - close(fd); - } - - fd = open("/dev/console", O_WRONLY); - if (fd != -1) { - print_info(fd); - close(fd); - } -} - /* SIGHUP signal handler * For debug... print info to syslog */ diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index f16c389..4976023 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -1237,118 +1237,6 @@ void update_lcdoff_source(int source) _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno()); } -void print_info(int fd) -{ - int s_index = 0; - char buf[PATH_MAX + 255]; - int i = 1; - int ret; - char pname[PATH_MAX]; - PmLockNode *t; - GList *elem; - char time_buf[30]; - - if (fd < 0) - return; - - snprintf(buf, sizeof(buf), - "\n===========================================" - "===========================\n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", - states[S_NORMAL].timeout, - states[S_LCDDIM].timeout, states[S_LCDOFF].timeout); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", - (get_trans_condition() & MASK_NORMAL) ? states[S_NORMAL].name : "-", - (get_trans_condition() & MASK_DIM) ? states[S_LCDDIM].name : "-", - (get_trans_condition() & MASK_OFF) ? states[S_LCDOFF].name : "-"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current State: %s\n", - states[get_pm_cur_state()].name); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - - for (s_index = S_NORMAL; s_index < S_END; s_index++) { - SYS_G_LIST_FOREACH(get_cond_head(s_index), elem, t) { - display_misc_get_process_name((pid_t)t->pid, pname); - ctime_r(&t->time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - snprintf(buf, sizeof(buf), - " %d: [%s] locked by pid %d %s %s\n", - i++, states[s_index].name, t->pid, pname, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("Write() failed: %d", errno); - } - } - - print_lock_info_list(fd); - -#ifdef ENABLE_PM_LOG - pm_history_print(fd, 250); -#endif -} - -void save_display_log(const char *path) -{ - int fd, ret; - char buf[255]; - time_t now_time; - char time_buf[30]; - - _D("internal state is saved!"); - - time(&now_time); - ctime_r(&now_time, time_buf); - time_buf[strlen(time_buf) - 1] = 0; - - fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if (fd != -1) { - snprintf(buf, sizeof(buf), - "\npm_state_log now-time : %d(s) %s\n\n", - (int)now_time, time_buf); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - snprintf(buf, sizeof(buf), "pm_status_flag: %#x\n", get_pm_status_flag()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - - if (disp_plgn->get_lock_screen_state ) { - snprintf(buf, sizeof(buf), "screen lock status : %d\n", - disp_plgn->get_lock_screen_state()); - ret = write(fd, buf, strlen(buf)); - if (ret < 0) - _E("write() failed (%d)", errno); - } - print_info(fd); - close(fd); - } - - fd = open("/dev/console", O_WRONLY); - if (fd != -1) { - print_info(fd); - close(fd); - } -} - /* SIGHUP signal handler * For debug... print info to syslog */ diff --git a/src/display/core.h b/src/display/core.h index 95502e3..b0141cd 100644 --- a/src/display/core.h +++ b/src/display/core.h @@ -138,7 +138,6 @@ int display_on_by_reason(const char *reason, int timeout); int display_off_by_reason(const char *reason); void update_lcdoff_source(int source); int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name); -void save_display_log(const char *path); int custom_lcdon(int timeout); void lcd_on_direct(enum device_flags flags); void lcd_on_procedure(int state, enum device_flags flag); diff --git a/src/display/plugin-common/display-lock.c b/src/display/display-lock.c similarity index 100% rename from src/display/plugin-common/display-lock.c rename to src/display/display-lock.c diff --git a/src/display/plugin-common/display-lock.h b/src/display/display-lock.h similarity index 100% rename from src/display/plugin-common/display-lock.h rename to src/display/display-lock.h diff --git a/src/display/display-misc.c b/src/display/display-misc.c index c0bb9f8..ec3cc91 100644 --- a/src/display/display-misc.c +++ b/src/display/display-misc.c @@ -18,17 +18,23 @@ #include #include +#include +#include #include #include "battery/power-supply.h" #include "shared/device-notifier.h" #include "shared/log.h" +#include "core.h" #include "display.h" #include "display-backlight.h" +#include "display-lock.h" #include "display-misc.h" #include "display-panel.h" #include "display-plugin.h" +#include "display-state-transition.h" +#include "lock-detector.h" #include "poll.h" static bool stay_touchscreen_off = false; @@ -120,4 +126,134 @@ void display_misc_register_battery_health_notifier(void) void display_misc_unregister_battery_health_notifier(void) { unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, changed_battery_health); +} + +static void print_info(int fd) +{ + int s_index = 0; + char buf[PATH_MAX + 255]; + int i = 1; + int ret; + char pname[PATH_MAX]; + PmLockNode *t; + GList *elem; + char time_buf[30]; + int normal_state_timeout; + int dim_state_timeout; + int off_stata_timeout; + const char *normal_state_name; + const char *dim_state_name; + const char *off_state_name; + const char *current_state_name; + + display_plugin_state_get_timeout(S_NORMAL, &normal_state_timeout); + display_plugin_state_get_timeout(S_LCDDIM, &dim_state_timeout); + display_plugin_state_get_timeout(S_LCDOFF, &off_stata_timeout); + + if (fd < 0) + return; + + snprintf(buf, sizeof(buf), + "\n===========================================" + "===========================\n"); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + snprintf(buf, sizeof(buf), "Timeout Info: Run[%dms] Dim[%dms] Off[%dms]\n", + normal_state_timeout, dim_state_timeout, off_stata_timeout); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + + display_plugin_state_get_name(S_NORMAL, &normal_state_name); + display_plugin_state_get_name(S_LCDDIM, &dim_state_name); + display_plugin_state_get_name(S_LCDOFF, &off_state_name); + snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n", + (get_trans_condition() & MASK_NORMAL) ? normal_state_name : "-", + (get_trans_condition() & MASK_DIM) ? dim_state_name : "-", + (get_trans_condition() & MASK_OFF) ? off_state_name : "-"); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + + display_plugin_state_get_name(get_pm_cur_state(), ¤t_state_name); + snprintf(buf, sizeof(buf), "Current State: %s\n", current_state_name); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + + snprintf(buf, sizeof(buf), "Current Lock Conditions: \n"); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + + for (s_index = S_NORMAL; s_index < S_END; s_index++) { + SYS_G_LIST_FOREACH(get_cond_head(s_index), elem, t) { + display_misc_get_process_name((pid_t)t->pid, pname); + ctime_r(&t->time, time_buf); + time_buf[strlen(time_buf) - 1] = 0; + display_plugin_state_get_name(s_index, ¤t_state_name); + snprintf(buf, sizeof(buf), + " %d: [%s] locked by pid %d %s %s\n", + i++, current_state_name, t->pid, pname, time_buf); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("Write() failed: %d", errno); + } + } + + print_lock_info_list(fd); + +#ifdef ENABLE_PM_LOG + pm_history_print(fd, 250); +#endif +} + +/** FIXME: This function should be relocated after refactoring. + * Because, display log functions are spreaded to slave-logging.c, lock-detector.c. + * Function location should be discussed. + */ +void display_misc_save_display_log(const char *path) +{ + int fd, ret; + char buf[255]; + time_t now_time; + char time_buf[30]; + + _D("internal state is saved!"); + + time(&now_time); + ctime_r(&now_time, time_buf); + time_buf[strlen(time_buf) - 1] = 0; + + fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0644); + if (fd != -1) { + snprintf(buf, sizeof(buf), + "\npm_state_log now-time : %d(s) %s\n\n", + (int)now_time, time_buf); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("write() failed (%d)", errno); + + snprintf(buf, sizeof(buf), "pm_status_flag: %#x\n", get_pm_status_flag()); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("write() failed (%d)", errno); + + /* FIXME: display_plugin_get_lock_screen_state should be checked return value after modification */ + snprintf(buf, sizeof(buf), "screen lock status : %d\n", + display_plugin_get_lock_screen_state()); + ret = write(fd, buf, strlen(buf)); + if (ret < 0) + _E("write() failed (%d)", errno); + + print_info(fd); + close(fd); + } + + fd = open("/dev/console", O_WRONLY); + if (fd != -1) { + print_info(fd); + close(fd); + } } \ No newline at end of file diff --git a/src/display/display-misc.h b/src/display/display-misc.h index 0ddb640..3176350 100644 --- a/src/display/display-misc.h +++ b/src/display/display-misc.h @@ -33,5 +33,6 @@ void display_misc_set_stay_touchscreen_off(bool on); void display_misc_get_stay_touchscreen_off(bool *on); void display_misc_register_battery_health_notifier(void); void display_misc_unregister_battery_health_notifier(void); +void display_misc_save_display_log(const char *path); #endif /* __DISPLAY_MISC_H__ */ \ No newline at end of file diff --git a/src/display/display-plugin.c b/src/display/display-plugin.c index 11f6483..62af72d 100644 --- a/src/display/display-plugin.c +++ b/src/display/display-plugin.c @@ -59,6 +59,7 @@ int display_plugin_update_pm_setting(int key_idx, int val) return 0; } +/* FIXME: return 0 can be value of get_lock_screen_state, it is hard to distinguish error or not */ int display_plugin_get_lock_screen_state(void) { if (g_display_plugin.get_lock_screen_state) diff --git a/src/display/plugin-common/lock-detector.c b/src/display/lock-detector.c similarity index 98% rename from src/display/plugin-common/lock-detector.c rename to src/display/lock-detector.c index 0b6ae12..593d4f6 100644 --- a/src/display/plugin-common/lock-detector.c +++ b/src/display/lock-detector.c @@ -34,6 +34,7 @@ #include "util.h" #include "core.h" +#include "display-misc.h" #include "shared/device-notifier.h" struct lock_info { @@ -338,7 +339,7 @@ int pm_save_logdump(void) if (ret < 0) _W("Can not move(%d)", ret); - save_display_log(PM_STATE_LOG_FILE); + display_misc_save_display_log(PM_STATE_LOG_FILE); return ret; } @@ -352,7 +353,7 @@ static int pmlock_detector_poweroff_cb(void *data) if (ret < 0) _W("Can not move(%d)", ret); - save_display_log(PM_STATE_LOG_GHOST_PATH); + display_misc_save_display_log(PM_STATE_LOG_GHOST_PATH); return 0; } diff --git a/src/display/plugin-common/lock-detector.h b/src/display/lock-detector.h similarity index 100% rename from src/display/plugin-common/lock-detector.h rename to src/display/lock-detector.h diff --git a/src/power/power-off.c b/src/power/power-off.c index a42261f..1d4bdec 100644 --- a/src/power/power-off.c +++ b/src/power/power-off.c @@ -257,7 +257,7 @@ static gboolean __poweroff_main(gpointer data) - pmlock_detector_poweroff_cb() - cleanup_pmlock_statistics() - do_copy_force() - - save_display_log() + - display_misc_save_display_log() 2. tzip - tzip_poweroff() - tzip_server_exit() -- 2.7.4