display: Add display_state_get_current() 05/297105/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 04:43:17 +0000 (13:43 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 06:12:30 +0000 (15:12 +0900)
It replaces get_pm_cur_state() of the display core.

Change-Id: I7fa227f816b343226f5a7584952862a4ebdd8459
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/display/ambient-mode.c
src/display/display-backlight.c
src/display/display-dbus.c
src/display/display-lock.c
src/display/display-misc.c
src/display/display-panel.c
src/display/display-state-transition.c
src/display/display-state-transition.h
src/display/display.c
src/display/resource-display.c
src/display/setting.c

index ab40e16..b5cbfe2 100644 (file)
@@ -164,8 +164,15 @@ void ambient_check_invalid_state(pid_t pid)
 
 static void ambient_start_clock(void)
 {
-       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) ||
-           (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) ||
+       int ret;
+       enum deviced_display_state current;
+
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
+       if ((current == DEVICED_DISPLAY_STATE_ON) ||
+           (current == DEVICED_DISPLAY_STATE_DIM) ||
            (ambient_state == false))
                return;
 
@@ -175,8 +182,15 @@ static void ambient_start_clock(void)
 
 static void ambient_end_clock(pid_t pid)
 {
-       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) ||
-           (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) ||
+       int ret;
+       enum deviced_display_state current;
+
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
+       if ((current == DEVICED_DISPLAY_STATE_ON) ||
+           (current == DEVICED_DISPLAY_STATE_DIM) ||
            (ambient_state == false))
                return;
 
index f42aedc..6aeb355 100644 (file)
@@ -26,6 +26,7 @@
 #include "core.h"
 #include "device-interface.h"
 #include "display.h"
+#include "display-state-transition.h"
 #include "display-backlight.h"
 #include "display-panel.h"
 #include "display-plugin.h"
@@ -312,10 +313,15 @@ int display_backlight_set_brightness_by_dim_brightness(void)
        ret = display_backlight_set_brightness(PM_DIM_BRIGHTNESS);
 
 #ifdef ENABLE_PM_LOG
+       enum deviced_display_state current;
+
+       if (display_state_get_current(&current) < 0)
+               return ret;
+
        if (!ret)
-               pm_history_save(PM_LOG_LCD_DIM, get_pm_cur_state());
+               pm_history_save(PM_LOG_LCD_DIM, current);
        else
-               pm_history_save(PM_LOG_LCD_DIM_FAIL, get_pm_cur_state());
+               pm_history_save(PM_LOG_LCD_DIM_FAIL, current);
 #endif
        return ret;
 }
