display: Replace state_t with deviced_display_state of the libsyscommon 71/297071/1
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 01:39:07 +0000 (10:39 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 10 Aug 2023 01:39:38 +0000 (10:39 +0900)
Removed unused S_STANDBY, S_SUSPEND and S_POWEROFF.

Change-Id: I16ecff84bf8b3bf0379afe43942aa28d2950f4b2
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
39 files changed:
plugins/iot-headed/display/core.c
plugins/iot-headed/display/key-filter.c
plugins/mobile/display/core.c
plugins/mobile/display/key-filter.c
plugins/tv/display/core.c
plugins/tv/display/key-filter.c
plugins/wearable/battery/battery-notification.c
plugins/wearable/display/auto-brightness-sensorhub.c
plugins/wearable/display/auto-brightness.c
plugins/wearable/display/core.c
plugins/wearable/display/display-handler.c
plugins/wearable/display/enhance.c
plugins/wearable/display/hbm.c
plugins/wearable/display/key-filter.c
plugins/wearable/display/powersaver.c
plugins/wearable/display/swim.c
src/battery-monitor/battery-monitor.c
src/battery-monitor/battery-monitor.h
src/battery/power-supply.c
src/display/ambient-mode.c
src/display/core.h
src/display/display-dbus.c
src/display/display-lock.c
src/display/display-lock.h
src/display/display-misc.c
src/display/display-panel.c
src/display/display-plugin.c
src/display/display-plugin.h
src/display/display-state-transition.c
src/display/display-state-transition.h
src/display/display-util.c
src/display/display.c
src/display/lock-detector.c
src/display/setting.c
src/display/slave-logging.c
src/extcon/cradle.c
src/led/touch-key.c
src/power/power-doze.c
src/time/time-handler.c

index d83ee55..5dd4edf 100644 (file)
@@ -82,14 +82,12 @@ static struct display_plugin *disp_plgn;
 static struct display_backlight_ops *backlight_ops;
 static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT;
 
-static struct state states[S_END] = {
-       { S_START,    "S_START",    NULL,          NULL,           NULL,          NULL            },
-       { S_NORMAL,   "S_NORMAL",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDDIM,   "S_LCDDIM",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDOFF,   "S_LCDOFF",   NULL,          NULL,           NULL,          NULL            },
-       { S_STANDBY,  "S_STANDBY",  NULL,          NULL,           NULL,          NULL            },
-       { S_SLEEP,    "S_SLEEP",    NULL,          NULL,           NULL,          NULL            },
-       { S_POWEROFF, "S_POWEROFF", NULL,          NULL,           NULL,          NULL            },
+static struct state states[DEVICED_DISPLAY_STATE_END] = {
+       { DEVICED_DISPLAY_STATE_START,    "DEVICED_DISPLAY_STATE_START",    NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_ON,   "DEVICED_DISPLAY_STATE_ON",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_DIM,   "DEVICED_DISPLAY_STATE_DIM",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_OFF,   "DEVICED_DISPLAY_STATE_OFF",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_SLEEP,    "DEVICED_DISPLAY_STATE_SLEEP",    NULL,          NULL,           NULL,          NULL            },
 };
 
 #define LOCK_SCREEN_WATING_TIME                300     /* 0.3 second */
@@ -130,7 +128,7 @@ inline const struct display_config* get_var_display_config()
        return &display_conf;
 }
 
-inline struct state* state_st(enum state_t state)
+inline struct state* state_st(enum deviced_display_state state)
 {
        return &states[state];
 }
@@ -138,7 +136,7 @@ inline struct state* state_st(enum state_t state)
 static void init_display_states(void *data)
 {
        struct display_plugin *dp = (struct display_plugin *) data;
-       for(int i = 0; i < S_END; i++)
+       for(int i = 0; i < DEVICED_DISPLAY_STATE_END; i++)
                dp->display_states[i] = &states[i];
 }
 /**
index b17c7bb..c32723b 100644 (file)
@@ -104,7 +104,7 @@ static int booting_check = true;
 
 static inline int current_state_in_on(void)
 {
-       return ((get_pm_cur_state() == S_LCDDIM) || (get_pm_cur_state() == S_NORMAL));
+       return ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON));
 }
 
 static inline void restore_custom_brightness(void)
@@ -112,7 +112,7 @@ static inline void restore_custom_brightness(void)
        bool custom_status;
 
        display_backlight_get_custom_status(&custom_status);
-       if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) && custom_status)
                display_backlight_update_by_custom_brightness();
 }
 
@@ -388,8 +388,8 @@ static int lcdoff_powerkey(void)
 
        if (decide_lcdoff() == true) {
                switch_off_lcd();
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
                display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
        } else {
@@ -496,8 +496,8 @@ static int process_screenlock_key(struct input_event *pinput)
        if (!current_state_in_on())
                return false;
 
-       display_lock_release_lock_all(S_NORMAL);
-       display_lock_release_lock_all(S_LCDDIM);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
@@ -673,10 +673,10 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
 
                break;
        case EV_REL:
-               if ((get_pm_cur_state() == S_LCDOFF) && bezel_wakeup) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) && bezel_wakeup) {
                        switch_on_lcd(LCD_ON_BY_BEZEL);
                        ignore = false;
-               } else if (get_pm_cur_state() != S_LCDOFF)
+               } else if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_OFF)
                        ignore = false;
                break;
        case EV_ABS:
index f0d4a1c..c9d797e 100644 (file)
@@ -84,14 +84,12 @@ static struct display_backlight_ops *backlight_ops;
 
 static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT;
 
-static struct state states[S_END] = {
-       { S_START,    "S_START",    NULL,          NULL,           NULL,          NULL            },
-       { S_NORMAL,   "S_NORMAL",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDDIM,   "S_LCDDIM",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDOFF,   "S_LCDOFF",   NULL,          NULL,           NULL,          NULL            },
-       { S_STANDBY,  "S_STANDBY",  NULL,          NULL,           NULL,          NULL            },
-       { S_SLEEP,    "S_SLEEP",    NULL,          NULL,           NULL,          NULL            },
-       { S_POWEROFF, "S_POWEROFF", NULL,          NULL,           NULL,          NULL            },
+static struct state states[DEVICED_DISPLAY_STATE_END] = {
+       { DEVICED_DISPLAY_STATE_START,    "DEVICED_DISPLAY_STATE_START",    NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_ON,   "DEVICED_DISPLAY_STATE_ON",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_DIM,   "DEVICED_DISPLAY_STATE_DIM",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_OFF,   "DEVICED_DISPLAY_STATE_OFF",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_SLEEP,    "DEVICED_DISPLAY_STATE_SLEEP",    NULL,          NULL,           NULL,          NULL            },
 };
 
 #define LOCK_SCREEN_WATING_TIME                300     /* 0.3 second */
@@ -132,29 +130,29 @@ inline const struct display_config* get_var_display_config()
        return &display_conf;
 }
 
-inline struct state* state_st(enum state_t state)
+inline struct state* state_st(enum deviced_display_state state)
 {
        return &states[state];
 }
 
 static int default_proc_change_state(unsigned int cond, pid_t pid)
 {
-       enum state_t next;
+       enum deviced_display_state next;
 
        next = GET_COND_STATE(cond);
        _I("Change process(%d) state to %s.", pid, states[next].name);
 
        switch (next) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                if (display_panel_get_dpms_cached_state() != DPMS_ON)
                        display_panel_lcd_on_direct(LCD_ON_BY_EVENT);
                display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT);
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                if (display_panel_get_dpms_cached_state() == DPMS_ON) {
                        if (get_proximity_state() == SENSOR_PROXIMITY_NEAR)
                                display_panel_lcd_off_procedure(LCD_OFF_BY_PROXIMITY);
@@ -165,20 +163,20 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
                        display_state_transition_update_display_state_timeout_by_priority();
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                _I("Dangerous requests.");
                /* at first LCD_OFF and then goto sleep */
                /* state transition */
-               display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE);
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
-               display_lock_release_lock_all(S_LCDOFF);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_OFF, TIMEOUT_NONE);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_OFF);
                if (display_panel_is_lcd_on_state_broadcasted()) {
                        _I("broadcast lcd off signal at non-lcd device");
                        broadcast_lcd_off(SIGNAL_PRE, 0);
                        broadcast_lcd_off(SIGNAL_POST, 0);
                }
-               display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_SLEEP, TIMEOUT_NONE);
                break;
 
        default:
@@ -191,7 +189,7 @@ static int default_proc_change_state(unsigned int cond, pid_t pid)
 static void init_display_states(void *data)
 {
        struct display_plugin *dp = (struct display_plugin *) data;
-       for(int i = 0; i < S_END; i++)
+       for(int i = 0; i < DEVICED_DISPLAY_STATE_END; i++)
                dp->display_states[i] = &states[i];
 }
 /**
index d4948ad..95abf08 100644 (file)
@@ -105,7 +105,7 @@ static int booting_check = true;
 
 static inline int current_state_in_on(void)
 {
-       return ((get_pm_cur_state() == S_LCDDIM) || (get_pm_cur_state() == S_NORMAL));
+       return ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON));
 }
 
 static inline void restore_custom_brightness(void)
@@ -113,7 +113,7 @@ static inline void restore_custom_brightness(void)
        bool custom_status;
 
        display_backlight_get_custom_status(&custom_status);
-       if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) && custom_status)
                display_backlight_update_by_custom_brightness();
 }
 
@@ -378,8 +378,8 @@ static int lcdoff_powerkey(void)
 
        if (decide_lcdoff() == true) {
                switch_off_lcd();
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
                display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
        } else {
@@ -528,8 +528,8 @@ static int process_screenlock_key(struct input_event *pinput)
        if (!current_state_in_on())
                return false;
 
-       display_lock_release_lock_all(S_NORMAL);
-       display_lock_release_lock_all(S_LCDDIM);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
@@ -699,10 +699,10 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
 
                break;
        case EV_REL:
-               if ((get_pm_cur_state() == S_LCDOFF) && bezel_wakeup) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) && bezel_wakeup) {
                        switch_on_lcd(LCD_ON_BY_BEZEL);
                        ignore = false;
-               } else if (get_pm_cur_state() != S_LCDOFF)
+               } else if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_OFF)
                        ignore = false;
                break;
        case EV_ABS:
index 68e444b..082904f 100644 (file)
@@ -82,14 +82,12 @@ static struct display_backlight_ops *backlight_ops;
 
 static enum device_ops_status status = DEVICE_OPS_STATUS_UNINIT;
 
-static struct state states[S_END] = {
-       { S_START,    "S_START",    NULL,          NULL,           NULL,          NULL            },
-       { S_NORMAL,   "S_NORMAL",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDDIM,   "S_LCDDIM",   NULL,          NULL,           NULL,          NULL            },
-       { S_LCDOFF,   "S_LCDOFF",   NULL,          NULL,           NULL,          NULL            },
-       { S_STANDBY,  "S_STANDBY",  NULL,          NULL,           NULL,          NULL            },
-       { S_SLEEP,    "S_SLEEP",    NULL,          NULL,           NULL,          NULL            },
-       { S_POWEROFF, "S_POWEROFF", NULL,          NULL,           NULL,          NULL            },
+static struct state states[DEVICED_DISPLAY_STATE_END] = {
+       { DEVICED_DISPLAY_STATE_START,    "DEVICED_DISPLAY_STATE_START",    NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_ON,   "DEVICED_DISPLAY_STATE_ON",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_DIM,   "DEVICED_DISPLAY_STATE_DIM",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_OFF,   "DEVICED_DISPLAY_STATE_OFF",   NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_SLEEP,    "DEVICED_DISPLAY_STATE_SLEEP",    NULL,          NULL,           NULL,          NULL            },
 };
 
 #define LOCK_SCREEN_WATING_TIME                300     /* 0.3 second */
@@ -130,7 +128,7 @@ inline const struct display_config* get_var_display_config()
        return &display_conf;
 }
 
-inline struct state* state_st(enum state_t state)
+inline struct state* state_st(enum deviced_display_state state)
 {
        return &states[state];
 }
