The core operations has changed to only work on top of default states.
Only wearable is working with its own states but it can figure out
the states by its plugin functions internally regardless of the default
states. Likewise, the core operations are not using the plugin states
if it works in a default way. Therefore, as the deviced core states
and plugin states are totally working independently, the deviced core
has changed not to manage plugin states.
Change-Id: I3e08d77285bfb87a8be0925548b0987b3f78e2cd
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
static struct display_plugin *disp_plgn;
-static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
- { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, "SYSCOMMON_DEVICED_DISPLAY_STATE_OFF", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, "SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP", NULL, NULL, NULL, NULL },
-};
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 400 /* 0.4 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
return &display_conf;
}
-inline struct syscommon_deviced_display_state_info* state_st(enum syscommon_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 < SYSCOMMON_DEVICED_DISPLAY_STATE_END; i++)
- dp->display_states[i] = &states[i];
-}
/**
* Power manager Main
*
struct display_plugin *dp = (struct display_plugin *) data;
assert(dp);
- init_display_states(dp);
dp->proc_change_state = NULL;
return 0;
static struct display_plugin *disp_plgn;
-static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
- { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, "SYSCOMMON_DEVICED_DISPLAY_STATE_OFF", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, "SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP", NULL, NULL, NULL, NULL },
-};
-
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 2 /* 2 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
return &display_conf;
}
-inline struct syscommon_deviced_display_state_info* state_st(enum syscommon_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 < SYSCOMMON_DEVICED_DISPLAY_STATE_END; i++)
- dp->display_states[i] = &states[i];
-}
/**
* Power manager Main
*
struct display_plugin *dp = (struct display_plugin *) data;
assert(dp);
- init_display_states(dp);
dp->proc_change_state = NULL;
return 0;
/* default transition, action fuctions */
static int default_trans(int evt);
static int default_action(int timeout);
+int wearable_default_trans(enum syscommon_deviced_display_state state, int evt);
-static struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
+struct syscommon_deviced_display_state_info states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
{ SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL },
{ SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", default_trans, default_action, NULL, NULL },
{ SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", default_trans, default_action, NULL, NULL },
{ SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, "SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP", default_trans, default_action, NULL, NULL },
};
+int wearable_default_trans(enum syscommon_deviced_display_state state, int evt)
+{
+ return states[state].trans(evt);
+}
+
+int wearable_state_set_timeout(enum syscommon_deviced_display_state state, int timeout)
+{
+ states[state].timeout = timeout;
+
+ return 0;
+}
+
#define LOCK_SCREEN_WATING_TIME 300 /* 0.3 second */
#define LONG_PRESS_INTERVAL 500 /* 0.5 seconds */
#define SAMPLING_INTERVAL 1 /* 1 sec */
display_register_dependent_device(ops);
}
-static void init_display_states(void *data)
-{
- struct display_plugin *dp = (struct display_plugin *) data;
- for(int i = 0; i < SYSCOMMON_DEVICED_DISPLAY_STATE_END; i++)
- dp->display_states[i] = &states[i];
-}
/**
* Power manager Main
*
struct display_plugin *dp = (struct display_plugin *) data;
assert(dp);
- init_display_states(dp);
/**
* FIXME: They should be connected via plugin interfaces
*
#include "powersaver.h"
#include "setting.h"
+extern int wearable_default_trans(enum syscommon_deviced_display_state state, int evt);
+extern int wearable_state_set_timeout(enum syscommon_deviced_display_state state, int timeout);
+
static int set_powersaver_mode(int mode)
{
int timeout;
display_backlight_update_by_default_brightness();
get_run_timeout(&timeout);
- display_plugin_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, timeout);
- display_plugin_state_do_default_trans(get_pm_cur_state(), EVENT_INPUT);
+ wearable_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, timeout);
+ wearable_default_trans(get_pm_cur_state(), EVENT_INPUT);
return 0;
}
time(&now);
diff = difftime(now, locktime);
- display_plugin_state_get_name(state, &state_name);
+ display_state_get_name(state, &state_name);
CRITICAL_LOG("%s(%d) has held %s lock for a long time(%.0f s).",
appid ? appid : "NULL", pid, state_name + 2, diff);
dl = (struct display_lock *) data;
- display_plugin_state_get_name(dl->state, &stname);
+ display_state_get_name(dl->state, &stname);
_I("Display lock expired, state=%s pid=%d", stname, dl->pid);
if (dl->state == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF)
display_misc_get_process_name((pid_t)dl->pid, pname);
ctime_r(&dl->time, time);
- display_plugin_state_get_name(dl->state, &stname);
+ display_state_get_name(dl->state, &stname);
snprintf(buf, sizeof(buf), " %d: [%s] locked by pid %d %s %s\n", *index, stname, dl->pid, pname, time);
ret = write(fd, buf, strlen(buf));
if (state == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF)
set_process_active(true, pid);
- display_plugin_state_get_name(state, &state_name);
+ display_state_get_name(state, &state_name);
_I("[%s] locked by %5d with %u ms", state_name, pid, data->timeout);
if (pid < DEVICED_EVENT_BASE) {
if (state == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF)
set_process_active(false, pid);
- display_plugin_state_get_name(state, &state_name);
+ display_state_get_name(state, &state_name);
_I("[%s] unlocked by %5d", state_name, pid);
if (pid < DEVICED_EVENT_BASE) {
if (flags == 0) {
/* guard time for suspend */
if (current == SYSCOMMON_DEVICED_DISPLAY_STATE_OFF) {
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &timeout);
+ display_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &timeout);
display_state_transition_reset_state_transition_timeout(timeout);
}
} else {
if (flags & PM_FLAG_RESET_TIMER) {
- display_plugin_state_get_timeout(current, &timeout);
+ display_state_get_timeout(current, &timeout);
display_state_transition_reset_state_transition_timeout(timeout);
}
}
const char *current_state_name;
enum syscommon_deviced_display_state current;
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &off_stata_timeout);
+ display_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
+ display_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
+ display_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &off_stata_timeout);
if (fd < 0)
return;
if (ret < 0)
_E("Write() failed: %d", errno);
- display_plugin_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_name);
- display_plugin_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, &dim_state_name);
- display_plugin_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &off_state_name);
+ display_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_name);
+ display_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, &dim_state_name);
+ display_state_get_name(SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, &off_state_name);
snprintf(buf, sizeof(buf), "Tran. Locked : %s %s %s\n",
(display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_ON)) ? normal_state_name : "-",
(display_lock_is_state_locked(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM)) ? dim_state_name : "-",
ret = display_state_get_current(¤t);
if (ret == 0) {
- display_plugin_state_get_name(current, ¤t_state_name);
+ display_state_get_name(current, ¤t_state_name);
snprintf(buf, sizeof(buf), "Current State: %s\n", current_state_name);
ret = write(fd, buf, strlen(buf));
if (ret < 0)
struct display_plugin g_display_plugin;
/* FIXME: Below functions are temorary to separtate display state transition functions */
-int display_plugin_state_do_default_trans(enum syscommon_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 syscommon_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 syscommon_deviced_display_state state, const char **state_name)
-{
- if (!state_name)
- return -EINVAL;
-
- if (g_display_plugin.display_states[state] && g_display_plugin.display_states[state]->name) {
- *state_name = g_display_plugin.display_states[state]->name;
- return 0;
- }
-
- *state_name = NULL;
- return -EOPNOTSUPP;
-}
-
-int display_plugin_state_set_timeout(enum syscommon_deviced_display_state state, int state_timeout)
-{
- if (g_display_plugin.display_states[state]) {
- g_display_plugin.display_states[state]->timeout = state_timeout;
- return 0;
- }
-
- return -EOPNOTSUPP;
-}
-
-int display_plugin_state_get_timeout(enum syscommon_deviced_display_state state, int* state_timeout)
-{
- if (!state_timeout)
- return -EINVAL;
-
- if (g_display_plugin.display_states[state]) {
- *state_timeout = g_display_plugin.display_states[state]->timeout;
- return 0;
- }
-
- return -EOPNOTSUPP;
-}
-
-int display_plugin_state_get_state_by_state_index(int state_index, enum syscommon_deviced_display_state *state)
-{
- if (!state)
- return -EINVAL;
-
- if (g_display_plugin.display_states[state_index]) {
- *state = g_display_plugin.display_states[state_index]->state;
- return 0;
- }
-
- return -EOPNOTSUPP;
-}
bool display_plugin_state_is_there_proc_change_state(void)
{
struct display_plugin {
int (*proc_change_state) (unsigned int cond, pid_t pid);
-
- struct syscommon_deviced_display_state_info* display_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END];
};
extern struct display_plugin g_display_plugin;
-/* FIXME: function names will be redefined */
-int display_plugin_state_do_default_trans(enum syscommon_deviced_display_state state, int evt);
-bool display_plugin_state_is_there_default_trans(enum syscommon_deviced_display_state state);
-int display_plugin_state_get_name(enum syscommon_deviced_display_state state, const char **state_name);
-int display_plugin_state_set_timeout(enum syscommon_deviced_display_state state, int state_timeout);
-int display_plugin_state_get_timeout(enum syscommon_deviced_display_state state, int *state_timeout);
-int display_plugin_state_get_state_by_state_index(int state_index, enum syscommon_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);
{ SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, SYSCOMMON_DEVICED_DISPLAY_STATE_ON }, /* SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP */
};
+struct syscommon_deviced_display_state_info g_display_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = { 0, };
+static struct syscommon_deviced_display_state_info default_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
+ { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL },
+ { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL },
+ { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL },
+ { SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, "SYSCOMMON_DEVICED_DISPLAY_STATE_OFF", NULL, NULL, NULL, NULL },
+ { SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, "SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP", NULL, NULL, NULL, NULL },
+};
+
+
static int display_state_transition_do_state_action(int timeout);
static bool is_display_state_valid(enum syscommon_deviced_display_state display_state)
return 0;
}
+int display_state_get_name(enum syscommon_deviced_display_state state, const char **name)
+{
+ *name = default_states[state].name;
+
+ return 0;
+}
+
static void remove_state_transition(void)
{
if (state_transition_timer_id) {
static gboolean state_transition_timeout_handler(void *data)
{
const char *state_name = NULL;
- display_plugin_state_get_name(current, &state_name);
+ display_state_get_name(current, &state_name);
_I("Time out state %s", state_name);
remove_state_transition();
custom_dim_timeout = timeout;
break;
default:
- display_plugin_state_get_name(state, &state_name);
+ display_state_get_name(state, &state_name);
_W("%s state has no custom timeout", state_name);
return -EPERM;
}
break;
default:
*timeout = 0;
- display_plugin_state_get_name(state, &state_name);
+ display_state_get_name(state, &state_name);
_W("There is no specific timeout value for %s state", state_name);
}
return 0;
display_state_transition_update_display_state_timeout_by_priority();
}
+int display_state_get_timeout(enum syscommon_deviced_display_state state, int *timeout)
+{
+ *timeout = g_display_states[state].timeout;
+
+ return 0;
+}
+
+int display_state_set_timeout(enum syscommon_deviced_display_state state, int timeout)
+{
+ g_display_states[state].timeout = timeout;
+
+ return 0;
+}
+
void display_state_transition_update_display_state_timeout_by_priority(void)
{
int run_timeout, val;
/* first priority : custom timeout */
if (custom_normal_timeout > 0) {
- display_plugin_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, custom_normal_timeout);
- display_plugin_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, custom_dim_timeout);
+ display_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, custom_normal_timeout);
+ display_state_set_timeout(SYSCOMMON_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(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, lock_screen_timeout);
+ display_state_set_timeout(SYSCOMMON_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(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, run_timeout);
+ display_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, run_timeout);
get_dim_timeout(&val);
- display_plugin_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, val);
+ display_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, val);
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, &dim_state_timeout);
+ display_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &normal_state_timeout);
+ display_state_get_timeout(SYSCOMMON_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);
}
if (!display_state_transition_is_display_state_support_transition(state))
return -EPERM;
- if (display_plugin_state_is_there_default_trans(state))
- return display_plugin_state_do_default_trans(state, evt_type);
-
display_state_transition_get_next_transition_display_state(current, &next_state, evt_type);
/* check conditions */
ret = display_state_transition_check_state_transition_condition(current, next_state);
if (ret < 0) {
- display_plugin_state_get_name(current, ¤t_state_name);
- display_plugin_state_get_name(next_state, &next_state_name);
+ display_state_get_name(current, ¤t_state_name);
+ display_state_get_name(next_state, &next_state_name);
/* There is a condition. */
_I("%s locked. Trans to %s failed.", current_state_name, next_state_name);
return -EPERM;
(syscommon_is_emulator() == true || timeout_sleep_support == false))
return 0;
- display_plugin_state_get_timeout(current, &timeout);
+ display_state_get_timeout(current, &timeout);
display_state_transition_do_state_action(timeout);
}
}
time(&last_update_time);
last_timeout = timeout;
} else {
- display_plugin_state_get_name(current, &state_name);
+ display_state_get_name(current, &state_name);
_I("Timout set: %s state %d ms", state_name, timeout);
}
}
if ((previous == SYSCOMMON_DEVICED_DISPLAY_STATE_ON) && (current != SYSCOMMON_DEVICED_DISPLAY_STATE_ON)) {
time(&now);
diff = difftime(now, last_update_time);
- display_plugin_state_get_name(current, &state_name);
+ display_state_get_name(current, &state_name);
_I("SYSCOMMON_DEVICED_DISPLAY_STATE_ON is changed to %s (timeout=%d ms diff=%.0f s).",
state_name, last_timeout, diff);
}
previous = current;
current = next;
- display_plugin_state_get_timeout(current, &state_timeout);
+ display_state_get_timeout(current, &state_timeout);
if (timeout < 0)
display_state_transition_do_state_action(state_timeout);
return display_plugin_state_proc_change_state(cond, pid);
next = GET_COND_STATE(cond);
- display_plugin_state_get_name(next, &state_name);
+ display_state_get_name(next, &state_name);
_I("Change process(%d) state to %s.", pid, state_name);
switch (next) {
return 0;
}
+
+int display_state_load_state_info(void)
+{
+ int ret;
+
+ ret = syscommon_plugin_deviced_display_load_state_info(g_display_states);
+ if (ret == -ENOTSUP || ret == EOPNOTSUPP) {
+ _D("Take default operation as there is no found plugin backend");
+ for (int i = 0; i < SYSCOMMON_DEVICED_DISPLAY_STATE_END; ++i)
+ g_display_states[i] = default_states[i];
+ }
+
+ return 0;
+}
#define LOCK_SCREEN_INPUT_TIMEOUT 10000
+/**
+ * FIXME: Add getter/setter for this and hide it into source code
+ */
+extern struct syscommon_deviced_display_state_info
+g_display_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END];
+
+int display_state_load_state_info(void);
+int display_state_get_name(enum syscommon_deviced_display_state state, const char **name);
int display_state_set_current(enum syscommon_deviced_display_state state, enum deviced_event event);
int display_state_get_current(enum syscommon_deviced_display_state *state);
int display_state_get_previous(enum syscommon_deviced_display_state *state);
+int display_state_get_timeout(enum syscommon_deviced_display_state state, int *timeout);
+int display_state_set_timeout(enum syscommon_deviced_display_state state, int timeout);
int display_state_transition_get_next_transition_display_state(enum syscommon_deviced_display_state from_state, enum syscommon_deviced_display_state *to_state, int evt_type);
int display_state_transition_set_transition_table_display_state(enum syscommon_deviced_display_state display_state, enum syscommon_deviced_display_state set_state, int evt_type);
bool display_state_transition_is_there_state_transition_timer(void);
static bool g_display_hal_backend_available = false;
static GList *display_dependent_device_ops;
static enum device_ops_status display_ops_status = DEVICE_OPS_STATUS_UNINIT;
-static struct syscommon_deviced_display_state_info default_states[SYSCOMMON_DEVICED_DISPLAY_STATE_END] = {
- { SYSCOMMON_DEVICED_DISPLAY_STATE_START, "SYSCOMMON_DEVICED_DISPLAY_STATE_START", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_ON, "SYSCOMMON_DEVICED_DISPLAY_STATE_ON", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_DIM, "SYSCOMMON_DEVICED_DISPLAY_STATE_DIM", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, "SYSCOMMON_DEVICED_DISPLAY_STATE_OFF", NULL, NULL, NULL, NULL },
- { SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP, "SYSCOMMON_DEVICED_DISPLAY_STATE_SLEEP", NULL, NULL, NULL, NULL },
-};
-
extern void init_save_userlock(void);
inline unsigned int get_pm_status_flag(void)
int display_initialize_display_state_timeout_from_setting(void)
{
- int i;
int val = 0;
const char* state_name = NULL;
- enum syscommon_deviced_display_state state = SYSCOMMON_DEVICED_DISPLAY_STATE_START;
+ enum syscommon_deviced_display_state state;
- for (i = 0; i < SYSCOMMON_DEVICED_DISPLAY_STATE_END; i++) {
- display_plugin_state_get_state_by_state_index(i, &state);
+ for (state = SYSCOMMON_DEVICED_DISPLAY_STATE_START;
+ state < SYSCOMMON_DEVICED_DISPLAY_STATE_END; ++state) {
switch (state) {
case SYSCOMMON_DEVICED_DISPLAY_STATE_ON:
get_run_timeout(&val);
break;
}
if (val > 0) {
- display_plugin_state_set_timeout(i, val);
+ display_state_set_timeout(state, val);
}
- display_plugin_state_get_name(i, &state_name);
+ display_state_get_name(state, &state_name);
_I("State(%s) timeout(%d) ms", state_name, val);
}
display_panel_lcd_on_procedure(LCD_NORMAL, DEVICED_EVENT_DEVICE_READY);
display_config_get_timeout_enable(&timeout_enable);
if (timeout_enable) {
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &timeout);
+ display_state_get_timeout(SYSCOMMON_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);
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(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, lock_screen_timeout);
+ display_state_set_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, lock_screen_timeout);
_I("LCD NORMAL timeout(%d ms) is set for lock screen.", lock_screen_timeout);
}
}
}
}
- for (int i = 0; i < SYSCOMMON_DEVICED_DISPLAY_STATE_END; ++i)
- if (!g_display_plugin.display_states[i])
- g_display_plugin.display_states[i] = &default_states[i];
+ display_state_load_state_info();
ret = display_load_config();
if (ret < 0)
unsigned int flags = (WITHOUT_STARTNOTI | FLAG_X_DPMS);
enum syscommon_deviced_display_state current;
-
g_unix_signal_add(SIGHUP, handle_sighup, (gpointer) SIGHUP);
if (display_plugin_device_ops && display_plugin_device_ops->init)
display_set_display_ops_status(DEVICE_OPS_STATUS_START);
if (timeout_enable) {
- display_plugin_state_get_timeout(SYSCOMMON_DEVICED_DISPLAY_STATE_ON, &timeout);
+ display_state_get_timeout(SYSCOMMON_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);