display: Relocate display_state_transition_do_state_action() 06/297106/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 06:31:06 +0000 (15:31 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 06:37:19 +0000 (15:37 +0900)
The display_state_transition_do_state_action() of display-panel.c has
been moved to display-state-transition.c and it has renamed to
display_state_set_current().

Change-Id: Iff04254b484c56fd56db134978f805e12fcfc4b6
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/display/display-panel.c
src/display/display-state-transition.c
src/display/display-state-transition.h

index d6663d6..a4e1cef 100644 (file)
@@ -356,20 +356,10 @@ void display_panel_lcd_on_direct(enum device_flags flags)
        display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_INPUT_TIMEOUT);
 }
 
-static void display_state_updated_to_next_and_do_action(enum deviced_display_state next)
-{
-       int timeout = 0;
-       set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(next);
-
-       display_plugin_state_get_timeout(get_pm_cur_state(), &timeout);
-       display_state_transition_do_state_action(timeout);
-}
-
 /* FIXME: timer_refresh_cb seems legacy code, it can be removed after discussion */
 static gboolean timer_refresh_cb(gpointer data)
 {
-       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
+       display_state_set_current(DEVICED_DISPLAY_STATE_ON);
        return 0;
 }
 
@@ -388,7 +378,7 @@ int display_panel_custom_lcd_on(int timeout)
        if (set_custom_lcdon_timeout(timeout))
                display_state_transition_update_display_state_timeout_by_priority();
 
-       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
+       display_state_set_current(DEVICED_DISPLAY_STATE_ON);
 
        g_idle_add(timer_refresh_cb, NULL);
 
@@ -423,7 +413,7 @@ int display_panel_custom_lcd_off(enum device_flags flag)
        if (set_custom_lcdon_timeout(0) == true)
                display_state_transition_update_display_state_timeout_by_priority();
 
-       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_OFF);
+       display_state_set_current(DEVICED_DISPLAY_STATE_OFF);
 
        return 0;
 }
@@ -465,7 +455,7 @@ int display_panel_display_turn_on_by_reason(const char *reason, int timeout)
        if (set_custom_lcdon_timeout(timeout) == true)
                display_state_transition_update_display_state_timeout_by_priority();
 
-       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
+       display_state_set_current(DEVICED_DISPLAY_STATE_ON);
 
        return 0;
 }
@@ -503,7 +493,7 @@ int display_panel_display_turn_off_by_reason(const char *reason)
        if (display_panel_get_dpms_cached_state() == DPMS_ON)
                display_panel_lcd_off_procedure(flag);
 
-       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_OFF);
+       display_state_set_current(DEVICED_DISPLAY_STATE_OFF);
 
        return 0;
 }
index 107b1c0..cb8106e 100644 (file)
@@ -58,6 +58,8 @@ static int trans_table[DEVICED_DISPLAY_STATE_END][EVENT_END] = {
        { DEVICED_DISPLAY_STATE_OFF,   DEVICED_DISPLAY_STATE_ON   }, /* DEVICED_DISPLAY_STATE_SLEEP */
 };
 
+static int display_state_transition_do_state_action(int timeout);
+
 static bool is_display_state_valid(enum deviced_display_state display_state)
 {
        return (display_state >= DEVICED_DISPLAY_STATE_START && display_state < DEVICED_DISPLAY_STATE_END);
@@ -107,11 +109,17 @@ inline void set_pm_old_state(int state)
 
 int display_state_set_current(enum deviced_display_state state)
 {
+       int timeout = 0;
+
        if (!is_display_state_valid(state))
                return -EINVAL;
 
+       previous = current;
        current = state;
 
+       display_plugin_state_get_timeout(current, &timeout);
+       display_state_transition_do_state_action(timeout);
+
        return 0;
 }
 
@@ -508,7 +516,7 @@ int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data
 }
 
 /* FIXME: diff time calculation, set_wakeup_count should be discussed again later */
-int display_state_transition_do_state_action(int timeout)
+static int display_state_transition_do_state_action(int timeout)
 {
        int wakeup_count = -1, pm_cur_state;
        time_t now;
index e4e64c7..08edfe6 100644 (file)
@@ -52,7 +52,6 @@ int display_state_transition_do_state_transition(enum deviced_display_state stat
 bool display_state_transition_is_display_state_support_transition(enum deviced_display_state state);
 int display_state_transition_do_state_transition_by_input_poll_event(void);
 int display_state_transition_do_state_transition_by_pm_control_event(PMMsg *data);
-int display_state_transition_do_state_action(int timeout);
 void display_state_transition_do_proc_change_state_action(enum deviced_display_state next, int timeout);
 int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid);
 int display_state_transition_request_state_transition_with_option(pid_t pid, int s_bits);