@@ -138,7 +136,7 @@ inline struct state* state_st(enum state_t state)
 static void init_display_states(void *data)
 {
        struct display_plugin *dp = (struct display_plugin *) data;
-       for(int i = 0; i < S_END; i++)
+       for(int i = 0; i < DEVICED_DISPLAY_STATE_END; i++)
                dp->display_states[i] = &states[i];
 }
 /**
index 2341906..c21f628 100644 (file)
@@ -103,7 +103,7 @@ static int booting_check = true;
 
 static inline int current_state_in_on(void)
 {
-       return ((get_pm_cur_state() == S_LCDDIM) || (get_pm_cur_state() == S_NORMAL));
+       return ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON));
 }
 
 static inline void restore_custom_brightness(void)
@@ -111,7 +111,7 @@ static inline void restore_custom_brightness(void)
        bool custom_status;
 
        display_backlight_get_custom_status(&custom_status);
-       if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) && custom_status)
                display_backlight_update_by_custom_brightness();
 }
 
@@ -387,8 +387,8 @@ static int lcdoff_powerkey(void)
 
        if (decide_lcdoff() == true) {
                switch_off_lcd();
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
                display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
        } else {
@@ -495,8 +495,8 @@ static int process_screenlock_key(struct input_event *pinput)
        if (!current_state_in_on())
                return false;
 
-       display_lock_release_lock_all(S_NORMAL);
-       display_lock_release_lock_all(S_LCDDIM);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
@@ -666,10 +666,10 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
 
                break;
        case EV_REL:
-               if ((get_pm_cur_state() == S_LCDOFF) && bezel_wakeup) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) && bezel_wakeup) {
                        switch_on_lcd(LCD_ON_BY_BEZEL);
                        ignore = false;
-               } else if (get_pm_cur_state() != S_LCDOFF)
+               } else if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_OFF)
                        ignore = false;
                break;
        case EV_ABS:
index 7b69283..4cc6ae8 100644 (file)
@@ -32,7 +32,7 @@ static struct battery_status *battery;
 
 static void launch_health_popup_by_display_state(int display_state)
 {
-       static enum state_t old = S_START;
+       static enum deviced_display_state old = DEVICED_DISPLAY_STATE_START;
 
        if (battery->health != HEALTH_LOW && battery->health != HEALTH_HIGH) {
                old = display_state;
@@ -40,8 +40,8 @@ static void launch_health_popup_by_display_state(int display_state)
        }
 
        /* relaunch health popup on LCDON */
-       if ((old == S_SLEEP || old == S_LCDOFF || old == S_START)
-               && (display_state == S_LCDDIM || display_state == S_NORMAL))
+       if ((old == DEVICED_DISPLAY_STATE_SLEEP || old == DEVICED_DISPLAY_STATE_OFF || old == DEVICED_DISPLAY_STATE_START)
+               && (display_state == DEVICED_DISPLAY_STATE_DIM || display_state == DEVICED_DISPLAY_STATE_ON))
                relaunch_health_popup();
        old = display_state;
 }
index d8d6b0e..d61cabc 100644 (file)
@@ -61,7 +61,7 @@ void set_brightness_level(int level)
        int default_brightness;
        int current_brightness;
 
-       if (get_pm_cur_state() != S_NORMAL)
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)
                return;
 /*
        if (battery.capacity <= LOWBATCAPACITY && battery.charge_now != CHARGER_CHARGING)
@@ -234,7 +234,7 @@ int auto_brightness_control(enum brightness_request_e request, int set_brightnes
                change_flag(&hold_brt, 1);
        } else if (request == BR_LOWDIM_ON) {
                if (!lowdim) {
-                       if (!hbm && !hold_brt && (get_pm_cur_state() == S_NORMAL))
+                       if (!hbm && !hold_brt && (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON))
                                display_backlight_set_brightness_by_dim_brightness();
                        change_flag(&lowdim, 1);
                }
@@ -244,7 +244,7 @@ int auto_brightness_control(enum brightness_request_e request, int set_brightnes
                        change_flag(&lbm, 0);
 
                        /* called by DEVICE_NOTIFIER_LCD_OFF_COMPLETE, no need to change brightness */
-                       if (get_pm_cur_state() != S_NORMAL)
+                       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)
                                return 0;
 
                        if (!lowdim) {
@@ -270,7 +270,7 @@ int auto_brightness_control(enum brightness_request_e request, int set_brightnes
                        change_flag(&hold_brt, 0);
 
                        /* called by DEVICE_NOTIFIER_LCD_OFF_COMPLETE, no need to change brightness */
-                       if (get_pm_cur_state() != S_NORMAL)
+                       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)
                                return 0;
 
                        if (!lowdim)
@@ -291,7 +291,7 @@ int auto_brightness_control(enum brightness_request_e request, int set_brightnes
                }
        } else if (request == BR_LOWDIM_OFF) {
                if (lowdim) {
-                       if (!hbm && !hold_brt && (get_pm_cur_state() == S_NORMAL))
+                       if (!hbm && !hold_brt && (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON))
                                display_backlight_update_by_default_brightness();
                        change_flag(&lowdim, 0);
                }
index f6e33de..9006673 100644 (file)
@@ -230,7 +230,7 @@ out:
 
 static gboolean alc_handler(void *data)
 {
-       if (get_pm_cur_state() != S_NORMAL) {
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON) {
                if (alc_timeout_id > 0)
                        g_source_remove(alc_timeout_id);
                alc_timeout_id = 0;
@@ -380,7 +380,7 @@ static int disconnect_sensor(void)
        }
 
        if (_default_action != NULL) {
-               state_st(S_NORMAL)->action = _default_action;
+               state_st(DEVICED_DISPLAY_STATE_ON)->action = _default_action;
                _default_action = NULL;
        }
        if (alc_timeout_id > 0) {
@@ -417,8 +417,8 @@ static int set_autobrightness_state(int status)
 
                /* change alc action func */
                if (_default_action == NULL)
-                       _default_action = state_st(S_NORMAL)->action;
-               state_st(S_NORMAL)->action = alc_action;
+                       _default_action = state_st(DEVICED_DISPLAY_STATE_ON)->action;
+               state_st(DEVICED_DISPLAY_STATE_ON)->action = alc_action;
 
                update_auto_brightness(true);
 
@@ -493,7 +493,7 @@ static gboolean update_handler(void *data)
 
        update_timeout = 0;
 
-       if (get_pm_cur_state() != S_NORMAL)
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)
                return G_SOURCE_REMOVE;
 
        ret = vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &on);
@@ -623,7 +623,7 @@ static int lcd_changed_cb(void *data)
        if (!data)
                return 0;
        lcd_state = *(int *)data;
-       if (lcd_state == S_LCDOFF && alc_timeout_id > 0) {
+       if (lcd_state == DEVICED_DISPLAY_STATE_OFF && alc_timeout_id > 0) {
                g_source_remove(alc_timeout_id);
                alc_timeout_id = 0;
        }
index 43590a8..ce097f9 100644 (file)
@@ -104,14 +104,12 @@ static bool lcdon_broadcast = true;
 static int default_trans(int evt);
 static int default_action(int timeout);
 
-static struct state states[S_END] = {
-       { S_START,    "S_START",    NULL,          NULL,           NULL,          NULL            },
-       { S_NORMAL,   "S_NORMAL",   default_trans, default_action, NULL,          NULL            },
-       { S_LCDDIM,   "S_LCDDIM",   default_trans, default_action, NULL,          NULL            },
-       { S_LCDOFF,   "S_LCDOFF",   default_trans, default_action, NULL,          NULL            },
-       { S_STANDBY,  "S_STANDBY",  NULL,          NULL,           NULL,          NULL            },
-       { S_SLEEP,    "S_SLEEP",    default_trans, default_action, NULL,          NULL            },
-       { S_POWEROFF, "S_POWEROFF", NULL,          NULL,           NULL,          NULL            },
+static struct state states[DEVICED_DISPLAY_STATE_END] = {
+       { DEVICED_DISPLAY_STATE_START,    "DEVICED_DISPLAY_STATE_START",    NULL,          NULL,           NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_ON,   "DEVICED_DISPLAY_STATE_ON",   default_trans, default_action, NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_DIM,   "DEVICED_DISPLAY_STATE_DIM",   default_trans, default_action, NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_OFF,   "DEVICED_DISPLAY_STATE_OFF",   default_trans, default_action, NULL,          NULL            },
+       { DEVICED_DISPLAY_STATE_SLEEP,    "DEVICED_DISPLAY_STATE_SLEEP",    default_trans, default_action, NULL,          NULL            },
 };
 
 #define LOCK_SCREEN_WATING_TIME                300     /* 0.3 second */
@@ -154,7 +152,7 @@ inline const struct display_config *get_var_display_config()
        return &display_conf;
 }
 
-inline struct state *state_st(enum state_t state)
+inline struct state *state_st(enum deviced_display_state state)
 {
        return &states[state];
 }
@@ -258,9 +256,9 @@ static void lcd_on_procedure(int state, enum device_flags flag)
        }
 
        if (state == LCD_NORMAL)
-               set_setting_pmstate(S_NORMAL);
+               set_setting_pmstate(DEVICED_DISPLAY_STATE_ON);
        else if (state == LCD_DIM)
-               set_setting_pmstate(S_LCDDIM);
+               set_setting_pmstate(DEVICED_DISPLAY_STATE_DIM);
 
        display_start_dependent_device(flags);
 
@@ -313,7 +311,7 @@ static void lcd_off_procedure(enum device_flags flag)
                ambient_set_state(true);
        }
 
-       set_setting_pmstate(S_LCDOFF);
+       set_setting_pmstate(DEVICED_DISPLAY_STATE_OFF);
 
        if (transit_timer) {
                g_source_remove(transit_timer);
@@ -371,7 +369,7 @@ static gboolean timer_refresh_cb(gpointer data)
 
        /* state transition */
        set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(S_NORMAL);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
        st = &states[get_pm_cur_state()];
 
        if (st->action)
@@ -408,7 +406,7 @@ int custom_lcdon(int timeout)
 
        /* state transition */
        set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(S_NORMAL);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
        st = &states[get_pm_cur_state()];
 
        /* enter action */
@@ -425,7 +423,7 @@ int custom_lcdoff(enum device_flags flag)
 {
        struct state *st;
 
-       if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
+       if (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(DEVICED_DISPLAY_STATE_DIM)) {
                /*
                 * When another proccess is normal lock, device is received call then,
                 * call app can be changed to lcd state by proximity.
@@ -433,7 +431,7 @@ int custom_lcdoff(enum device_flags flag)
                 */
                if (flag & LCD_OFF_BY_PROXIMITY) {
                        _I("custom lcd off by proximity, delete normal lock");
-                       display_lock_release_lock_all(S_NORMAL);
+                       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
                } else {
                        _I("skip custom lcd off");
                        return -ECANCELED;
@@ -449,7 +447,7 @@ int custom_lcdoff(enum device_flags flag)
 
        /* state transition */
        set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(S_LCDOFF);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_OFF);
        st = &states[get_pm_cur_state()];
 
        /* enter action */
@@ -490,7 +488,7 @@ int display_on_by_reason(const char *reason, int timeout)
 
        /* state transition */
        set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(S_NORMAL);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
        st = &states[get_pm_cur_state()];
 
        /* enter action */
@@ -509,19 +507,19 @@ int display_off_by_reason(const char *reason)
        str_len = strlen(reason);
 
        if (!strncmp(reason, GESTURE_STR, str_len)) {
-               if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
+               if (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(DEVICED_DISPLAY_STATE_DIM)) {
                        _I("skip platform lcd off by gesture");
                        return -ECANCELED;
                }
                flag = LCD_OFF_BY_GESTURE;
        } else if (!strncmp(reason, PALM_STR, str_len)) {
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
 
                flag = LCD_OFF_BY_PALM;
        } else if (!strncmp(reason, DISPLAY_DETACH_STR, str_len)) {
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
 
                flag = LCD_OFF_BY_DISPLAY_DETACH;
        } else {
@@ -535,7 +533,7 @@ int display_off_by_reason(const char *reason)
 
        /* state transition */
        set_pm_old_state(get_pm_cur_state());
-       set_pm_cur_state(S_LCDOFF);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_OFF);
        st = &states[get_pm_cur_state()];
 
        /* enter action */
@@ -547,42 +545,42 @@ int display_off_by_reason(const char *reason)
 
 static int default_proc_change_state(unsigned int cond, pid_t pid)
 {
-       enum state_t next;
+       enum deviced_display_state next;
 
        next = GET_COND_STATE(cond);
        _I("Change process(%d) state to %s.", pid, states[next].name);
 
        switch (next) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                if (check_lcd_is_on() == false)
                        display_panel_lcd_on_direct(LCD_ON_BY_EVENT);
                display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT);
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_EVENT);
                if (set_custom_lcdon_timeout(0))
                        display_state_transition_update_display_state_timeout_by_priority();
                display_state_transition_do_proc_change_state_action(next, -1);
                break;
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                _I("Dangerous requests.");
                /* at first LCD_OFF and then goto sleep */
                /* state transition */
-               display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE);
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
-               display_lock_release_lock_all(S_LCDOFF);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_OFF, TIMEOUT_NONE);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_OFF);
                if (lcdon_broadcast) {
                        _I("broadcast lcd off signal at non-lcd device");
                        broadcast_lcd_off(SIGNAL_PRE, 0);
                        broadcast_lcd_off(SIGNAL_POST, 0);
                }
-               display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_SLEEP, TIMEOUT_NONE);
                break;
 
        default:
@@ -602,7 +600,7 @@ static int default_trans(int evt)
 {
        struct state *st = &states[get_pm_cur_state()];
        int ret;
-       enum state_t next_state;
+       enum deviced_display_state next_state;
 
        display_state_transition_get_next_transition_display_state(get_pm_cur_state(), &next_state, evt);
 
@@ -617,7 +615,7 @@ static int default_trans(int evt)
 
        ret = is_lcdon_blocked();
        if (ret != LCDON_BLOCK_NONE) {
-               if (next_state == S_NORMAL || next_state == S_LCDDIM) {
+               if (next_state == DEVICED_DISPLAY_STATE_ON || next_state == DEVICED_DISPLAY_STATE_DIM) {
                        _W("LCDON is blocked, %d.", ret);
                        return -1;
                }
@@ -630,10 +628,10 @@ static int default_trans(int evt)
 
        /* enter action */
        if (st->action) {
-               if (get_pm_cur_state() == S_LCDOFF)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF)
                        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
 
-               if ((get_pm_cur_state() == S_NORMAL) || (get_pm_cur_state() == S_LCDOFF))
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF))
                        if (set_custom_lcdon_timeout(0) == true)
                                display_state_transition_update_display_state_timeout_by_priority();
 
@@ -641,7 +639,7 @@ static int default_trans(int evt)
                        /* enter next state directly */
                        states[get_pm_cur_state()].trans(EVENT_TIMEOUT);
                } else {
-                       if ((get_pm_cur_state() == S_SLEEP)
+                       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP)
                        && (syscommon_is_emulator() == true || timeout_sleep_support == false))
                                return 0;
 
@@ -674,14 +672,14 @@ static int default_action(int timeout)
 
        ret = is_lcdon_blocked();
        if (ret != LCDON_BLOCK_NONE) {
-               if ((get_pm_cur_state() == S_NORMAL) || (get_pm_cur_state() == S_LCDDIM)) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM)) {
                        _W("LCDON is blocked, %d.", ret);
                        return -ENOTSUP;
                }
        }
 
-       if (get_pm_cur_state() != S_SLEEP) {
-               if ((get_pm_cur_state() == S_NORMAL)) {
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_SLEEP) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)) {
                        if (display_panel_calculate_diff_time_between_lcd_on_direct_and_state_action(&diff_time) == 0) {
                                timeout -= diff_time;
                        }
@@ -689,7 +687,7 @@ static int default_action(int timeout)
                /* set timer with current state timeout */
                display_state_transition_reset_state_transition_timeout(timeout);
 
-               if (get_pm_cur_state() == S_NORMAL) {
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) {
                        time(&last_update_time);
                        last_timeout = timeout;
                } else {
@@ -698,7 +696,7 @@ static int default_action(int timeout)
                }
        }
 
-       if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
+       if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != DEVICED_DISPLAY_STATE_SLEEP)) {
                power_request_change_state_strict(DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL,
                        power_get_wakeup_reason(), NULL);
                set_setting_pmstate(get_pm_cur_state());
@@ -706,10 +704,10 @@ static int default_action(int timeout)
                syscommon_notifier_emit_notify(DEVICE_NOTIFIER_LCD, (void *)&pm_cur_state);
        }
 
-       if ((get_pm_old_state() == S_NORMAL) && (get_pm_cur_state() != S_NORMAL)) {
+       if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_ON) && (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)) {
                time(&now);
                diff = difftime(now, last_update_time);
-               _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).",
+               _I("DEVICED_DISPLAY_STATE_ON is changed to %s (timeout=%d ms diff=%.0f s).",
                    states[get_pm_cur_state()].name, last_timeout, diff);
        }
 
@@ -717,33 +715,33 @@ static int default_action(int timeout)
        update_bds_record(get_pm_cur_state());
 
        switch (get_pm_cur_state()) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                /*
                 * normal state : backlight on and restore
                 * the previous brightness
                 */
-               if (get_pm_old_state() == S_LCDDIM)
+               if (get_pm_old_state() == DEVICED_DISPLAY_STATE_DIM)
                        display_backlight_update_by_default_brightness();
 
                if (check_lcd_is_on() == false)
                        lcd_on_procedure(LCD_NORMAL, NORMAL_MODE);
                break;
 
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_backlight_get_custom_status(&custom_status);
-               if ((get_pm_old_state() == S_NORMAL) && custom_status) {
+               if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_ON) && custom_status) {
                        display_backlight_get_brightness(&brightness);
                        display_backlight_set_custom_brightness(brightness);
                }
                /* lcd dim state : dim the brightness */
                display_backlight_set_brightness_by_dim_brightness();
 
-               if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP))
+               if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_OFF) || (get_pm_old_state() == DEVICED_DISPLAY_STATE_SLEEP))
                        lcd_on_procedure(LCD_DIM, NORMAL_MODE);
                break;
 
-       case S_LCDOFF:
-               if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
+       case DEVICED_DISPLAY_STATE_OFF:
+               if ((get_pm_old_state() != DEVICED_DISPLAY_STATE_SLEEP) && (get_pm_old_state() != DEVICED_DISPLAY_STATE_OFF)) {
                        /* lcd off state : turn off the backlight */
                        if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
@@ -755,7 +753,7 @@ static int default_action(int timeout)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
 
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
@@ -866,19 +864,19 @@ static int update_setting(int key_idx, int val)
                set_lock_screen_state(val);
 
                /* LCD on if lock screen show before waiting time */
-               if ((get_pm_cur_state() == S_NORMAL) &&
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) &&
                    val == VCONFKEY_IDLE_LOCK &&
                    display_panel_get_dpms_cached_state() != DPMS_ON &&
                        is_lcdon_blocked() == LCDON_BLOCK_NONE)
                        lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                display_state_transition_update_display_state_timeout_by_priority();
-               if (get_pm_cur_state() == S_NORMAL)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                        states[get_pm_cur_state()].trans(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() == S_NORMAL)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                        states[get_pm_cur_state()].trans(EVENT_INPUT);
                break;
        case SETTING_POWER_CUSTOM_BRIGHTNESS:
@@ -906,7 +904,7 @@ static void init_lcd_operation(void)
 static void init_display_states(void *data)
 {
        struct display_plugin *dp = (struct display_plugin *) data;
-       for(int i = 0; i < S_END; i++)
+       for(int i = 0; i < DEVICED_DISPLAY_STATE_END; i++)
                dp->display_states[i] = &states[i];
 }
 /**
index 6cd031f..bad8407 100644 (file)
@@ -104,7 +104,7 @@ static GVariant *dbus_autobrightnesschanged(GDBusConnection *conn,
        if (aod_clock_displayed) {
                autobrtlevel = level; /* reserve the level, defer applying */
                autobrt_timer = g_timeout_add(200, lcdon_from_aod_cb, (gpointer)(intptr_t) level);
-       } else { /* S_NORMAL state or LCDON from usual OFF state, not from AOD */
+       } else { /* DEVICED_DISPLAY_STATE_ON state or LCDON from usual OFF state, not from AOD */
                set_brightness_level(level);
        }
 
@@ -173,12 +173,12 @@ static const dbus_interface_u dbus_interface = {
 
 static int display_state_changed(void *data)
 {
-       enum state_t state;
+       enum deviced_display_state state;
        int ret = 0;
 
        state = DATA_VALUE_INT(data);
 
-       if (state == S_LCDON)
+       if (state == DEVICED_DISPLAY_STATE_ON)
                ret = sys_set_int(CHARGER_LCD_NODE, CHARGING_LCD_ON);
        else
                ret = sys_set_int(CHARGER_LCD_NODE, CHARGING_LCD_OFF);
index 2e05e41..b6682ad 100644 (file)
@@ -100,7 +100,7 @@ static int enhance_lcd_state_changed(void *data)
 
        state = DATA_VALUE_INT(data);
 
-       if (state == S_NORMAL)
+       if (state == DEVICED_DISPLAY_STATE_ON)
                enhance_update_state();
 
        return 0;
index acfd006..243159e 100644 (file)
@@ -75,7 +75,7 @@ static gboolean hbm_off_cb(void *data)
 {
        timer = 0;
 
-       if (get_pm_cur_state() != S_NORMAL) {
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON) {
                _D("Hbm timeout, but it's not display normal.");
                return G_SOURCE_REMOVE;
        }
@@ -217,19 +217,19 @@ static int display_state_changed(void *data)
                        return 0;
 
        switch (state) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                /*
                 * outdoor-enhance-mode not supported
                 *  : check & restore hbm always.
                 * outdoor-enhance-mode supported
                 *  : check & restore hbm when old state is dim only.
                 */
-               if (!get_outdoor_setting || (get_pm_old_state() == S_LCDDIM))
+               if (!get_outdoor_setting || (get_pm_old_state() == DEVICED_DISPLAY_STATE_DIM))
                        hbm_check_timeout();
                break;
-       case S_LCDDIM:
-       case S_LCDOFF:
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_DIM:
+       case DEVICED_DISPLAY_STATE_OFF:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                ret = auto_brightness_control(BR_HBM_OFF, BR_IMPLICIT);
                if (ret < 0)
                        _E("Failed to off hbm.");
index eba2be7..7484c22 100644 (file)
@@ -104,7 +104,7 @@ static int booting_check = true;
 
 static inline int current_state_in_on(void)
 {
-       return ((get_pm_cur_state() == S_LCDDIM) || (get_pm_cur_state()  == S_NORMAL));
+       return ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) || (get_pm_cur_state()  == DEVICED_DISPLAY_STATE_ON));
 }
 
 static inline void restore_custom_brightness(void)
@@ -112,7 +112,7 @@ static inline void restore_custom_brightness(void)
        bool custom_status;
 
        display_backlight_get_custom_status(&custom_status);
-       if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) && custom_status)
                display_backlight_update_by_custom_brightness();
 }
 
@@ -386,8 +386,8 @@ static int lcdoff_powerkey(void)
        if (decide_lcdoff() == true) {
                update_auto_brightness(false);
                switch_off_lcd();
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
                display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
        } else {
@@ -494,8 +494,8 @@ static int process_screenlock_key(struct input_event *pinput)
        if (!current_state_in_on())
                return false;
 
-       display_lock_release_lock_all(S_NORMAL);
-       display_lock_release_lock_all(S_LCDDIM);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
@@ -628,10 +628,10 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
 
                break;
        case EV_REL:
-               if ((get_pm_cur_state() == S_LCDOFF) && bezel_wakeup) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) && bezel_wakeup) {
                        switch_on_lcd(LCD_ON_BY_BEZEL);
                        ignore = false;
-               } else if (get_pm_cur_state() != S_LCDOFF)
+               } else if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_OFF)
                        ignore = false;
                break;
        case EV_ABS:
index b6463bc..0e117ac 100644 (file)
@@ -58,7 +58,7 @@ static int set_powersaver_mode(int mode)
        display_backlight_update_by_default_brightness();
        get_run_timeout(&timeout);
 
-       display_plugin_state_set_timeout(S_NORMAL, timeout);
+       display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_ON, timeout);
        display_plugin_state_do_default_trans(get_pm_cur_state(), EVENT_INPUT);
 
        return 0;
index 27642b2..5d73c22 100644 (file)
@@ -96,14 +96,14 @@ static void swimmode_signal_handler(GDBusConnection  *conn,
        _I("Request swim mode state %d by %d", val, pid);
 
        if (display_panel_get_dpms_cached_state() != DPMS_ON) {
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, S_NORMAL);
+               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, DEVICED_DISPLAY_STATE_ON);
                lcd_state = true;
        }
 
        swim_execute((void *)((intptr_t)val));
 
        if (lcd_state) {
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, S_LCDOFF);
+               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, DEVICED_DISPLAY_STATE_OFF);
        }
 }
 
index 55b28d8..9e3aca6 100644 (file)
@@ -45,7 +45,7 @@ typedef enum {
 static char *prev_appid;
 static char *cur_appid;
 
-static enum state_t prev_lcd_state = S_LCDOFF;
+static enum deviced_display_state prev_lcd_state = DEVICED_DISPLAY_STATE_OFF;
 
 /*
  * hash map for app_time_map_st1
@@ -212,7 +212,7 @@ static void update_appid(void)
        prev_appid = g_strdup(cur_appid);
 }
 
-int update_bds_record(enum state_t cur_lcd_state)
+int update_bds_record(enum deviced_display_state cur_lcd_state)
 {
        unsigned long elapsed = 0;
 
@@ -229,9 +229,9 @@ int update_bds_record(enum state_t cur_lcd_state)
        }
 
        /* no effect : prev state(lcd off) -> on or off */
-       if (prev_lcd_state >= S_LCDOFF) {
+       if (prev_lcd_state >= DEVICED_DISPLAY_STATE_OFF) {
                /* reset start time and timer if off -> on */
-               if (cur_lcd_state <= S_LCDDIM) {
+               if (cur_lcd_state <= DEVICED_DISPLAY_STATE_DIM) {
                        bds_set_start_time();
                        bds_timer_start();
                        init_bds_brightness_time();
@@ -256,7 +256,7 @@ int update_bds_record(enum state_t cur_lcd_state)
        update_appid();
 
        /* bds session end : lcd on -> off */
-       if (prev_lcd_state <= S_LCDDIM && cur_lcd_state >= S_LCDOFF)
+       if (prev_lcd_state <= DEVICED_DISPLAY_STATE_DIM && cur_lcd_state >= DEVICED_DISPLAY_STATE_OFF)
                bds_builder_update_bds_data();
 
        prev_lcd_state = cur_lcd_state;
@@ -407,13 +407,13 @@ static GVariant *dbus_get_bm_data(GDBusConnection *conn,
        update_bds_record(prev_lcd_state);
 
        /* pass. lcd on->off already handled */
-       if (prev_lcd_state <= S_LCDDIM)
+       if (prev_lcd_state <= DEVICED_DISPLAY_STATE_DIM)
                bds_builder_update_bds_data();
 
        reply = bds_builder_get_gvariant();
        init_bds_brightness_time();
 
-       if (prev_lcd_state <= S_LCDDIM) {
+       if (prev_lcd_state <= DEVICED_DISPLAY_STATE_DIM) {
                bds_set_start_time();
                bds_timer_start();
        }
index 3693e91..de3ec38 100644 (file)
 #include "core.h"
 
 typedef struct {
-       int (*update_bds_record)(enum state_t lcd_state);
+       int (*update_bds_record)(enum deviced_display_state lcd_state);
        int (*update_bds_brightness_record)(unsigned int val);
 } _battery_monitor_ops;
 
-int update_bds_record(enum state_t lcd_state);
+int update_bds_record(enum deviced_display_state lcd_state);
 int update_bds_brightness_record(unsigned int val);
 
 #endif /* __BATTERY_MONITOR_H__ */
\ No newline at end of file
index 85de74d..d5f0b79 100644 (file)
@@ -99,7 +99,7 @@ static bool launching_health_popup;
 static guint power_timer;
 static device_notifier_state_e old_state = -1;
 
-static enum state_t g_display_state = S_NORMAL;
+static enum deviced_display_state g_display_state = DEVICED_DISPLAY_STATE_ON;
 
 static struct battery_config_info g_battery_info;
 
@@ -1356,7 +1356,7 @@ bool battery_do_not_disturb(void)
        int block = 0, theater = 0, night = 0;
        int r;
 
-       if (g_display_state == S_LCDOFF) {
+       if (g_display_state == DEVICED_DISPLAY_STATE_OFF) {
                r = vconf_get_bool(VCONFKEY_SETAPPL_BLOCKMODE_WEARABLE_BOOL, &block);
                if (r < 0)
                        _E("Failed to set vconf value for blockmode wearable: %d", vconf_get_ext_errno());
index 34ce691..ab40e16 100644 (file)
@@ -164,8 +164,8 @@ void ambient_check_invalid_state(pid_t pid)
 
 static void ambient_start_clock(void)
 {
-       if ((get_pm_cur_state() == S_NORMAL) ||
-           (get_pm_cur_state() == S_LCDDIM) ||
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) ||
+           (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) ||
            (ambient_state == false))
                return;
 
@@ -175,8 +175,8 @@ static void ambient_start_clock(void)
 
 static void ambient_end_clock(pid_t pid)
 {
-       if ((get_pm_cur_state() == S_NORMAL) ||
-           (get_pm_cur_state() == S_LCDDIM) ||
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) ||
+           (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) ||
            (ambient_state == false))
                return;
 
index 5b71967..937634f 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __POWER_MANAGER_H__
 #define __POWER_MANAGER_H__
 
+#include <system/syscommon-plugin-deviced-display.h>
+
 #include "poll.h"
 #include "setting.h"
 #include "display.h"
 #endif
 
 /*
- * State enumeration
- */
-enum state_t {
-       S_START,
-       S_NORMAL,               /*< normal state */
-       S_LCDON = S_NORMAL, /*< LCD on == normal state*/
-       S_LCDDIM,               /*< LCD dimming */
-       S_LCDOFF,               /*< LCD off */
-       S_STANDBY,              /*< Standby */
-       S_SLEEP,                /*< system suspend */
-       S_SUSPEND = S_SLEEP, /*< Suspend == Sleep state */
-       S_POWEROFF,             /*< Power off */
-       S_END
-};
-
-/*
  * @brief State structure
  */
 struct state {
-       enum state_t state;           /**< state number */
+       enum deviced_display_state state;           /**< state number */
        const char *name;                   /**< state name (string) */
        int (*trans) (int evt);       /**< transition function pointer */
        int (*action) (int timeout);  /**< enter action */
@@ -78,7 +64,7 @@ struct state {
        int timeout;
 };
 
-struct state *state_st(enum state_t state);
+struct state *state_st(enum deviced_display_state state);
 
 /*
  * Global variables
@@ -93,7 +79,7 @@ typedef struct {
        unsigned int timeout2;
 } PMMsg;
 
-extern struct state state[S_END];
+extern struct state state[DEVICED_DISPLAY_STATE_END];
 
 /* setting.c */
 int get_lock_screen_bg_state(void);
@@ -102,7 +88,7 @@ void set_lock_screen_state(int state);
 void set_lock_screen_bg_state(bool state);
 
 /* core.c */
-int delete_condition(enum state_t state);
+int delete_condition(enum deviced_display_state state);
 int custom_lcdoff(enum device_flags flag);
 void broadcast_lcd_off_late(enum device_flags flags);
 
@@ -113,7 +99,7 @@ void set_brightness_changed_state(void);
 int init_pm_dbus(void);
 
 /* slave-logging.c */
-int save_pmlock(enum state_t state, bool on, pid_t pid);
+int save_pmlock(enum deviced_display_state state, bool on, pid_t pid);
 
 /**
  * @}
index a24eac7..8ec8498 100644 (file)
@@ -423,13 +423,13 @@ static GVariant *dbus_getbrightness(GDBusConnection *conn,
 {
        int brt = -1, ret, result;
 
-       if (get_pm_cur_state() == S_NORMAL) {
+       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) {
                ret = display_backlight_get_brightness(&brt);
                if (ret < 0)
                        result = 0;
                else
                        result = brt;
-       } else if (get_pm_cur_state() == S_LCDDIM) {
+       } else if (get_pm_cur_state() == 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());
@@ -497,7 +497,7 @@ 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() == S_LCDDIM) {
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_DIM) {
                        ret = display_backlight_set_brightness(brt);
                        if (ret < 0)
                                goto error;
@@ -734,19 +734,19 @@ static int set_lcd_timeout(int on, int dim, const char *name)
 
        if (on == 0 && dim == 0) {
                _I("LCD timeout changed: default setting");
-               display_state_transition_set_custom_timeout(S_NORMAL, 0);
-               display_state_transition_set_custom_timeout(S_LCDDIM, 0);
+               display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_ON, 0);
+               display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_DIM, 0);
        } else if (on < 0 || dim < 0) {
                _E("Failed to set value(on=%d dim=%d).", on, dim);
                return -EINVAL;
        } else {
                _I("LCD timeout changed: on=%ds dim=%ds", on, dim);
-               display_state_transition_set_custom_timeout(S_NORMAL, SEC_TO_MSEC(on));
-               display_state_transition_set_custom_timeout(S_LCDDIM, SEC_TO_MSEC(dim));
+               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));
        }
        /* Apply new backlight time */
        display_state_transition_update_display_state_timeout_by_priority();
-       if (get_pm_cur_state() == S_NORMAL)
+       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
 
        if (custom_change_name) {
@@ -754,16 +754,16 @@ static int set_lcd_timeout(int on, int dim, const char *name)
                custom_change_name = 0;
        }
 
-       display_state_transition_get_custom_timeout(S_NORMAL, &custom_normal_timeout);
-       display_state_transition_get_custom_timeout(S_LCDDIM, &custom_dim_timeout);
+       display_state_transition_get_custom_timeout(DEVICED_DISPLAY_STATE_ON, &custom_normal_timeout);
+       display_state_transition_get_custom_timeout(DEVICED_DISPLAY_STATE_DIM, &custom_dim_timeout);
        if (custom_normal_timeout == 0 && custom_dim_timeout == 0)
                return 0;
 
        custom_change_name = strndup(name, strlen(name));
        if (!custom_change_name) {
                _E("Failed to malloc.");
-               display_state_transition_set_custom_timeout(S_NORMAL, 0);
-               display_state_transition_set_custom_timeout(S_LCDDIM, 0);
+               display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_ON, 0);
+               display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_DIM, 0);
                return -ENOMEM;
        }
 
@@ -788,11 +788,11 @@ static void reset_lcd_timeout(GDBusConnection *conn,
 
        free(custom_change_name);
        custom_change_name = 0;
-       display_state_transition_set_custom_timeout(S_NORMAL, 0);
-       display_state_transition_set_custom_timeout(S_LCDDIM, 0);
+       display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_ON, 0);
+       display_state_transition_set_custom_timeout(DEVICED_DISPLAY_STATE_DIM, 0);
 
        display_state_transition_update_display_state_timeout_by_priority();
-       if (get_pm_cur_state() == S_NORMAL)
+       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
 }
 
@@ -908,7 +908,7 @@ static GVariant *dbus_customlcdon(GDBusConnection *conn,
        pid_t pid;
 
        pid = gdbus_connection_get_sender_pid(conn, sender);
-       _I("Change state to S_LCDON pid=%d", pid);
+       _I("Change state to DEVICED_DISPLAY_STATE_ON pid=%d", pid);
 
        g_variant_get(param, "(i)", &timeout);
 
@@ -933,7 +933,7 @@ static GVariant *dbus_customlcdoff(GDBusConnection *conn,
        pid_t pid;
 
        pid = gdbus_connection_get_sender_pid(conn, sender);
-       _I("Change state to S_LCDOFF pid=%d", pid);
+       _I("Change state to DEVICED_DISPLAY_STATE_OFF pid=%d", pid);
 
        g_variant_get(param, "(s)", &reason_str);
 
@@ -967,13 +967,13 @@ static GVariant *dbus_changestatebyreason(GDBusConnection *conn,
        g_variant_get(param, "(isi)", &next_state, &reason, &timeout);
 
        if (next_state == DISPLAY_STATE_NORMAL) {
-               state = "S_LCDON";
+               state = "DEVICED_DISPLAY_STATE_ON";
                ret = display_panel_display_turn_on_by_reason(reason, timeout);
        } else if (next_state == DISPLAY_STATE_SCREEN_OFF) {
-               state = "S_LCDOFF";
+               state = "DEVICED_DISPLAY_STATE_OFF";
                ret = display_panel_display_turn_off_by_reason(reason);
        } else if (next_state == DISPLAY_STATE_SCREEN_DIM) {
-               state = "S_LCDDIM";
+               state = "DEVICED_DISPLAY_STATE_DIM";
                ret = -EINVAL;
        } else {
                state = "unknown";
@@ -1250,7 +1250,7 @@ static GVariant *dbus_dimstay_control(GDBusConnection *conn,
                clear_pm_status_flag(DIM_FLAG);
        }
 
-       if (get_pm_cur_state() == S_NORMAL)
+       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                display_backlight_update_by_default_brightness();
 
 out:
@@ -1356,7 +1356,7 @@ static GVariant *dbus_pmlockgetlockstate(GDBusConnection *conn,
 {
        power_lock_e power_lock_type;
        bool pmlock_state = false;
-       enum state_t pmlock_type;
+       enum deviced_display_state pmlock_type;
        pid_t pid;
 
        g_variant_get(param, "(i)", &power_lock_type);
index 7c98250..0a71744 100644 (file)
@@ -48,7 +48,7 @@
 #define LOCK_WATCHDOG_PERIOD_SEC       600
 
 struct display_lock {
-       enum state_t state;
+       enum deviced_display_state state;
        pid_t pid;
        guint timeout_id;
        guint warning_id;
@@ -58,10 +58,10 @@ struct display_lock {
        GList *l;
 };
 
-static GList *g_display_fglock_list[S_END]; /* lock requested by foreground app */
-static GList *g_display_bglock_list[S_END]; /* lock requested by background app */
+static GList *g_display_fglock_list[DEVICED_DISPLAY_STATE_END]; /* lock requested by foreground app */
+static GList *g_display_bglock_list[DEVICED_DISPLAY_STATE_END]; /* lock requested by background app */
 
-static void broadcast_lock_changed(enum state_t state);
+static void broadcast_lock_changed(enum deviced_display_state state);
 
 static gboolean __find_lock(gconstpointer data, gconstpointer udata)
 {
@@ -74,7 +74,7 @@ static gboolean __find_lock(gconstpointer data, gconstpointer udata)
        return -1;
 }
 
-static struct display_lock* find_lock(enum state_t state, pid_t pid)
+static struct display_lock* find_lock(enum deviced_display_state state, pid_t pid)
 {
        GList *l;
 
@@ -92,7 +92,7 @@ static struct display_lock* find_lock(enum state_t state, pid_t pid)
 /* Add lock to list */
 static void add_lock(struct display_lock *dl)
 {
-       enum state_t state;
+       enum deviced_display_state state;
 
        if (!dl)
                return;
@@ -116,7 +116,7 @@ static void add_lock(struct display_lock *dl)
  */
 static void remove_lock(struct display_lock *dl)
 {
-       enum state_t state;
+       enum deviced_display_state state;
 
        if (!dl)
                return;
@@ -129,7 +129,7 @@ static void remove_lock(struct display_lock *dl)
 
 static void free_lock(struct display_lock *dl)
 {
-       enum state_t state;
+       enum deviced_display_state state;
 
        if (!dl)
                return;
@@ -195,33 +195,33 @@ static void set_lock_background(struct display_lock *dl)
        add_lock(dl);
 }
 
-int display_lock_is_state_locked(enum state_t state)
+int display_lock_is_state_locked(enum deviced_display_state state)
 {
        return (g_display_fglock_list[state] != NULL);
 }
 
-enum state_t power_lock_type_to_pmlock(power_lock_e power_lock_type)
+enum deviced_display_state power_lock_type_to_pmlock(power_lock_e power_lock_type)
 {
        switch(power_lock_type) {
        case POWER_LOCK_CPU:
-               return S_LCDOFF;
+               return DEVICED_DISPLAY_STATE_OFF;
        case POWER_LOCK_DISPLAY:
-               return S_LCDON;
+               return DEVICED_DISPLAY_STATE_ON;
        case POWER_LOCK_DISPLAY_DIM:
-               return S_LCDDIM;
+               return DEVICED_DISPLAY_STATE_DIM;
        default:
-               return S_END;
+               return DEVICED_DISPLAY_STATE_END;
        }
 }
 
-static void broadcast_lock_changed(enum state_t state)
+static void broadcast_lock_changed(enum deviced_display_state state)
 {
        int nlock = 0;
 
        switch(state) {
-       case S_LCDON:
-       case S_LCDDIM:
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_ON:
+       case DEVICED_DISPLAY_STATE_DIM:
+       case DEVICED_DISPLAY_STATE_OFF:
                break;
        default:
                return;
@@ -239,7 +239,7 @@ static void broadcast_lock_changed(enum state_t state)
                g_variant_new("(ii)", state, nlock));
 }
 
-static void broadcast_lock_watchdog_expired(pid_t pid, enum state_t state, const char* appid, time_t locktime)
+static void broadcast_lock_watchdog_expired(pid_t pid, enum deviced_display_state state, const char* appid, time_t locktime)
 {
        time_t now;
        double diff;
@@ -267,7 +267,7 @@ static void app_status_callback(GVariant *var, void *user_data, GError *err)
        pid_t pid = 0;
        int detected = 0;
        char *app_id = NULL;
-       enum state_t state = (enum state_t) user_data;
+       enum deviced_display_state state = (enum deviced_display_state) user_data;
        struct display_lock *dl;
 
        if (!var)
@@ -301,7 +301,7 @@ static gboolean lock_watchdog_callback(void *data)
 
        dl = (struct display_lock *) data;
 
-       if (dl->state == S_LCDOFF && display_panel_get_dpms_cached_state() == DPMS_ON) {
+       if (dl->state == DEVICED_DISPLAY_STATE_OFF && display_panel_get_dpms_cached_state() == DPMS_ON) {
                _D("Lcd state is PM_LCD_POWER_ON");
                return G_SOURCE_CONTINUE;
        }
@@ -322,13 +322,13 @@ static gboolean lock_watchdog_callback(void *data)
        }
 
        switch (dl->state) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                str = "normal";
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                str = "lcddim";
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                str = "lcdoff";
                break;
        default:
@@ -362,7 +362,7 @@ static gboolean lock_expired_callback(gpointer data)
        if (dl->pid == DEVICED_EVENT_DISPLAY_AMBIENT)
                ambient_check_invalid_state(dl->pid);
 
-       if (dl->state == S_LCDOFF)
+       if (dl->state == DEVICED_DISPLAY_STATE_OFF)
                set_process_active(false, dl->pid);
 
        set_unlock_time(dl->pid, dl->state);
@@ -378,11 +378,11 @@ static gboolean lock_expired_callback(gpointer data)
  * Return 0 on success.
  *        negative on error.
  */
-int display_lock_request_lock(enum state_t state, pid_t pid, unsigned int timeout)
+int display_lock_request_lock(enum deviced_display_state state, pid_t pid, unsigned int timeout)
 {
        struct display_lock *dl;
 
-       if (state < S_NORMAL || state > S_LCDOFF)
+       if (state < DEVICED_DISPLAY_STATE_ON || state > DEVICED_DISPLAY_STATE_OFF)
                return -EINVAL;
 
        dl = find_lock(state, pid);
@@ -399,7 +399,7 @@ int display_lock_request_lock(enum state_t state, pid_t pid, unsigned int timeou
                dl->timeout_id = g_timeout_add(timeout, lock_expired_callback, dl);
        dl->time = time(NULL);
        dl->broadcast_warning = true;
-       if (state == S_NORMAL || state == S_LCDDIM)
+       if (state == DEVICED_DISPLAY_STATE_ON || state == DEVICED_DISPLAY_STATE_DIM)
                dl->background = is_app_background(pid);
        if (pid < DEVICED_EVENT_BASE)
                dl->warning_id = g_timeout_add_seconds(LOCK_WATCHDOG_PERIOD_SEC, lock_watchdog_callback, dl);
@@ -409,11 +409,11 @@ int display_lock_request_lock(enum state_t state, pid_t pid, unsigned int timeou
        return 0;
 }
 
-int display_lock_update_lock(enum state_t state, pid_t pid, unsigned int timeout)
+int display_lock_update_lock(enum deviced_display_state state, pid_t pid, unsigned int timeout)
 {
        struct display_lock *dl;
 
-       if (state < S_NORMAL || state > S_LCDOFF)
+       if (state < DEVICED_DISPLAY_STATE_ON || state > DEVICED_DISPLAY_STATE_OFF)
                return -EINVAL;
 
        dl = find_lock(state, pid);
@@ -431,7 +431,7 @@ int display_lock_update_lock(enum state_t state, pid_t pid, unsigned int timeout
        return 0;
 }
 
-void display_lock_release_lock(enum state_t state, pid_t pid)
+void display_lock_release_lock(enum deviced_display_state state, pid_t pid)
 {
        struct display_lock *dl = find_lock(state, pid);
 
@@ -446,14 +446,14 @@ static void free_lock_all(gpointer data, gpointer udata)
 {
        struct display_lock *dl = (struct display_lock *) data;
 
-       if (dl->state == S_LCDOFF)
+       if (dl->state == DEVICED_DISPLAY_STATE_OFF)
                set_process_active(false, dl->pid);
 
        remove_lock(dl);
        free_lock(dl);
 }
 
-void display_lock_release_lock_all(enum state_t state)
+void display_lock_release_lock_all(enum deviced_display_state state)
 {
        g_list_foreach(g_display_fglock_list[state], free_lock_all, NULL);
        g_display_fglock_list[state] = NULL;
@@ -489,7 +489,7 @@ static void print_display_lock(gpointer data, gpointer udata)
 
 }
 
-void display_lock_print_lock(enum state_t state)
+void display_lock_print_lock(enum deviced_display_state state)
 {
        g_list_foreach(g_display_fglock_list[state], print_display_lock, NULL);
        g_list_foreach(g_display_bglock_list[state], print_display_lock, NULL);
@@ -500,11 +500,11 @@ int display_app_background(void *data)
        struct display_lock *dl;
        pid_t pid = *(pid_t *) data;
 
-       dl = find_lock(S_NORMAL, pid);
+       dl = find_lock(DEVICED_DISPLAY_STATE_ON, pid);
        if (dl)
                set_lock_background(dl);
 
-       dl = find_lock(S_LCDDIM, pid);
+       dl = find_lock(DEVICED_DISPLAY_STATE_DIM, pid);
        if (dl)
                set_lock_background(dl);
 
@@ -516,11 +516,11 @@ int display_app_foreground(void *data)
        struct display_lock *dl;
        pid_t pid = *(pid_t *) data;
 
-       dl = find_lock(S_NORMAL, pid);
+       dl = find_lock(DEVICED_DISPLAY_STATE_ON, pid);
        if (dl)
                set_lock_foreground(dl);
 
-       dl = find_lock(S_LCDDIM, pid);
+       dl = find_lock(DEVICED_DISPLAY_STATE_DIM, pid);
        if (dl)
                set_lock_foreground(dl);
 
@@ -531,9 +531,9 @@ int display_app_terminated(void *data)
 {
        pid_t pid = *(pid_t *) data;
 
-       display_lock_release_lock(S_NORMAL, pid);
-       display_lock_release_lock(S_LCDDIM, pid);
-       display_lock_release_lock(S_LCDOFF, pid);
+       display_lock_release_lock(DEVICED_DISPLAY_STATE_ON, pid);
+       display_lock_release_lock(DEVICED_DISPLAY_STATE_DIM, pid);
+       display_lock_release_lock(DEVICED_DISPLAY_STATE_OFF, pid);
 
        return 0;
 }
@@ -565,14 +565,14 @@ static void print_lock_info(gpointer data, gpointer udata)
 
 int display_lock_print_lock_info(int fd)
 {
-       enum state_t s;
+       enum deviced_display_state s;
        int index = 1;
        int *param[2] = { &index, &fd };
 
        if (fd < 0)
                return -EINVAL;
 
-       for (s = S_NORMAL; s < S_END; ++s) {
+       for (s = DEVICED_DISPLAY_STATE_ON; s < DEVICED_DISPLAY_STATE_END; ++s) {
                g_list_foreach(g_display_fglock_list[s], print_lock_info, param);
                g_list_foreach(g_display_bglock_list[s], print_lock_info, param);
        }
@@ -584,7 +584,7 @@ static void proc_condition_lock(PMMsg *data)
 {
        char pname[PATH_MAX];
        pid_t pid = data->pid;
-       enum state_t state;
+       enum deviced_display_state state;
        int ret;
        bool value = true;
        unsigned int flags;
@@ -592,13 +592,13 @@ static void proc_condition_lock(PMMsg *data)
        const char *state_name = NULL;
 
        state = GET_COND_STATE(data->cond);
-       if (state == S_START)
+       if (state == DEVICED_DISPLAY_STATE_START)
                return;
 
        flags = GET_COND_FLAG(data->cond);
        display_misc_get_process_name(pid, pname);
 
-       if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) &&
+       if ((state == DEVICED_DISPLAY_STATE_OFF) && (get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP) &&
            (pm_get_power_lock() == POWER_UNLOCK))
                display_state_transition_do_proc_change_state(data->cond, DEVICED_EVENT_DISPLAY_LOCK);
 
@@ -611,7 +611,7 @@ static void proc_condition_lock(PMMsg *data)
                return;
        }
 
-       if (state == S_LCDOFF)
+       if (state == DEVICED_DISPLAY_STATE_OFF)
                set_process_active(true, pid);
 
        display_plugin_state_get_name(state, &state_name);
@@ -619,11 +619,11 @@ static void proc_condition_lock(PMMsg *data)
 
        if (pid < DEVICED_EVENT_BASE) {
                /* for debug */
-               if (state == S_LCDOFF)
+               if (state == DEVICED_DISPLAY_STATE_OFF)
                        lock_type = PM_LCDOFF_STR;
-               else if (state == S_LCDDIM)
+               else if (state == DEVICED_DISPLAY_STATE_DIM)
                        lock_type = PM_LCDDIM_STR;
-               else if (state == S_NORMAL)
+               else if (state == DEVICED_DISPLAY_STATE_ON)
                        lock_type = PM_LCDON_STR;
 
                if (lock_type) {
@@ -647,7 +647,7 @@ static void proc_condition_lock(PMMsg *data)
 static void proc_condition_unlock(PMMsg *data)
 {
        pid_t pid = data->pid;
-       enum state_t state;
+       enum deviced_display_state state;
        char pname[PATH_MAX];
        bool value = false;
        unsigned int flags;
@@ -664,7 +664,7 @@ static void proc_condition_unlock(PMMsg *data)
 
        display_lock_release_lock(state, pid);
 
-       if (state == S_LCDOFF)
+       if (state == DEVICED_DISPLAY_STATE_OFF)
                set_process_active(false, pid);
 
        display_plugin_state_get_name(state, &state_name);
@@ -672,11 +672,11 @@ static void proc_condition_unlock(PMMsg *data)
 
        if (pid < DEVICED_EVENT_BASE) {
                /* for debug */
-               if (state == S_LCDOFF)
+               if (state == DEVICED_DISPLAY_STATE_OFF)
                        lock_type = PM_LCDOFF_STR;
-               else if (state == S_LCDDIM)
+               else if (state == DEVICED_DISPLAY_STATE_DIM)
                        lock_type = PM_LCDDIM_STR;
-               else if (state == S_NORMAL)
+               else if (state == DEVICED_DISPLAY_STATE_ON)
                        lock_type = PM_LCDON_STR;
 
                if (lock_type) {
@@ -717,8 +717,8 @@ int display_lock_proc_condition(PMMsg *data)
        flags = GET_COND_FLAG(data->cond);
        if (flags == 0) {
                /* guard time for suspend */
-               if (get_pm_cur_state() == S_LCDOFF) {
-                       display_plugin_state_get_timeout(S_LCDOFF, &timeout);
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) {
+                       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_OFF, &timeout);
                        display_state_transition_reset_state_transition_timeout(timeout);
                }
        } else {
index ab07a24..7986e96 100644 (file)
 #include <device/power.h>
 #include "core.h"
 
-enum state_t power_lock_type_to_pmlock(power_lock_e power_lock_type);
-void display_lock_print_lock(enum state_t state);
+enum deviced_display_state power_lock_type_to_pmlock(power_lock_e power_lock_type);
+void display_lock_print_lock(enum deviced_display_state state);
 
 int display_app_background(void *data);
 int display_app_foreground(void *data);
 int display_app_terminated(void *data);
 
-int display_lock_request_lock(enum state_t state, pid_t pid, unsigned int timeout);
-int display_lock_update_lock(enum state_t state, pid_t pid, unsigned int timeout);
-void display_lock_release_lock(enum state_t state, pid_t pid);
-void display_lock_release_lock_all(enum state_t state);
-int display_lock_is_state_locked(enum state_t state);
+int display_lock_request_lock(enum deviced_display_state state, pid_t pid, unsigned int timeout);
+int display_lock_update_lock(enum deviced_display_state state, pid_t pid, unsigned int timeout);
+void display_lock_release_lock(enum deviced_display_state state, pid_t pid);
+void display_lock_release_lock_all(enum deviced_display_state state);
+int display_lock_is_state_locked(enum deviced_display_state state);
 int display_lock_print_lock_info(int fd);
 
 int display_lock_proc_condition(PMMsg *data);
index 612a6d0..68a04ff 100644 (file)
@@ -153,9 +153,9 @@ static void print_info(int fd)
        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);
+       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
+       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
+       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_OFF, &off_stata_timeout);
 
        if (fd < 0)
                return;
@@ -172,13 +172,13 @@ static void print_info(int fd)
        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);
+       display_plugin_state_get_name(DEVICED_DISPLAY_STATE_ON, &normal_state_name);
+       display_plugin_state_get_name(DEVICED_DISPLAY_STATE_DIM, &dim_state_name);
+       display_plugin_state_get_name(DEVICED_DISPLAY_STATE_OFF, &off_state_name);
        snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n",
-                (display_lock_is_state_locked(S_NORMAL)) ? normal_state_name : "-",
-                (display_lock_is_state_locked(S_LCDDIM)) ? dim_state_name : "-",
-                (display_lock_is_state_locked(S_LCDOFF)) ? off_state_name : "-");
+                (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_ON)) ? normal_state_name : "-",
+                (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_DIM)) ? dim_state_name : "-",
+                (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_OFF)) ? off_state_name : "-");
        ret = write(fd, buf, strlen(buf));
        if (ret < 0)
                _E("Write() failed: %d", errno);
index 7c09fae..e9948ff 100644 (file)
@@ -253,9 +253,9 @@ void display_panel_lcd_on_procedure(int state, enum device_flags flag)
                display_backlight_update_by_default_brightness();
 
        if (state == LCD_NORMAL)
-               set_setting_pmstate(S_NORMAL);
+               set_setting_pmstate(DEVICED_DISPLAY_STATE_ON);
        else if (state == LCD_DIM)
-               set_setting_pmstate(S_LCDDIM);
+               set_setting_pmstate(DEVICED_DISPLAY_STATE_DIM);
 
        display_start_dependent_device(flags);
 
@@ -303,7 +303,7 @@ void display_panel_lcd_off_procedure(enum device_flags flag)
 
        display_misc_set_touch_event_blocked(true);
 
-       set_setting_pmstate(S_LCDOFF);
+       set_setting_pmstate(DEVICED_DISPLAY_STATE_OFF);
 
        touchled_control_backlight(TOUCHLED_DIRECT_OFF);
 
@@ -330,7 +330,7 @@ void display_panel_lcd_on_direct(enum device_flags flags)
                DEVICED_POWER_ATTR_SET_UINT64_4_CURRENT_STATE,
                DEVICED_POWER_STATE_SLEEP, DEVICED_POWER_STATE_NORMAL, reason, 0);
 
-       set_pm_cur_state(S_NORMAL);
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
 
        _D("lcd is on directly");
        display_panel_update_lcd_on_timeval();
@@ -339,7 +339,7 @@ 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 state_t next)
+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());
@@ -352,7 +352,7 @@ static void display_state_updated_to_next_and_do_action(enum state_t next)
 /* 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(S_NORMAL);
+       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
        return 0;
 }
 
@@ -371,7 +371,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(S_NORMAL);
+       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
 
        g_idle_add(timer_refresh_cb, NULL);
 
@@ -384,7 +384,7 @@ int display_panel_custom_lcd_off(enum device_flags flag)
                return 0;
 
        /* check holdkey block flag in lock node */
-       if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
+       if (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(DEVICED_DISPLAY_STATE_DIM)) {
                /*
                 * When another proccess is normal lock, device is received call then,
                 * call app can be changed to lcd state by proximity.
@@ -392,7 +392,7 @@ int display_panel_custom_lcd_off(enum device_flags flag)
                 */
                if (flag & LCD_OFF_BY_PROXIMITY) {
                        _I("custom lcd off by proximity, delete normal lock");
-                       display_lock_release_lock_all(S_NORMAL);
+                       display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
                } else {
                        _I("skip custom lcd off");
                        return -ECANCELED;
@@ -406,7 +406,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(S_LCDOFF);
+       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_OFF);
 
        return 0;
 }
@@ -448,7 +448,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(S_NORMAL);
+       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_ON);
 
        return 0;
 }
@@ -467,14 +467,14 @@ int display_panel_display_turn_off_by_reason(const char *reason)
        str_len = strlen(reason);
 
        if (!strncmp(reason, GESTURE_STR, str_len)) {
-               if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
+               if (display_lock_is_state_locked(DEVICED_DISPLAY_STATE_ON) || display_lock_is_state_locked(DEVICED_DISPLAY_STATE_DIM)) {
                        _I("skip platform lcd off by gesture");
                        return -ECANCELED;
                }
                flag = LCD_OFF_BY_GESTURE;
        } else if (!strncmp(reason, PALM_STR, str_len)) {
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
 
                flag = LCD_OFF_BY_PALM;
        } else {
@@ -486,7 +486,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(S_LCDOFF);
+       display_state_updated_to_next_and_do_action(DEVICED_DISPLAY_STATE_OFF);
 
        return 0;
 }
index 9078406..10d77bf 100644 (file)
@@ -190,7 +190,7 @@ int display_plugin_backlight_transit_brightness(int start, int end, int step)
 }
 
 /* FIXME: Below functions are temorary to separtate display state transition functions */
-int display_plugin_state_do_default_trans(enum state_t state, int evt)
+int display_plugin_state_do_default_trans(enum deviced_display_state state, int evt)
 {
        if (g_display_plugin.display_states[state] && g_display_plugin.display_states[state]->trans)
                return g_display_plugin.display_states[state]->trans(evt);
@@ -198,7 +198,7 @@ int display_plugin_state_do_default_trans(enum state_t state, int evt)
        return -EOPNOTSUPP;
 }
 
-bool display_plugin_state_is_there_default_trans(enum state_t state)
+bool display_plugin_state_is_there_default_trans(enum deviced_display_state state)
 {
        if (g_display_plugin.display_states[state] && g_display_plugin.display_states[state]->trans)
                return true;
@@ -206,7 +206,7 @@ bool display_plugin_state_is_there_default_trans(enum state_t state)
        return false;
 }
 
-int display_plugin_state_get_name(enum state_t state, const char **state_name)
+int display_plugin_state_get_name(enum deviced_display_state state, const char **state_name)
 {
        if (!state_name)
                return -EINVAL;
@@ -220,7 +220,7 @@ int display_plugin_state_get_name(enum state_t state, const char **state_name)
        return -EOPNOTSUPP;
 }
 
-int display_plugin_state_set_timeout(enum state_t state, int state_timeout)
+int display_plugin_state_set_timeout(enum deviced_display_state state, int state_timeout)
 {
        if (g_display_plugin.display_states[state]) {
                g_display_plugin.display_states[state]->timeout = state_timeout;
@@ -230,7 +230,7 @@ int display_plugin_state_set_timeout(enum state_t state, int state_timeout)
        return -EOPNOTSUPP;
 }
 
-int display_plugin_state_get_timeout(enum state_t state, int* state_timeout)
+int display_plugin_state_get_timeout(enum deviced_display_state state, int* state_timeout)
 {
        if (!state_timeout)
                return -EINVAL;
@@ -243,7 +243,7 @@ int display_plugin_state_get_timeout(enum state_t state, int* state_timeout)
        return -EOPNOTSUPP;
 }
 
-int display_plugin_state_get_state_by_state_index(int state_index, enum state_t *state)
+int display_plugin_state_get_state_by_state_index(int state_index, enum deviced_display_state *state)
 {
        if (!state)
                return -EINVAL;
index db36c4c..c50928a 100644 (file)
@@ -78,7 +78,7 @@ struct display_plugin {
 
        struct display_config *config;
        struct display_backlight_ops *backlight;
-       struct state* display_states[S_END];
+       struct state* display_states[DEVICED_DISPLAY_STATE_END];
 };
 extern struct display_plugin g_display_plugin;
 
@@ -106,12 +106,12 @@ int display_plugin_backlight_transit_state(int state);
 int display_plugin_backlight_transit_brightness(int start, int end, int step);
 
 /* FIXME: function names will be redefined */
-int display_plugin_state_do_default_trans(enum state_t state, int evt);
-bool display_plugin_state_is_there_default_trans(enum state_t state);
-int display_plugin_state_get_name(enum state_t state, const char **state_name);
-int display_plugin_state_set_timeout(enum state_t state, int state_timeout);
-int display_plugin_state_get_timeout(enum state_t state, int *state_timeout);
-int display_plugin_state_get_state_by_state_index(int state_index, enum state_t *state);
+int display_plugin_state_do_default_trans(enum deviced_display_state state, int evt);
+bool display_plugin_state_is_there_default_trans(enum deviced_display_state state);
+int display_plugin_state_get_name(enum deviced_display_state state, const char **state_name);
+int display_plugin_state_set_timeout(enum deviced_display_state state, int state_timeout);
+int display_plugin_state_get_timeout(enum deviced_display_state state, int *state_timeout);
+int display_plugin_state_get_state_by_state_index(int state_index, enum deviced_display_state *state);
 /* FIXME: This function used in the display lock related functions */
 bool display_plugin_state_is_there_proc_change_state(void);
 int display_plugin_state_proc_change_state(unsigned int cond, pid_t pid);
index 79c0b98..9281063 100644 (file)
@@ -44,20 +44,18 @@ static unsigned int custom_normal_timeout = 0;
 static unsigned int custom_dim_timeout = 0;
 static int lock_screen_timeout = LOCK_SCREEN_INPUT_TIMEOUT;
 
-static int trans_table[S_END][EVENT_END] = {
+static int trans_table[DEVICED_DISPLAY_STATE_END][EVENT_END] = {
        /* Timeout,   Input */
-       { S_START,    S_START    }, /* S_START */
-       { S_LCDDIM,   S_NORMAL   }, /* S_NORMAL */
-       { S_LCDOFF,   S_NORMAL   }, /* S_LCDDIM */
-       { S_SLEEP,    S_NORMAL   }, /* S_LCDOFF */
-       { S_SLEEP,    S_STANDBY  }, /* S_STANDBY */
-       { S_LCDOFF,   S_NORMAL   }, /* S_SLEEP */
-       { S_POWEROFF, S_POWEROFF }, /* S_POWEROFF */
+       { DEVICED_DISPLAY_STATE_START,    DEVICED_DISPLAY_STATE_START    }, /* S_START */
+       { DEVICED_DISPLAY_STATE_DIM,   DEVICED_DISPLAY_STATE_ON   }, /* DEVICED_DISPLAY_STATE_ON */
+       { DEVICED_DISPLAY_STATE_OFF,   DEVICED_DISPLAY_STATE_ON   }, /* DEVICED_DISPLAY_STATE_DIM */
+       { DEVICED_DISPLAY_STATE_SLEEP,    DEVICED_DISPLAY_STATE_ON   }, /* DEVICED_DISPLAY_STATE_OFF */
+       { DEVICED_DISPLAY_STATE_OFF,   DEVICED_DISPLAY_STATE_ON   }, /* DEVICED_DISPLAY_STATE_SLEEP */
 };
 
-static bool is_display_state_valid(enum state_t display_state)
+static bool is_display_state_valid(enum deviced_display_state display_state)
 {
-       return (display_state >= S_START && display_state < S_END);
+       return (display_state >= DEVICED_DISPLAY_STATE_START && display_state < DEVICED_DISPLAY_STATE_END);
 }
 
 static bool is_device_event_type_valid(int event_type)
@@ -65,7 +63,7 @@ static bool is_device_event_type_valid(int event_type)
        return (event_type >= EVENT_TIMEOUT && event_type < EVENT_END);
 }
 
-int display_state_transition_get_next_transition_display_state(enum state_t from_state, enum state_t *to_state, int evt_type)
+int display_state_transition_get_next_transition_display_state(enum deviced_display_state from_state, enum deviced_display_state *to_state, int evt_type)
 {
        if (!to_state || !is_display_state_valid(from_state) || !is_device_event_type_valid(evt_type))
                return -EINVAL;
@@ -74,7 +72,7 @@ int display_state_transition_get_next_transition_display_state(enum state_t from
        return 0;
 }
 
-int display_state_transition_set_transition_table_display_state(enum state_t display_state, enum state_t set_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)
 {
        if (!is_display_state_valid(display_state) || !is_device_event_type_valid(evt_type) || !is_display_state_valid(set_state))
                return -EINVAL;
@@ -114,7 +112,7 @@ int display_state_transition_reset_state_transition_timeout(int timeout)
        if (!display_plugin_config_get_timeout_enable(&timeout_enable) && (!timeout_enable))
                return -EPERM;
 
-       if ((get_pm_cur_state() == S_LCDOFF)
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF)
        && (syscommon_is_emulator() == true || timeout_sleep_support == false))
                return -EPERM;
 
@@ -133,15 +131,15 @@ int display_state_transition_reset_state_transition_timeout(int timeout)
        return 0;
 }
 
-int display_state_transition_set_custom_timeout(enum state_t state, unsigned int timeout)
+int display_state_transition_set_custom_timeout(enum deviced_display_state state, unsigned int timeout)
 {
        const char *state_name = NULL;
 
        switch (state) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                custom_normal_timeout = timeout;
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                custom_dim_timeout = timeout;
                break;
        default:
@@ -152,7 +150,7 @@ int display_state_transition_set_custom_timeout(enum state_t state, unsigned int
        return 0;
 }
 
-int display_state_transition_get_custom_timeout(enum state_t state, unsigned int *timeout)
+int display_state_transition_get_custom_timeout(enum deviced_display_state state, unsigned int *timeout)
 {
        if (!timeout)
                return -EINVAL;
@@ -160,10 +158,10 @@ int display_state_transition_get_custom_timeout(enum state_t state, unsigned int
        const char *state_name = NULL;
 
        switch (state) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                *timeout = custom_normal_timeout;
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                *timeout = custom_dim_timeout;
                break;
        default:
@@ -205,8 +203,8 @@ void display_state_transition_update_display_state_timeout_by_priority(void)
 
        /* first priority : custom timeout */
        if (custom_normal_timeout > 0) {
-               display_plugin_state_set_timeout(S_NORMAL, custom_normal_timeout);
-               display_plugin_state_set_timeout(S_LCDDIM, custom_dim_timeout);
+               display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_ON, custom_normal_timeout);
+               display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_DIM, custom_dim_timeout);
                _I("CUSTOM : timeout is set by normal(%u ms), dim(%u ms)",
                    custom_normal_timeout, custom_dim_timeout);
                return;
@@ -216,7 +214,7 @@ void display_state_transition_update_display_state_timeout_by_priority(void)
        if ((__get_lock_screen_state() == VCONFKEY_IDLE_LOCK) &&
            !get_lock_screen_bg_state()) {
                /* timeout is different according to key or event. */
-               display_plugin_state_set_timeout(S_NORMAL, lock_screen_timeout);
+               display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_ON, lock_screen_timeout);
                _I("LOCK: Timeout(%d ms) is set by normal.",
                    lock_screen_timeout);
                return;
@@ -234,24 +232,24 @@ void display_state_transition_update_display_state_timeout_by_priority(void)
                _I("LCD always on.");
        }
 
-       display_plugin_state_set_timeout(S_NORMAL, run_timeout);
+       display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_ON, run_timeout);
 
        get_dim_timeout(&val);
-       display_plugin_state_set_timeout(S_LCDDIM, val);
+       display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_DIM, val);
 
-       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(DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
+       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
        _I("Normal: NORMAL timeout is set by %d ms", normal_state_timeout);
        _I("Normal: DIM timeout is set by %d ms", dim_state_timeout);
 }
 
-bool display_state_transition_is_display_state_support_transition(enum state_t state)
+bool display_state_transition_is_display_state_support_transition(enum deviced_display_state state)
 {
        switch(state) {
-       case S_NORMAL:
-       case S_LCDDIM:
-       case S_LCDOFF:
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_ON:
+       case DEVICED_DISPLAY_STATE_DIM:
+       case DEVICED_DISPLAY_STATE_OFF:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                return true;
        default:
                return false;
@@ -260,12 +258,12 @@ bool display_state_transition_is_display_state_support_transition(enum state_t s
        return false;
 }
 
-int display_state_transition_check_state_transition_condition(enum state_t cur_state, enum state_t next_state)
+int display_state_transition_check_state_transition_condition(enum deviced_display_state cur_state, enum deviced_display_state next_state)
 {
        if (!display_state_transition_is_display_state_support_transition(cur_state))
                return -EPERM;
 
-       if (next_state == S_NORMAL) /* S_NORMAL is exceptional */
+       if (next_state == DEVICED_DISPLAY_STATE_ON) /* DEVICED_DISPLAY_STATE_ON is exceptional */
                return 0;
 
        if (display_lock_is_state_locked(cur_state)) {
@@ -306,10 +304,10 @@ bool display_state_transition_is_possible_to_go_lcdoff(void)
        int hdmi_state;
        int dimming;
 
-       if (get_pm_old_state() != S_NORMAL)
+       if (get_pm_old_state() != DEVICED_DISPLAY_STATE_ON)
                return false;
 
-       if (get_pm_cur_state() != S_LCDDIM)
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_DIM)
                return false;
 
        display_plugin_config_get_dimming(&dimming);
@@ -342,11 +340,11 @@ bool display_state_transition_is_possible_to_go_lcdoff(void)
  *   2. transition
  *   3. call enter action function
  */
-int display_state_transition_do_state_transition(enum state_t state, int evt_type)
+int display_state_transition_do_state_transition(enum deviced_display_state state, int evt_type)
 {
        const char* current_state_name = NULL;
        const char* next_state_name = NULL;
-       enum state_t next_state;
+       enum deviced_display_state next_state;
        int ret = 0;
        int timeout = 0;
 
@@ -374,10 +372,10 @@ int display_state_transition_do_state_transition(enum state_t state, int evt_typ
 
        /* enter action */
        if (display_state_transition_is_display_state_support_transition(get_pm_cur_state())) {
-               if (get_pm_cur_state() == S_LCDOFF)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF)
                        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
 
-               if ((get_pm_cur_state() == S_NORMAL) || (get_pm_cur_state() == S_LCDOFF))
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF))
                        if (set_custom_lcdon_timeout(0) == true)
                                display_state_transition_update_display_state_timeout_by_priority();
 
@@ -385,7 +383,7 @@ int display_state_transition_do_state_transition(enum state_t state, int evt_typ
                        /* enter next state directly */
                        display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_TIMEOUT);
                } else {
-                       if ((get_pm_cur_state() == S_SLEEP) &&
+                       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP) &&
                        (syscommon_is_emulator() == true || timeout_sleep_support == false))
                                return 0;
 
@@ -406,11 +404,11 @@ int display_state_transition_do_state_transition_by_input_poll_event(void)
                return -ECANCELED;
        }
 
-       if ((get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP))
+       if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP))
                _I("Input event signal at Display Off");
 
        time(&now);
-       if ((last_time != now) || (get_pm_cur_state() == S_LCDOFF) || (get_pm_cur_state() == S_SLEEP)) {
+       if ((last_time != now) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_OFF) || (get_pm_cur_state() == DEVICED_DISPLAY_STATE_SLEEP)) {
                display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
                last_time = now;
        }
@@ -456,8 +454,8 @@ int display_state_transition_do_state_action(int timeout)
                return -EINVAL;
        }
 
-       if (get_pm_cur_state() != S_SLEEP) {
-               if ((get_pm_cur_state() == S_NORMAL)) {
+       if (get_pm_cur_state() != DEVICED_DISPLAY_STATE_SLEEP) {
+               if ((get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)) {
                        if (display_panel_calculate_diff_time_between_lcd_on_direct_and_state_action(&diff_time) == 0) {
                                timeout -= diff_time;
                        }
@@ -466,7 +464,7 @@ int display_state_transition_do_state_action(int timeout)
                /* set timer with current state timeout */
                display_state_transition_reset_state_transition_timeout(timeout);
 
-               if (get_pm_cur_state() == S_NORMAL) {
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON) {
                        time(&last_update_time);
                        last_timeout = timeout;
                } else {
@@ -475,7 +473,7 @@ int display_state_transition_do_state_action(int timeout)
                }
        }
 
-       if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != S_SLEEP)) {
+       if ((get_pm_cur_state() != get_pm_old_state()) && (get_pm_cur_state() != DEVICED_DISPLAY_STATE_SLEEP)) {
                int wakeup_reason = 0;
 
                syscommon_resman_get_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_POWER),
@@ -489,42 +487,42 @@ int display_state_transition_do_state_action(int timeout)
                syscommon_notifier_emit_notify(DEVICE_NOTIFIER_LCD, (void *)&pm_cur_state);
        }
 
-       if ((get_pm_old_state() == S_NORMAL) && (get_pm_cur_state() != S_NORMAL)) {
+       if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_ON) && (get_pm_cur_state() != DEVICED_DISPLAY_STATE_ON)) {
                time(&now);
                diff = difftime(now, last_update_time);
                display_plugin_state_get_name(get_pm_cur_state(), &state_name);
-               _I("S_NORMAL is changed to %s (timeout=%d ms diff=%.0f s).",
+               _I("DEVICED_DISPLAY_STATE_ON is changed to %s (timeout=%d ms diff=%.0f s).",
                        state_name, last_timeout, diff);
        }
 
        switch (get_pm_cur_state()) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                /*
                 * normal state : backlight on and restore
                 * the previous brightness
                 */
-               if (get_pm_old_state() == S_LCDDIM)
+               if (get_pm_old_state() == DEVICED_DISPLAY_STATE_DIM)
                        display_backlight_update_by_default_brightness();
 
                if (display_panel_get_dpms_cached_state() != DPMS_ON)
                        display_panel_lcd_on_procedure(LCD_NORMAL, NORMAL_MODE);
                break;
 
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_backlight_get_custom_status(&custom_status);
-               if ((get_pm_old_state() == S_NORMAL) && custom_status) {
+               if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_ON) && custom_status) {
                        display_backlight_get_brightness(&brightness);
                        display_backlight_set_custom_brightness(brightness);
                }
                /* lcd dim state : dim the brightness */
                display_backlight_set_brightness_by_dim_brightness();
 
-               if ((get_pm_old_state() == S_LCDOFF) || (get_pm_old_state() == S_SLEEP))
+               if ((get_pm_old_state() == DEVICED_DISPLAY_STATE_OFF) || (get_pm_old_state() == DEVICED_DISPLAY_STATE_SLEEP))
                        display_panel_lcd_on_procedure(LCD_DIM, NORMAL_MODE);
                break;
 
-       case S_LCDOFF:
-               if ((get_pm_old_state() != S_SLEEP) && (get_pm_old_state() != S_LCDOFF)) {
+       case DEVICED_DISPLAY_STATE_OFF:
+               if ((get_pm_old_state() != DEVICED_DISPLAY_STATE_SLEEP) && (get_pm_old_state() != DEVICED_DISPLAY_STATE_OFF)) {
                        /* lcd off state : turn off the backlight */
                        if (display_panel_get_dpms_cached_state() == DPMS_ON)
                                display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
@@ -536,7 +534,7 @@ int display_state_transition_do_state_action(int timeout)
                        display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
                break;
 
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        display_panel_lcd_off_procedure(LCD_OFF_BY_TIMEOUT);
 
@@ -580,7 +578,7 @@ go_lcd_off:
 }
 
 /* FIXME: this function is temporary, it will be refactored */
-void display_state_transition_do_proc_change_state_action(enum state_t next, int timeout)
+void display_state_transition_do_proc_change_state_action(enum deviced_display_state next, int timeout)
 {
        int state_timeout = 0;
 
@@ -599,7 +597,7 @@ void display_state_transition_do_proc_change_state_action(enum state_t next, int
 /* FIXME: this function is temporary, it will be refactored */
 int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid)
 {
-       enum state_t next;
+       enum deviced_display_state next;
        const char *state_name = NULL;
 
        if (display_plugin_state_is_there_proc_change_state())
@@ -610,36 +608,36 @@ int display_state_transition_do_proc_change_state(unsigned int cond, pid_t pid)
        _I("Change process(%d) state to %s.", pid, state_name);
 
        switch (next) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                if (display_panel_get_dpms_cached_state() != DPMS_ON)
                        display_panel_lcd_on_direct(LCD_ON_BY_EVENT);
                display_state_transition_update_lock_screen_timeout(LOCK_SCREEN_CONTROL_TIMEOUT);
                display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE);
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE);
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                if (display_panel_get_dpms_cached_state() == DPMS_ON)
                        display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
                if (set_custom_lcdon_timeout(0))
                        display_state_transition_update_display_state_timeout_by_priority();
                display_state_transition_do_proc_change_state_action(next, TIMEOUT_NONE);
                break;
-       case S_SLEEP:
+       case DEVICED_DISPLAY_STATE_SLEEP:
                _I("Dangerous requests.");
                /* at first LCD_OFF and then goto sleep */
                /* state transition */
-               display_state_transition_do_proc_change_state_action(S_LCDOFF, TIMEOUT_NONE);
-               display_lock_release_lock_all(S_NORMAL);
-               display_lock_release_lock_all(S_LCDDIM);
-               display_lock_release_lock_all(S_LCDOFF);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_OFF, TIMEOUT_NONE);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
+               display_lock_release_lock_all(DEVICED_DISPLAY_STATE_OFF);
                if (display_panel_is_lcd_on_state_broadcasted()) {
                        _I("broadcast lcd off signal at non-lcd device");
                        broadcast_lcd_off(SIGNAL_PRE, 0);
                        broadcast_lcd_off(SIGNAL_POST, 0);
                }
-               display_state_transition_do_proc_change_state_action(S_SLEEP, TIMEOUT_NONE);
+               display_state_transition_do_proc_change_state_action(DEVICED_DISPLAY_STATE_SLEEP, TIMEOUT_NONE);
                break;
 
        default:
index 9ef1708..67f44af 100644 (file)
 
 #define LOCK_SCREEN_INPUT_TIMEOUT      10000
 
-int display_state_transition_get_next_transition_display_state(enum state_t from_state, enum state_t *to_state, int evt_type);
-int display_state_transition_set_transition_table_display_state(enum state_t display_state, enum state_t set_state, int evt_type);
+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);
 int display_state_transition_reset_state_transition_timeout(int timeout);
-int display_state_transition_set_custom_timeout(enum state_t state, unsigned int timeout);
-int display_state_transition_get_custom_timeout(enum state_t state, unsigned int *timeout);
+int display_state_transition_set_custom_timeout(enum deviced_display_state state, unsigned int timeout);
+int display_state_transition_get_custom_timeout(enum deviced_display_state state, unsigned int *timeout);
 int display_state_transition_set_lock_screen_timeout(int timeout);
 int display_state_transition_get_lock_screen_timeout(int *timeout);
 void display_state_transition_update_lock_screen_timeout(int timeout);
 void display_state_transition_update_display_state_timeout_by_priority(void);
-int display_state_transition_check_state_transition_condition(enum state_t cur_state, enum state_t next_state);
+int display_state_transition_check_state_transition_condition(enum deviced_display_state cur_state, enum deviced_display_state next_state);
 int display_state_transition_update_lcdoff_reason(int source);
 bool display_state_transition_is_possible_to_go_lcdoff(void);
-int display_state_transition_do_state_transition(enum state_t state, int evt_type);
-bool display_state_transition_is_display_state_support_transition(enum state_t state);
+int display_state_transition_do_state_transition(enum deviced_display_state state, int evt_type);
+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 state_t next, 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);
 
index ef7db97..56da104 100644 (file)
@@ -78,16 +78,15 @@ int display_util_get_display_state(int s_bits)
 {
        switch (s_bits) {
        case LCD_NORMAL:
-               return S_NORMAL;
+               return DEVICED_DISPLAY_STATE_ON;
        case LCD_DIM:
-               return S_LCDDIM;
+               return DEVICED_DISPLAY_STATE_DIM;
        case LCD_OFF:
-               return S_LCDOFF;
        case STANDBY:
-               return S_STANDBY;
+               return DEVICED_DISPLAY_STATE_OFF;
        case SUSPEND:
-               return S_SLEEP;
+               return DEVICED_DISPLAY_STATE_SLEEP;
        default:
                return -EINVAL;
        }
-}
\ No newline at end of file
+}
index 86d6f56..9732016 100644 (file)
@@ -174,18 +174,18 @@ int display_initialize_display_state_timeout_from_setting(void)
        int i;
        int val = 0;
        const char* state_name = NULL;
-       enum state_t state = S_START;
+       enum deviced_display_state state = DEVICED_DISPLAY_STATE_START;
 
-       for (i = 0; i < S_END; i++) {
+       for (i = 0; i < DEVICED_DISPLAY_STATE_END; i++) {
                display_plugin_state_get_state_by_state_index(i, &state);
                switch (state) {
-               case S_NORMAL:
+               case DEVICED_DISPLAY_STATE_ON:
                        get_run_timeout(&val);
                        break;
-               case S_LCDDIM:
+               case DEVICED_DISPLAY_STATE_DIM:
                        get_dim_timeout(&val);
                        break;
-               case S_LCDOFF:
+               case DEVICED_DISPLAY_STATE_OFF:
                        display_plugin_config_get_lcdoff_timeout(&val);
                        break;
                default:
@@ -236,7 +236,7 @@ void display_set_power_save_mode_flag(int onoff)
        else
                clear_pm_status_flag(PWRSV_FLAG);
 
-       if (get_pm_cur_state() == S_NORMAL)
+       if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                display_backlight_update_by_default_brightness();
 }
 
@@ -280,19 +280,19 @@ static gboolean delayed_dpms_init_done(gpointer data)
                return G_SOURCE_CONTINUE;
 
        switch (get_pm_cur_state()) {
-       case S_NORMAL:
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_ON:
+       case DEVICED_DISPLAY_STATE_DIM:
                display_panel_lcd_on_procedure(LCD_NORMAL, LCD_ON_BY_EVENT);
                display_plugin_config_get_timeout_enable(&timeout_enable);
                if (timeout_enable) {
-                       display_plugin_state_get_timeout(S_NORMAL, &timeout);
+                       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_ON, &timeout);
                        /* check minimun lcd on time */
                        if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
                                timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
                        display_state_transition_reset_state_transition_timeout(timeout);
                }
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                display_panel_lcd_off_procedure(LCD_OFF_BY_EVENT);
                display_plugin_config_get_lcdoff_timeout(&lcdoff_timeout);
                display_state_transition_reset_state_transition_timeout(lcdoff_timeout);
@@ -367,7 +367,7 @@ void display_set_initial_lockscreen_status(void)
        set_lock_screen_state(lock_state);
        display_state_transition_get_lock_screen_timeout(&lock_screen_timeout);
        if (lock_state == VCONFKEY_IDLE_LOCK) {
-               display_plugin_state_set_timeout(S_NORMAL, lock_screen_timeout);
+               display_plugin_state_set_timeout(DEVICED_DISPLAY_STATE_ON, lock_screen_timeout);
                _I("LCD NORMAL timeout(%d ms) is set for lock screen.", lock_screen_timeout);
        }
 }
@@ -591,7 +591,7 @@ static void display_init(void *data)
        display_plugin_config_get_lcd_always_on(&lcd_always_on);
        if (lcd_always_on) {
                _I("LCD always on.");
-               display_state_transition_set_transition_table_display_state(S_NORMAL, S_NORMAL, EVENT_TIMEOUT);
+               display_state_transition_set_transition_table_display_state(DEVICED_DISPLAY_STATE_ON, DEVICED_DISPLAY_STATE_ON, EVENT_TIMEOUT);
        }
 
        if (flags & WITHOUT_STARTNOTI) {        /* start without noti */
@@ -611,16 +611,16 @@ static void display_init(void *data)
 
                /* Initial display state right after the booting done */
                if (display_plugin_is_lcd_on_blocked())
-                       set_pm_cur_state(S_LCDOFF);
+                       set_pm_cur_state(DEVICED_DISPLAY_STATE_OFF);
                else
-                       set_pm_cur_state(S_NORMAL);
+                       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());
 
                display_set_display_ops_status(DEVICE_OPS_STATUS_START);
                if (timeout_enable) {
-                       display_plugin_state_get_timeout(S_NORMAL, &timeout);
+                       display_plugin_state_get_timeout(DEVICED_DISPLAY_STATE_ON, &timeout);
                        /* check minimun lcd on time */
                        if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT)) {
                                timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
@@ -644,8 +644,8 @@ static void display_exit(void *data)
 
        display_set_display_ops_status(DEVICE_OPS_STATUS_STOP);
 
-       /* Set current state to S_NORMAL */
-       set_pm_cur_state(S_NORMAL);
+       /* Set current state to DEVICED_DISPLAY_STATE_ON */
+       set_pm_cur_state(DEVICED_DISPLAY_STATE_ON);
        set_setting_pmstate(get_pm_cur_state());
        /* timeout is not needed */
        display_state_transition_reset_state_transition_timeout(TIMEOUT_NONE);
index d57f643..64fc6d0 100644 (file)
@@ -110,7 +110,7 @@ int set_lock_time(pid_t pid, const char *pname, int state)
        if (!pname)
                return -EINVAL;
 
-       if (state < S_NORMAL || state > S_SLEEP)
+       if (state < DEVICED_DISPLAY_STATE_ON || state > DEVICED_DISPLAY_STATE_SLEEP)
                return -EINVAL;
 
        save_pmlock(state, true, pid);
@@ -199,7 +199,7 @@ int set_unlock_time(pid_t pid, int state)
        unsigned long val;
        char ht[15];
 
-       if (state < S_NORMAL || state > S_SLEEP)
+       if (state < DEVICED_DISPLAY_STATE_ON || state > DEVICED_DISPLAY_STATE_SLEEP)
                return -EINVAL;
 
        save_pmlock(state, false, pid);
index c6509f5..9755685 100644 (file)
@@ -61,11 +61,11 @@ static gboolean display_state_send_system_event(gpointer data)
        const char *str;
        int state = (intptr_t)data;
 
-       if (state == S_NORMAL)
+       if (state == DEVICED_DISPLAY_STATE_ON)
                str = EVT_VAL_DISPLAY_NORMAL;
-       else if (state == S_LCDDIM)
+       else if (state == DEVICED_DISPLAY_STATE_DIM)
                str = EVT_VAL_DISPLAY_DIM;
-       else if (state == S_LCDOFF)
+       else if (state == DEVICED_DISPLAY_STATE_OFF)
                str = EVT_VAL_DISPLAY_OFF;
        else
                return G_SOURCE_REMOVE;
@@ -127,7 +127,7 @@ int get_usb_status(int *val)
 
 int set_setting_pmstate(int val)
 {
-       static int prev = S_NORMAL;
+       static int prev = DEVICED_DISPLAY_STATE_ON;
 
        if (prev == val)
                return 0;
@@ -317,19 +317,19 @@ 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() == S_NORMAL) &&
+               if ((get_pm_cur_state() == 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() == S_NORMAL)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                        display_state_transition_do_state_transition(get_pm_cur_state(), 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() == S_NORMAL)
+               if (get_pm_cur_state() == DEVICED_DISPLAY_STATE_ON)
                        display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_INPUT);
                break;
        case SETTING_POWER_CUSTOM_BRIGHTNESS:
index 149e551..53d6a84 100644 (file)
@@ -35,7 +35,7 @@
 
 static bool userlock_saving_support;
 
-int save_pmlock(enum state_t state, bool on, pid_t pid)
+int save_pmlock(enum deviced_display_state state, bool on, pid_t pid)
 {
        int ret = 0;
        char *node, *state_str;
@@ -45,13 +45,13 @@ int save_pmlock(enum state_t state, bool on, pid_t pid)
                return -ENOSYS;
 
        switch (state) {
-       case S_NORMAL:
+       case DEVICED_DISPLAY_STATE_ON:
                state_str = DISP_LOCK_STR;
                break;
-       case S_LCDDIM:
+       case DEVICED_DISPLAY_STATE_DIM:
                state_str = DIM_LOCK_STR;
                break;
-       case S_LCDOFF:
+       case DEVICED_DISPLAY_STATE_OFF:
                state_str  = MAIN_LOCK_STR;
                break;
        default:
index b6d2c5d..57f9c70 100644 (file)
@@ -82,14 +82,14 @@ static int cradle_update(const char *index, int status)
 
 static int display_changed(void *data)
 {
-       enum state_t state;
+       enum deviced_display_state state;
        int cradle;
 
        if (!data)
                return 0;
 
        state = *(int *)data;
-       if (state != S_NORMAL)
+       if (state != DEVICED_DISPLAY_STATE_ON)
                return 0;
 
        cradle = cradle_extcon_ops.status;
index 799abb5..34acea4 100644 (file)
@@ -201,7 +201,7 @@ static int hardkey_lcd_changed_cb(void *data)
                return 0;
 
        lcd_state = *(int*)data;
-       if (lcd_state == S_NORMAL
+       if (lcd_state == DEVICED_DISPLAY_STATE_ON
            && hardkey_duration == KEYBACKLIGHT_TIME_ALWAYS_ON) {
                touchled_set_state(true);
                return 0;
index d8748fb..6bfea4f 100644 (file)
@@ -149,7 +149,7 @@ static void setting_doze_mode_cb(keynode_t *key, void *data)
                _D("Doze mode disabled.");
        } else if (doze_mode == DOZE_ENABLED) {
                _D("Doze mode enabled.");
-               if (display_state == S_LCDOFF || display_state == S_SLEEP)
+               if (display_state == DEVICED_DISPLAY_STATE_OFF || display_state == DEVICED_DISPLAY_STATE_SLEEP)
                        _enter_doze();
        }
 
index 63040b2..69ce017 100644 (file)
@@ -361,10 +361,10 @@ static int time_lcd_changed_cb(void *data)
 
        lcd_state = *(int *)data;
 
-       if (lcd_state < S_LCDOFF)
+       if (lcd_state < DEVICED_DISPLAY_STATE_OFF)
                goto restart;
 
-       lcd_state = display_lock_is_state_locked(S_LCDOFF);
+       lcd_state = display_lock_is_state_locked(DEVICED_DISPLAY_STATE_OFF);
 
        if (lcd_state || !tfdh || tfd == -1)
                goto out;