custom_lcd_on/off() is used by dbus_customlcdon/off call.
These update custom timeout value and go to S_NORMAL/S_LCDOFF display state.
New functions added below display-panel.
- int display_panel_custom_lcd_on(int timeout);
- int display_panel_custom_lcd_off(enum device_flags flag);
-> These replace custom_lcd_on/off().
Change-Id: Ie6e28ade1a05212f97c4feb87ea70955ff2cddc0
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
return UNKNOWN_STR;
}
-static gboolean timer_refresh_cb(gpointer data)
-{
- struct state *st;
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
-int custom_lcdon(int timeout)
-{
- struct state *st;
-
- if (timeout <= 0)
- return -EINVAL;
-
- if (display_panel_get_dpms_cached_state() != DPMS_ON)
- display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
-
- _I("Custom lcd on timeout(%d ms).", timeout);
- if (set_custom_lcdon_timeout(timeout) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- g_idle_add(timer_refresh_cb, NULL);
-
- return 0;
-}
-
-int custom_lcdoff(enum device_flags flag)
-{
- struct state *st;
-
- if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
- /*
- * When another proccess is normal lock, device is received call then,
- * call app can be changed to lcd state by proximity.
- * If proximity is near then normal lock will be unlocked.
- */
- if (flag & LCD_OFF_BY_PROXIMITY) {
- _I("custom lcd off by proximity, delete normal lock");
- display_lock_release_lock_all(S_NORMAL);
- } else {
- _I("skip custom lcd off");
- return -ECANCELED;
- }
- }
-
- _I("custom lcd off by flag(%d)", flag);
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_panel_lcd_off_procedure(flag);
-
- if (set_custom_lcdon_timeout(0) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_LCDOFF);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
int display_on_by_reason(const char *reason, int timeout)
{
struct state *st;
dp->get_device_flags = NULL;
dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
+ dp->custom_lcd_on = NULL;
+ dp->custom_lcd_off = NULL;
setup_display_plugin_backlight_ops(dp);
/* check display feature */
return UNKNOWN_STR;
}
-static gboolean timer_refresh_cb(gpointer data)
-{
- struct state *st;
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
-int custom_lcdon(int timeout)
-{
- struct state *st;
-
- if (timeout <= 0)
- return -EINVAL;
-
- if (display_panel_get_dpms_cached_state() != DPMS_ON)
- display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
-
- _I("Custom lcd on timeout(%d ms).", timeout);
- if (set_custom_lcdon_timeout(timeout) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- g_idle_add(timer_refresh_cb, NULL);
-
- return 0;
-}
-
-int custom_lcdoff(enum device_flags flag)
-{
- struct state *st;
-
- if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
- /*
- * When another proccess is normal lock, device is received call then,
- * call app can be changed to lcd state by proximity.
- * If proximity is near then normal lock will be unlocked.
- */
- if (flag & LCD_OFF_BY_PROXIMITY) {
- _I("custom lcd off by proximity, delete normal lock");
- display_lock_release_lock_all(S_NORMAL);
- } else {
- _I("skip custom lcd off");
- return -ECANCELED;
- }
- }
-
- _I("custom lcd off by flag(%d)", flag);
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_panel_lcd_off_procedure(flag);
-
- if (set_custom_lcdon_timeout(0) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_LCDOFF);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
int display_on_by_reason(const char *reason, int timeout)
{
struct state *st;
dp->get_device_flags = NULL;
dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
+ dp->custom_lcd_on = NULL;
+ dp->custom_lcd_off = NULL;
setup_display_plugin_backlight_ops(dp);
/**
return UNKNOWN_STR;
}
-static gboolean timer_refresh_cb(gpointer data)
-{
- struct state *st;
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
-int custom_lcdon(int timeout)
-{
- struct state *st;
-
- if (timeout <= 0)
- return -EINVAL;
-
- if (display_panel_get_dpms_cached_state() != DPMS_ON)
- display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
-
- _I("Custom lcd on timeout(%d ms).", timeout);
- if (set_custom_lcdon_timeout(timeout) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_NORMAL);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- g_idle_add(timer_refresh_cb, NULL);
-
- return 0;
-}
-
-int custom_lcdoff(enum device_flags flag)
-{
- struct state *st;
-
- if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
- /*
- * When another proccess is normal lock, device is received call then,
- * call app can be changed to lcd state by proximity.
- * If proximity is near then normal lock will be unlocked.
- */
- if (flag & LCD_OFF_BY_PROXIMITY) {
- _I("custom lcd off by proximity, delete normal lock");
- display_lock_release_lock_all(S_NORMAL);
- } else {
- _I("skip custom lcd off");
- return -ECANCELED;
- }
- }
-
- _I("custom lcd off by flag(%d)", flag);
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_panel_lcd_off_procedure(flag);
-
- if (set_custom_lcdon_timeout(0) == true)
- display_state_transition_update_display_state_timeout_by_priority();
-
- /* state transition */
- set_pm_old_state(get_pm_cur_state());
- set_pm_cur_state(S_LCDOFF);
- st = &states[get_pm_cur_state()];
-
- display_state_transition_do_state_action(st->timeout);
-
- return 0;
-}
-
int display_on_by_reason(const char *reason, int timeout)
{
struct state *st;
dp->get_device_flags = NULL;
dp->lcd_on_procedure = NULL;
dp->lcd_off_procedure = NULL;
+ dp->custom_lcd_on = NULL;
+ dp->custom_lcd_off = NULL;
setup_display_plugin_backlight_ops(dp);
/**
dp->get_device_flags = get_device_flags;
dp->lcd_on_procedure = lcd_on_procedure;
dp->lcd_off_procedure = lcd_off_procedure;
+ dp->custom_lcd_on = custom_lcdon;
+ dp->custom_lcd_off = custom_lcdoff;
setup_display_plugin_backlight_ops(dp);
/**
int display_on_by_reason(const char *reason, int timeout);
int display_off_by_reason(const char *reason);
int set_lcd_timeout(int on, int dim, const char *name);
-int custom_lcdon(int timeout);
void broadcast_lcd_off_late(enum device_flags flags);
/* auto-brightness.c */
#include "power/power-doze.h"
#include "ambient-mode.h"
#include "device-interface.h"
+#include "display-lock.h"
#include "display-misc.h"
#include "display-panel.h"
+#include "display-plugin.h"
#include "display-signal.h"
#include "display-state-transition.h"
#include "led/touch-key.h"
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)
+{
+ int timeout = 0;
+ set_pm_old_state(get_pm_cur_state());
+ set_pm_cur_state(next);
+
+ display_plugin_state_get_timeout(get_pm_cur_state(), &timeout);
+ display_state_transition_do_state_action(timeout);
+}
+
+/* FIXME: timer_refresh_cb seems legacy code, it can be removed after discussion */
+static gboolean timer_refresh_cb(gpointer data)
+{
+ display_state_updated_to_next_and_do_action(S_NORMAL);
+ return 0;
+}
+
+int display_panel_custom_lcd_on(int timeout)
+{
+ if (display_plugin_custom_lcd_on(timeout) == 0)
+ return 0;
+
+ if (timeout <= 0)
+ return -EINVAL;
+
+ if (display_panel_get_dpms_cached_state() != DPMS_ON)
+ display_panel_lcd_on_direct(LCD_ON_BY_GESTURE);
+
+ _I("Custom lcd on timeout(%d ms).", timeout);
+ if (set_custom_lcdon_timeout(timeout))
+ display_state_transition_update_display_state_timeout_by_priority();
+
+ display_state_updated_to_next_and_do_action(S_NORMAL);
+
+ g_idle_add(timer_refresh_cb, NULL);
+
+ return 0;
+}
+
+int display_panel_custom_lcd_off(enum device_flags flag)
+{
+ if (display_plugin_custom_lcd_off(flag) == 0)
+ return 0;
+
+ /* check holdkey block flag in lock node */
+ if (display_lock_is_state_locked(S_NORMAL) || display_lock_is_state_locked(S_LCDDIM)) {
+ /*
+ * When another proccess is normal lock, device is received call then,
+ * call app can be changed to lcd state by proximity.
+ * If proximity is near then normal lock will be unlocked.
+ */
+ if (flag & LCD_OFF_BY_PROXIMITY) {
+ _I("custom lcd off by proximity, delete normal lock");
+ display_lock_release_lock_all(S_NORMAL);
+ } else {
+ _I("skip custom lcd off");
+ return -ECANCELED;
+ }
+ }
+
+ _I("custom lcd off by flag(%d)", flag);
+ if (display_panel_get_dpms_cached_state() == DPMS_ON)
+ display_panel_lcd_off_procedure(flag);
+
+ if (set_custom_lcdon_timeout(0) == true)
+ display_state_transition_update_display_state_timeout_by_priority();
+
+ display_state_updated_to_next_and_do_action(S_LCDOFF);
+
+ return 0;
+}
+
bool display_panel_is_lcd_on_state_broadcasted(void)
{
return lcd_on_broadcasted;
void display_panel_lcd_on_procedure(int state, enum device_flags flag);
void display_panel_lcd_off_procedure(enum device_flags flag);
void display_panel_lcd_on_direct(enum device_flags flags);
+int display_panel_custom_lcd_on(int timeout);
+int display_panel_custom_lcd_off(enum device_flags flag);
bool display_panel_is_lcd_on_state_broadcasted(void);
void display_panel_update_lcd_on_timeval(void);
int display_panel_calculate_diff_time_between_lcd_on_direct_and_state_action(int *diff_time);
return -EOPNOTSUPP;
}
+int display_plugin_custom_lcd_on(int timeout)
+{
+ if (g_display_plugin.custom_lcd_on) {
+ g_display_plugin.custom_lcd_on(timeout);
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
+int display_plugin_custom_lcd_off(enum device_flags flag)
+{
+ if (g_display_plugin.custom_lcd_off) {
+ g_display_plugin.custom_lcd_off(flag);
+ return 0;
+ }
+
+ return -EOPNOTSUPP;
+}
+
int display_plugin_backlight_get_lcd_power(void)
{
if (g_display_plugin.backlight && g_display_plugin.backlight->get_lcd_power)
int (*get_device_flags) (unsigned long *device_flags);
void (*lcd_on_procedure) (int state, enum device_flags flag);
void (*lcd_off_procedure) (enum device_flags flag);
+ int (*custom_lcd_on) (int timeout);
+ int (*custom_lcd_off) (enum device_flags flag);
struct display_config *config;
struct display_backlight_ops *backlight;
int display_plugin_get_device_flags(unsigned long *device_flags);
int display_plugin_lcd_on_procedure(int state, enum device_flags flag);
int display_plugin_lcd_off_procedure(enum device_flags flag);
+int display_plugin_custom_lcd_on(int timeout);
+int display_plugin_custom_lcd_off(enum device_flags flag);
int display_plugin_backlight_get_lcd_power(void);
int display_plugin_backlight_set_brightness(int brightness);
void display_state_transition_update_lock_screen_timeout(int timeout)
{
- display_state_transition_set_lock_screen_timeout(time);
+ display_state_transition_set_lock_screen_timeout(timeout);
display_state_transition_update_display_state_timeout_by_priority();
}
return g_variant_new("(i)", -ENOTSUP);
}
- ret = custom_lcdon(timeout);
+ ret = display_panel_custom_lcd_on(timeout);
return g_variant_new("(i)", ret);
}
goto out;
}
- ret = custom_lcdoff(flag);
+ ret = display_panel_custom_lcd_off(flag);
out:
g_free(reason_str);