Removed unused S_STANDBY, S_SUSPEND and S_POWEROFF.
Change-Id: I16ecff84bf8b3bf0379afe43942aa28d2950f4b2
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
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 */
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 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];
}
/**
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)
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();
}
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 {
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 */
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:
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 */
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);
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:
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];
}
/**
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)
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();
}
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 {
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 */
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:
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 */
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 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];
}
/**
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)
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();
}
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 {
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 */
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:
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;
}
/* 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;
}
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)
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);
}
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) {
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)
}
} 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);
}
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;
}
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) {
/* 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);
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);
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;
}
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 */
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];
}
}
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);
ambient_set_state(true);
}
- set_setting_pmstate(S_LCDOFF);
+ set_setting_pmstate(DEVICED_DISPLAY_STATE_OFF);
if (transit_timer) {
g_source_remove(transit_timer);
/* 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)
/* 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 */
{
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.
*/
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;
/* 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 */
/* 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 */
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 {
/* 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 */
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:
{
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);
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;
}
/* 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();
/* 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;
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;
}
/* 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 {
}
}
- 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());
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);
}
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);
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);
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:
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];
}
/**
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);
}
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);
state = DATA_VALUE_INT(data);
- if (state == S_NORMAL)
+ if (state == DEVICED_DISPLAY_STATE_ON)
enhance_update_state();
return 0;
{
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;
}
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.");
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)
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();
}
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 {
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 */
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:
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;
_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);
}
}
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
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;
}
/* 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();
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;
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();
}
#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
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;
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());
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;
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;
#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 */
int timeout;
};
-struct state *state_st(enum state_t state);
+struct state *state_st(enum deviced_display_state state);
/*
* Global variables
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);
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);
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);
/**
* @}
{
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());
_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;
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) {
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;
}
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);
}
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);
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);
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";
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:
{
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);
#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;
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)
{
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;
/* Add lock to list */
static void add_lock(struct display_lock *dl)
{
- enum state_t state;
+ enum deviced_display_state state;
if (!dl)
return;
*/
static void remove_lock(struct display_lock *dl)
{
- enum state_t state;
+ enum deviced_display_state state;
if (!dl)
return;
static void free_lock(struct display_lock *dl)
{
- enum state_t state;
+ enum deviced_display_state state;
if (!dl)
return;
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;
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;
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)
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;
}
}
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:
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);
* 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);
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);
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);
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);
{
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;
}
-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);
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);
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);
{
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;
}
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);
}
{
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;
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);
return;
}
- if (state == S_LCDOFF)
+ if (state == DEVICED_DISPLAY_STATE_OFF)
set_process_active(true, pid);
display_plugin_state_get_name(state, &state_name);
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) {
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;
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);
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) {
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 {
#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);
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;
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);
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);
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);
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();
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());
/* 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;
}
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);
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.
*/
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;
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;
}
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;
}
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 (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;
}
}
/* 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);
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;
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;
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;
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;
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;
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;
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);
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)
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;
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;
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;
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:
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;
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:
/* 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;
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;
_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;
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)) {
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);
* 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;
/* 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();
/* 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;
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;
}
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;
}
/* 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 {
}
}
- 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),
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);
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);
}
/* 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;
/* 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())
_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:
#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);
{
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
+}
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:
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();
}
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);
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);
}
}
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 */
/* 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);
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);
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);
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);
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;
int set_setting_pmstate(int val)
{
- static int prev = S_NORMAL;
+ static int prev = DEVICED_DISPLAY_STATE_ON;
if (prev == val)
return 0;
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:
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;
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:
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;
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;
_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();
}
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;