index 8ec8498..bfeb6fc 100644 (file)
@@ -421,15 +421,21 @@ static GVariant *dbus_getbrightness(GDBusConnection *conn,
        const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
        GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
 {
+       enum deviced_display_state current;
        int brt = -1, ret, result;
 
-       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) {
+       if (display_state_get_current(&current) < 0) {
+               result = 0;
+               goto out;
+       }
+
+       if (current == DEVICED_DISPLAY_STATE_ON) {
                ret = display_backlight_get_brightness(&brt);
                if (ret < 0)
                        result = 0;
                else
                        result = brt;
-       } else if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) {
+       } else if (current == DEVICED_DISPLAY_STATE_DIM) {
                ret = vconf_get_int(VCONFKEY_SETAPPL_LCD_DIM_BRIGHTNESS, &brt);
                if (ret < 0) {
                        _E("Failed to get vconf value for lcd dim brightness: %d", vconf_get_ext_errno());
@@ -444,6 +450,7 @@ static GVariant *dbus_getbrightness(GDBusConnection *conn,
 
        _I("get brightness %d, %d", brt, result);
 
+out:
        return g_variant_new("(i)", result);
 }
 
@@ -497,7 +504,12 @@ static GVariant *dbus_setbrightness(GDBusConnection *conn,
                                _E("Failed to set vconf value for lcd brightness: %d", vconf_get_ext_errno());
                }
        } else if (state == DISPLAY_STATE_SCREEN_DIM) {
-               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) {
+               enum deviced_display_state current;
+               ret = display_state_get_current(&current);
+               if (ret < 0)
+                       goto error;
+
+               if (current == DEVICED_DISPLAY_STATE_DIM) {
                        ret = display_backlight_set_brightness(brt);
                        if (ret < 0)
                                goto error;
@@ -731,6 +743,8 @@ static int set_lcd_timeout(int on, int dim, const char *name)
 {
        unsigned int custom_normal_timeout = 0;
        unsigned int custom_dim_timeout = 0;
+       int ret;
+       enum deviced_display_state current;
 
        if (on == 0 && dim == 0) {
                _I("LCD timeout changed: default setting");
@@ -744,10 +758,15 @@ static int set_lcd_timeout(int on, int dim, const char *name)
                display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_ON, SEC_TO_MSEC(on));
                display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_DIM, SEC_TO_MSEC(dim));
        }
+
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return ret;
+
        /* Apply new backlight time */
        display_state_transition_update_display_state_timeout_by_priority();
-       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+       if (current == DEVICED_DISPLAY_STATE_ON)
+               display_state_transition_do_state_transition(current, EVENT_INPUT);
 
        if (custom_change_name) {
                free(custom_change_name);
@@ -775,6 +794,9 @@ static void reset_lcd_timeout(GDBusConnection *conn,
        const gchar     *unique_name,
        gpointer         data)
 {
+       enum deviced_display_state current;
+       int ret;
+
        if (!sender)
                return;
 
@@ -791,9 +813,13 @@ static void reset_lcd_timeout(GDBusConnection *conn,
        display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_ON, 0);
        display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_DIM, 0);
 
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
        display_state_transition_update_display_state_timeout_by_priority();
-       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+       if (current == DEVICED_DISPLAY_STATE_ON)
+               display_state_transition_do_state_transition(current, EVENT_INPUT);
 }
 
 static GVariant *dbus_setlcdtimeout(GDBusConnection *conn,
@@ -1231,6 +1257,7 @@ static GVariant *dbus_dimstay_control(GDBusConnection *conn,
        GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
 {
        int dimstay, ret = 0;
+       enum deviced_display_state current;
        pid_t pid;
 
        g_variant_get(param, "(i)", &dimstay);
@@ -1250,7 +1277,11 @@ static GVariant *dbus_dimstay_control(GDBusConnection *conn,
                clear_pm_status_flag(DIM_FLAG);
        }
 
-       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               goto out;
+
+       if (current == DEVICED_DISPLAY_STATE_ON)
                display_backlight_update_by_default_brightness();
 
 out:
index 0a71744..77189f1 100644 (file)
@@ -130,6 +130,8 @@ static void remove_lock(struct display_lock *dl)
 static void free_lock(struct display_lock *dl)
 {
        enum deviced_display_state state;
+       enum deviced_display_state current;
+       int ret;
 
        if (!dl)
                return;
@@ -163,7 +165,11 @@ static void free_lock(struct display_lock *dl)
        dl = NULL;
 
        /* Trigger state transition */
-       if (state == get_pm_cur_state() && // if the unlocked state is equal to the current display state
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
+       if (state == current && // if the unlocked state is equal to the current display state
                !display_lock_is_state_locked(state) && // if the released lock is the last lock
                display_state_transition_is_there_state_transition_timer() == false) // if there is no running transition timer
                display_state_transition_reset_state_transition_timeout(0);
@@ -585,12 +591,17 @@ static void proc_condition_lock(PMMsg *data)
        char pname[PATH_MAX];
        pid_t pid = data->pid;
        enum deviced_display_state state;
+       enum deviced_display_state current;
        int ret;
        bool value = true;
        unsigned int flags;
        const char *lock_type = NULL;
        const char *state_name = NULL;
 
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
        state = GET_COND_STATE(data->cond);
        if (state == DEVICED_DISPLAY_STATE_START)
                return;
@@ -598,7 +609,7 @@ static void proc_condition_lock(PMMsg *data)
        flags = GET_COND_FLAG(data->cond);
        display_misc_get_process_name(pid, pname);
 
-       if ((state == DEVICED_DISPLAY_STATE_OFF) && (get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP) &&
+       if ((state == DEVICED_DISPLAY_STATE_OFF) && (current == DEVICED_DISPLAY_STATE_SLEEP) &&
            (pm_get_power_lock() == POWER_UNLOCK))
                display_state_transition_do_proc_change_state(data->cond, DEVICED_EVENT_DISPLAY_LOCK);
 
@@ -703,6 +714,8 @@ int display_lock_proc_condition(PMMsg *data)
        unsigned int flags;
        int timeout = 0;
        bool timeout_enable = false;
+       int ret;
+       enum deviced_display_state current;
 
        if (IS_COND_REQUEST_LOCK(data->cond))
                proc_condition_lock(data);
@@ -714,22 +727,26 @@ int display_lock_proc_condition(PMMsg *data)
        if (!timeout_enable)
                return 0;
 
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return ret;
+
        flags = GET_COND_FLAG(data->cond);
        if (flags == 0) {
                /* guard time for suspend */
-               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) {
+               if (current == DEVICED_DISPLAY_STATE_OFF) {
                        display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_OFF, &timeout);
                        display_state_transition_reset_state_transition_timeout(timeout);
                }
        } else {
                if (flags & PM_FLAG_RESET_TIMER) {
-                       display_plugin_state_get_timeout(get_pm_cur_state(), &timeout);
+                       display_plugin_state_get_timeout(current, &timeout);
                        display_state_transition_reset_state_transition_timeout(timeout);
                }
        }
 
        if (!display_state_transition_is_there_state_transition_timer())
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_TIMEOUT);
+               display_state_transition_do_state_transition(current, EVENT_TIMEOUT);
 
        return 0;
 }
index 68a04ff..3e8971f 100644 (file)
@@ -152,6 +152,7 @@ static void print_info(int fd)
        const char *dim_state_name;
        const char *off_state_name;
        const char *current_state_name;
+       enum deviced_display_state current;
 
        display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
        display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
@@ -183,11 +184,14 @@ static void print_info(int fd)
        if (ret < 0)
                _E("Write() failed: %d", errno);
 
-       display_plugin_state_get_name(get_pm_cur_state(), &current_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);
+       ret = display_state_get_current(&current);
+       if (ret == 0) {
+               display_plugin_state_get_name(current, &current_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));
index e9948ff..d6663d6 100644 (file)
@@ -17,6 +17,7 @@
  */
 #include <sys/time.h>
 #include <libsyscommon/resource-manager.h>
+#include <system/syscommon-plugin-deviced-display.h>
 #include <system/syscommon-plugin-deviced-power-interface.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
 
@@ -55,13 +56,19 @@ static struct timeval lcd_on_timeval;
 /* FIXME: This function is for temporary use, should be fixed after plugin refactoring */
 int display_panel_set_dpms_state(int dpms_on, enum device_flags flags)
 {
+
        dpms_set_state(dpms_on);
 
 #ifdef ENABLE_PM_LOG
+       enum deviced_display_state current;
+
+       if (display_state_get_current(&current) < 0)
+               return 0;
+
        if (dpms_on == DPMS_ON)
-               pm_history_save(PM_LOG_LCD_ON_COMPLETE, get_pm_cur_state());
+               pm_history_save(PM_LOG_LCD_ON_COMPLETE, current);
        else if (dpms_on == DPMS_OFF || dpms_on == DPMS_FORCE_OFF)
-               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, get_pm_cur_state());
+               pm_history_save(PM_LOG_LCD_OFF_COMPLETE, current);
        else
                pm_history_save(PM_LOG_LCD_CONTROL_FAIL, dpms_on);
 #endif
@@ -149,7 +156,12 @@ int display_panel_set_panel_state_by_on_state(enum device_flags flags)
        ret = display_panel_set_dpms_state(DPMS_ON, flags);
 
 #ifdef ENABLE_PM_LOG
-       pm_history_save(PM_LOG_LCD_ON, get_pm_cur_state());
+       enum deviced_display_state current;
+
+       if (display_state_get_current(&current) < 0)
+               return 0;
+
+       pm_history_save(PM_LOG_LCD_ON, current);
 #endif
        return ret;
 }
@@ -181,7 +193,12 @@ int display_panel_set_panel_state_by_off_state(enum device_flags flags)
                ret = display_panel_set_dpms_state(DPMS_OFF, flags);
 
 #ifdef ENABLE_PM_LOG
-       pm_history_save(PM_LOG_LCD_OFF, get_pm_cur_state());
+       enum deviced_display_state current;
+
+       if (display_state_get_current(&current) < 0)
+               return ret;
+
+       pm_history_save(PM_LOG_LCD_OFF, current);
 #endif
        return ret;
 }
index b3f9832..107b1c0 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <libsyscommon/common.h>
 #include <libsyscommon/resource-manager.h>
+#include <system/syscommon-plugin-deviced-display.h>
 #include <system/syscommon-plugin-deviced-power-interface.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
 #include "shared/log.h"
@@ -63,11 +64,20 @@ static bool is_display_state_valid(enum deviced_display_state display_state)
 }
 
 /**
- * FIXME: All those getter/setter for current/previous will be changed to resource-manager.
+ * DO NOT USE the below functions anymore. They are legacy.
  *   - get_pm_cur_state()
  *   - set_pm_cur_state()
  *   - get_pm_old_state()
  *   - set_pm_old_state()
+ *
+ *  Use below intead.
+ *   - display_state_get_current()
+ *   - display_state_set_current()
+ *   - display_state_get_previous()
+ *
+ * FIXME:
+ *  For the plugin side, corresponding resource-driver attributes will be provided.
+ *  It can be made by accessing those attributes via resource-manager API.
  */
 inline int get_pm_cur_state(void)
 {
@@ -95,6 +105,36 @@ inline void set_pm_old_state(int state)
        previous = state;
 }
 
+int display_state_set_current(enum deviced_display_state state)
+{
+       if (!is_display_state_valid(state))
+               return -EINVAL;
+
+       current = state;
+
+       return 0;
+}
+
+int display_state_get_current(enum deviced_display_state *state)
+{
+       if (!state)
+               return -EINVAL;
+
+       *state = current;
+
+       return 0;
+}
+
+int display_state_get_previous(enum deviced_display_state *state)
+{
+       if (!state)
+               return -EINVAL;
+
+       *state = previous;
+
+       return 0;
+}
+
 static bool is_device_event_type_valid(int event_type)
 {
        return (event_type >= EVENT_TIMEOUT && event_type < EVENT_END);
index 67f44af..e4e64c7 100644 (file)
 #define __DISPLAY_STATE_TRANSITION_H__
 
 #include <unistd.h>
+#include <system/syscommon-plugin-deviced-display.h>
 
 #include "core.h"
 
 #define LOCK_SCREEN_INPUT_TIMEOUT      10000
 
+int display_state_set_current(enum deviced_display_state state);
+int display_state_get_current(enum deviced_display_state *state);
+int display_state_get_previous(enum deviced_display_state *state);
+
 int display_state_transition_get_next_transition_display_state(enum deviced_display_state from_state, enum deviced_display_state *to_state, int evt_type);
 int display_state_transition_set_transition_table_display_state(enum deviced_display_state display_state, enum deviced_display_state set_state, int evt_type);
 bool display_state_transition_is_there_state_transition_timer(void);
index d445138..3874e8b 100644 (file)
@@ -206,6 +206,9 @@ int display_get_display_ops_status(enum device_ops_status *dev_ops_status)
 
 void display_set_power_save_mode_flag(int onoff)
 {
+       int ret;
+       enum deviced_display_state current;
+
        if (display_plugin_set_power_save_mode_flag(onoff) == 0)
                return;
 
@@ -214,19 +217,30 @@ void display_set_power_save_mode_flag(int onoff)
        else
                clear_pm_status_flag(PWRSV_FLAG);
 
-       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return;
+
+       if (current == DEVICED_DISPLAY_STATE_ON)
                display_backlight_update_by_default_brightness();
 }
 
 static int power_resume_from_echomem_callback(void *data)
 {
+       int ret;
+       enum deviced_display_state current;
+
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return ret;
+
        display_plugin_set_system_wakeup_flag(true);
        if (check_wakeup_src() == EVENT_DEVICE)
                /* system waked up by devices */
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_DEVICE);
+               display_state_transition_do_state_transition(current, EVENT_DEVICE);
        else
                /* system waked up by user input */
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+               display_state_transition_do_state_transition(current, EVENT_INPUT);
 
        return 0;
 }
@@ -253,11 +267,17 @@ static gboolean delayed_dpms_init_done(gpointer data)
        int timeout = 0;
        bool timeout_enable = false;
        int lcdoff_timeout = 0;
+       int ret;
+       enum deviced_display_state current;
 
        if (!display_panel_init_dpms())
                return G_SOURCE_CONTINUE;
 
-       switch (get_pm_cur_state()) {
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return G_SOURCE_REMOVE;
+
+       switch (current) {
        case DEVICED_DISPLAY_STATE_ON:
        case DEVICED_DISPLAY_STATE_DIM:
                display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
@@ -494,6 +514,7 @@ static void display_init(void *data)
        int timeout = 0;
        int ret = 0;
        unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
+       enum deviced_display_state current;
 
        if (!display_plugin_device_ops || !display_plugin_device_ops->init)
                return;
@@ -592,9 +613,13 @@ static void display_init(void *data)
                        set_pm_cur_state(DEVICED_DISPLAY_STATE_OFF);
                else
                        set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
-               ret = vconf_set_int(VCONFKEY_PM_STATE, get_pm_cur_state());
-               if (ret < 0)
-                       _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
+
+               ret = display_state_get_current(&current);
+               if (ret == 0) {
+                       ret = vconf_set_int(VCONFKEY_PM_STATE, current);
+                       if (ret < 0)
+                               _E("Failed to set vconf value for pm cur state: %d", vconf_get_ext_errno());
+               }
 
                display_set_display_ops_status(DEVICE_OPS_STATUS_START);
                if (timeout_enable) {
@@ -624,7 +649,7 @@ static void display_exit(void *data)
 
        /* Set current state to DEVICED_DISPLAY_STATE_ON */
        set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
-       set_setting_pmstate(get_pm_cur_state());
+       set_setting_pmstate(DEVICED_DISPLAY_STATE_ON);
        /* timeout is not needed */
        display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
 
index 2523b69..34c268c 100644 (file)
@@ -25,6 +25,7 @@
 #include <system/syscommon-plugin-deviced-display.h>
 
 #include "shared/common.h"
+#include "display-state-transition.h"
 #include "display-backlight.h"
 
 static int get_max_brightness(int resource_id,
@@ -43,7 +44,6 @@ static int get_max_brightness(int resource_id,
        *(int *) data = brightness;
 
        return 0;
-
 }
 
 static const struct syscommon_resman_resource_attribute display_attrs[] = {
index 9755685..5487618 100644 (file)
@@ -254,14 +254,19 @@ static int setting_cb(keynode_t *key_nodes, void *data)
 int display_setting_update_pm_setting(int key_idx, int val)
 {
        int ret;
+       enum deviced_display_state current;
 
        if (display_plugin_is_there_update_pm_setting())
                return display_plugin_update_pm_setting(key_idx, val);
 
+       ret = display_state_get_current(&current);
+       if (ret < 0)
+               return ret;
+
        switch (key_idx) {
        case SETTING_TO_NORMAL:
                display_state_transition_update_display_state_timeout_by_priority();
-               display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+               display_state_transition_do_state_transition(current, EVENT_INPUT);
                break;
        case SETTING_LOW_BATT:
                if (display_misc_is_low_battery_state(val)) {
@@ -317,20 +322,20 @@ int display_setting_update_pm_setting(int key_idx, int val)
                        touchled_control_backlight(TOUCHLED_DIRECT_OFF);
 
                /* LCD on if lock screen show before waiting time */
-               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) &&
+               if ((current == DEVICED_DISPLAY_STATE_ON) &&
                    val == VCONFKEY_IDLE_LOCK &&
                    display_panel_get_dpms_cached_state() != DPMS_ON &&
                        display_plugin_is_lcd_on_blocked() == LCDON_BLOCK_NONE)
                        display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                display_state_transition_update_display_state_timeout_by_priority();
-               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
-                       display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+               if (current == DEVICED_DISPLAY_STATE_ON)
+                       display_state_transition_do_state_transition(current, EVENT_INPUT);
                break;
        case SETTING_LOCK_SCREEN_BG:
                set_lock_screen_bg_state(val);
                display_state_transition_update_display_state_timeout_by_priority();
-               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
-                       display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
+               if (current == DEVICED_DISPLAY_STATE_ON)
+                       display_state_transition_do_state_transition(current, EVENT_INPUT);
                break;
        case SETTING_POWER_CUSTOM_BRIGHTNESS:
                if (val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON)