poll.c file has legacy functions pm_change_internal/pm_lock_internal/pm_unlock_internal()
These functions are usually called from external requests like key-event, dbus method, etc.
pm_lock_internal/pm_unlock_internal() gets specific display state lock/unlock.
pm_change_internal() requests state transition according to specific condition.
This file has to be erased, and then inner functions are relocated.
These are new functions to be added.
display-lock
- int display_lock_request_lock_with_option(pid_t pid, int s_bits, int flag, int timeout);
- int display_lock_request_unlock_with_option(pid_t pid, int s_bits, int flag);
-> These replace pm_lock_internal/pm_unlock_intenral().
display-state-transition
- int display_state_transition_request_state_transition_with_option(pid_t pid, int s_bits);
-> This replaces pm_change_internal().
display-util
- int display_util_get_display_state(int s_bits);
-> This extracts display state from s_bits.
Change-Id: Ied90f5a7f132f3bfcba1ecf1eef8faa02c728e31
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
if (ret)
return ret;
- /* display_plugin instance initialization */
- init_pm_internal(data);
-
return 0;
}
* deviced guarantees all booting script is executing.
* Last script of booting unlocks this suspend blocking state.
*/
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
/* Initial display state right after the booting done */
if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
STAY_CUR_STATE, timeout);
}
if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
display_state_transition_do_state_transition_by_input_poll_event();
}
display_lock_release_lock_all(S_NORMAL);
display_lock_release_lock_all(S_LCDDIM);
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF);
} else {
ignore = false;
skip_combination = false;
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(-1, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
return true;
}
#include "lowbat-handler.h"
#include "battery-ops.h"
#include "core.h"
+#include "display-lock.h"
#include "display-ops.h"
+#include "display-state-transition.h"
#include "poll.h"
#include "shared/eventsystem.h"
#include "shared/plugin.h"
noti_type = METHOD_LOW_NOTI_UPDATE;
else {
noti_type = METHOD_LOW_NOTI_ON;
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
}
prev_level = battery_info.warning;
if (battery->charge_now)
noti_type = METHOD_CRITICAL_NOTI_UPDATE;
else {
noti_type = METHOD_CRITICAL_NOTI_ON;
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
}
prev_level = battery_info.critical;
if (battery->charge_now)
CRITICAL_LOG("Popup: Battery health status is not good, %s.", battery->health_s);
device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery->health);
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
if (battery->health == HEALTH_LOW)
battery_charge_err_low_act(NULL);
else if (battery->health == HEALTH_HIGH)
if (ret)
return ret;
- /* display_plugin instance initialization */
- init_pm_internal(data);
-
return 0;
}
* deviced guarantees all booting script is executing.
* Last script of booting unlocks this suspend blocking state.
*/
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
/* Initial display state right after the booting done */
if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
STAY_CUR_STATE, timeout);
}
if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
display_state_transition_do_state_transition_by_input_poll_event();
}
display_lock_release_lock_all(S_NORMAL);
display_lock_release_lock_all(S_LCDDIM);
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF);
} else {
ignore = false;
skip_combination = false;
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(-1, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
return true;
}
if (ret)
return ret;
- /* display_plugin instance initialization */
- init_pm_internal(data);
-
return 0;
}
* deviced guarantees all booting script is executing.
* Last script of booting unlocks this suspend blocking state.
*/
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
/* Initial display state right after the booting done */
if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
STAY_CUR_STATE, timeout);
}
if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
display_state_transition_do_state_transition_by_input_poll_event();
}
display_lock_release_lock_all(S_NORMAL);
display_lock_release_lock_all(S_LCDDIM);
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF);
} else {
ignore = false;
skip_combination = false;
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(-1, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
return true;
}
#include "shared/device-notifier.h"
#include "poll.h"
#include "core.h"
+#include "display-lock.h"
#include "display-ops.h"
+#include "display-state-transition.h"
#include "shared/log.h"
#include "shared/plugin.h"
bezel_wakeup = vconf_keynode_get_bool(key_nodes);
_I("Bezel wakeup condition: %d", bezel_wakeup);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
device_notify(DEVICE_NOTIFIER_BEZEL_WAKEUP, (void *)((intptr_t)bezel_wakeup));
}
ret = hal_device_bezel_set_sw_state(bezel_state);
if (ret == 0) {
_I("Bezel rotary event condition is %d", bezel_state);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
} else {
_E("Failed to set bezel rotary event condition.");
}
if (ret)
return ret;
- /* display_plugin instance initialization */
- init_pm_internal(data);
-
return 0;
}
* deviced guarantees all booting script is executing.
* Last script of booting unlocks this suspend blocking state.
*/
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF,
STAY_CUR_STATE, DELAYED_INIT_WATING_TIME);
/* Initial display state right after the booting done */
if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT))
timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT);
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL,
STAY_CUR_STATE, timeout);
}
if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
/* change state - LCD on */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL);
display_state_transition_do_state_transition_by_input_poll_event();
}
display_lock_release_lock_all(S_NORMAL);
display_lock_release_lock_all(S_LCDDIM);
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_POWERKEY, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF);
} else {
ignore = false;
skip_combination = false;
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(-1, LCD_OFF);
+ display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
return true;
}
#include "device-interface.h"
#include "display-ops.h"
#include "display-panel.h"
+#include "display-state-transition.h"
#include "shared/plugin.h"
#include "shared/log.h"
_I("Request swim mode state %d by %d", val, pid);
if (display_panel_get_dpms_cached_state() != DPMS_ON) {
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_SWIM, S_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_SWIM, S_NORMAL);
lcd_state = true;
}
swim_execute((void *)((intptr_t)val));
if (lcd_state) {
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_SWIM, S_LCDOFF);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_SWIM, S_LCDOFF);
}
}
#include "shared/plugin.h"
#include "setting.h"
#include "poll.h"
+#include "display-lock.h"
#include "display-ops.h"
#include "display-plugin.h"
+#include "display-state-transition.h"
#include "power/power.h"
#include "power/power-off.h"
#include "power-supply.h"
if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW ||
lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH ||
lowbat_popup_option == BAT_OPT_ERR_CF_OPEN) {
- display_plugin_pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_DIM);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_DIM);
} else {
- display_plugin_pm_change_internal(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL);
}
if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW ||
lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH ||
int battery_charge_err_low_act(void *data)
{
- display_plugin_pm_lock_internal(INTERNAL_LOCK_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000);
return lowbat_popup(BAT_OPT_ERR_TEMP_LOW);
}
int battery_charge_err_high_act(void *data)
{
- display_plugin_pm_lock_internal(INTERNAL_LOCK_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000);
return lowbat_popup(BAT_OPT_ERR_TEMP_HIGH);
}
#include "shared/apps.h"
#include "shared/event.h"
#include "core.h"
+#include "display-lock.h"
#include "display-ops.h"
+#include "display-state-transition.h"
#include "power-supply.h"
#include "battery.h"
#include "battery-ops.h"
if (status == DEVICE_NOTI_ON) {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM);
device_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present);
- display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0);
} else {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
device_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
}
if (battery_plgn->changed_battery_cf)
battery_plgn->changed_battery_cf(battery.present);
device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health);
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
if (battery.health == HEALTH_LOW)
battery_charge_err_low_act(NULL);
else if (battery.health == HEALTH_HIGH)
} else {
battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
device_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
health_status_broadcast();
if (abnormal_health_popup_timer) {
CRITICAL_LOG("Battery health returned to normal. Stop abnormal popup.");
if (abnormal_health_popup_timer)
g_source_remove(abnormal_health_popup_timer);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
- display_plugin_pm_lock_internal(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH);
if (battery.health == HEALTH_LOW)
battery_charge_err_low_act(NULL);
else if (battery.health == HEALTH_HIGH)
int ret_lock = -1;
int ret_val;
- ret_lock = display_plugin_pm_lock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, STAY_CUR_STATE, 0);
+ ret_lock = display_lock_request_lock_with_option(INTERNAL_LOCK_BATTERY, LCD_OFF, STAY_CUR_STATE, 0);
if (old_battery.charge_now != battery.charge_now || battery.charge_now == CHARGER_ABNORMAL) {
ret_val = vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now);
}
if (ret_lock == 0) {
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_BATTERY, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_BATTERY, LCD_OFF, PM_SLEEP_MARGIN);
}
}
if (battery_do_not_disturb())
return 0;
- display_plugin_pm_change_internal(pid, s_bits);
+ display_state_transition_request_state_transition_with_option(pid, s_bits);
return 0;
}
#include "core.h"
#include "display.h"
+#include "display-lock.h"
#include "display-ops.h"
#include "display-panel.h"
#include "display-plugin.h"
val = vconf_keynode_get_bool(key_nodes);
if (val != ambient_condition) {
if (display_panel_get_dpms_cached_state() != DPMS_ON)
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
}
ambient_condition = val;
* So at that time deviced should turn off display to match the pair.
*/
if (on) {
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_AMBIENT,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT,
LCD_OFF, STAY_CUR_STATE, AMBIENT_CLOCK_WAITING_TIME);
} else
ambient_pid = 0;
(ambient_state == false))
return;
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_AMBIENT, LCD_OFF, STAY_CUR_STATE,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, STAY_CUR_STATE,
AMBIENT_CLOCK_WAITING_TIME);
}
display_panel_set_panel_state_by_off_state(NORMAL_MODE);
broadcast_lcd_off_late(LCD_OFF_LATE_MODE);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN);
}
update_count++;
return;
}
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_AMBIENT, LCD_OFF, GOTO_STATE_NOW, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, GOTO_STATE_NOW, 0);
_I("Display off in suspend state.");
lcd_direct_control(DPMS_OFF, NORMAL_MODE);
broadcast_lcd_off_late(LCD_OFF_LATE_MODE);
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN);
}
static void ambient_init(void *data)
/* auto-brightness.c */
void set_brightness_changed_state(void);
-/* poll.c */
-int check_dimstay(int next_state, int flag);
-
/* display-dbus.c */
int init_pm_dbus(void);
//#include "display/display.h"
#include "display-backlight.h"
#include "display-misc.h"
+#include "display-util.h"
#define AUL_APPSTATUS_PATH "/Org/Tizen/Aul/AppStatus"
#define AUL_APPSTATUS_INTERFACE "org.tizen.aul.AppStatus"
if (NOT_SUPPORT_OPS(display_device_ops))
goto out;
- if (disp_plgn->pm_change_internal)
- disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
display_device_ops->stop(CORE_LOGIC_MODE);
out:
return gdbus_new_g_variant_tuple();
}
+static int check_dimstay(int next_state, int flag)
+{
+ if (next_state != LCD_OFF)
+ return false;
+
+ if (!(flag & GOTO_STATE_NOW))
+ return false;
+
+ if (!(get_pm_status_flag() & DIMSTAY_FLAG))
+ return false;
+
+ return true;
+}
+
static GVariant *dbus_lockstate(GDBusConnection *conn,
const gchar *sender, const gchar *path, const gchar *iface, const gchar *name,
GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
flag |= STAY_CUR_STATE;
}
- if (disp_plgn->pm_lock_internal)
- ret = disp_plgn->pm_lock_internal(pid, state, flag, timeout);
+ display_lock_request_lock_with_option(pid, state, flag, timeout);
out:
g_free(state_str);
g_free(option1_str);
flag = PM_RESET_TIMER;
}
- if (disp_plgn->pm_unlock_internal)
- ret = disp_plgn->pm_unlock_internal(pid, state, flag);
+ display_lock_request_unlock_with_option(pid, state, flag);
out:
g_free(state_str);
g_free(option_str);
goto out;
}
- if (disp_plgn->pm_change_internal)
- ret = disp_plgn->pm_change_internal(pid, state);
+ display_state_transition_request_state_transition_with_option(pid, state);
if (!ret && state == LCD_OFF)
display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
if (!strcmp(on, "on")) {
pm_save_logdump();
- if (disp_plgn->pm_lock_internal)
- disp_plgn->pm_lock_internal(INTERNAL_LOCK_DUMPMODE, LCD_OFF,
+ display_lock_request_lock_with_option(INTERNAL_LOCK_DUMPMODE, LCD_OFF,
STAY_CUR_STATE, DUMP_MODE_WATING_TIME);
display_backlight_unset_blink();
} else if (!strcmp(on, "off")) {
- if (disp_plgn->pm_unlock_internal)
- disp_plgn->pm_unlock_internal(INTERNAL_LOCK_DUMPMODE, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_DUMPMODE, LCD_OFF, PM_SLEEP_MARGIN);
display_backlight_set_blink(0);
} else if (!strcmp(on, "blink")) {
display_backlight_set_blink(500);
#include "display-config.h"
#include "display-misc.h"
#include "display-state-transition.h"
+#include "display-util.h"
#include "shared/log.h"
#include "shared/log-macro.h"
#include "shared/apps.h"
display_state_transition_do_state_transition(get_pm_cur_state(), EVENT_TIMEOUT);
return 0;
+}
+
+int display_lock_request_lock_with_option(pid_t pid, int s_bits, int flag, int timeout)
+{
+ int cond;
+ PMMsg recv_data;
+
+ cond = display_util_get_display_state(s_bits);
+ if (cond < 0)
+ return cond;
+
+ if (!display_state_transition_is_display_state_support_transition(cond))
+ return -ENOTSUP;
+
+ cond = SET_COND_REQUEST(cond, PM_REQUEST_LOCK);
+
+ if (flag & GOTO_STATE_NOW)
+ /* if the flag is true, go to the locking state directly */
+ cond = SET_COND_FLAG(cond, PM_REQUEST_CHANGE);
+
+ recv_data.pid = pid;
+ recv_data.cond = cond;
+ recv_data.timeout = timeout;
+
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
+
+ return 0;
+}
+
+int display_lock_request_unlock_with_option(pid_t pid, int s_bits, int flag)
+{
+ int cond;
+ PMMsg recv_data;
+
+ cond = display_util_get_display_state(s_bits);
+ if (cond < 0)
+ return cond;
+
+ if (!display_state_transition_is_display_state_support_transition(cond))
+ return -ENOTSUP;
+
+ cond = SET_COND_REQUEST(cond, PM_REQUEST_UNLOCK);
+
+ if (flag & PM_KEEP_TIMER)
+ cond = SET_COND_FLAG(cond, PM_FLAG_KEEP_TIMER);
+
+ if (flag & PM_RESET_TIMER)
+ cond = SET_COND_FLAG(cond, PM_FLAG_RESET_TIMER);
+
+ recv_data.pid = pid;
+ recv_data.cond = cond;
+ recv_data.timeout = 0;
+
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
+
+ return 0;
}
\ No newline at end of file
int display_lock_print_lock_info(int fd);
int display_lock_proc_condition(PMMsg *data);
+int display_lock_request_lock_with_option(pid_t pid, int s_bits, int flag, int timeout);
+int display_lock_request_unlock_with_option(pid_t pid, int s_bits, int flag);
#endif /* __DISPLAY_LOCK_H__ */
_I("Stay touch screen off: %d", on);
stay_touchscreen_off = on;
- display_plugin_pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
}
void display_misc_get_stay_touchscreen_off(bool *on)
_I("Lcd paneloff mode: %d", on);
lcd_paneloff_mode = on;
- display_plugin_pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL);
}
/* FIXME: This function is temporary, it can be redefined or not */
return g_display_plugin.handle;
}
-int display_plugin_pm_lock_internal(pid_t pid, int s_bits, int flags, int timeout)
-{
- if (g_display_plugin.pm_lock_internal)
- return g_display_plugin.pm_lock_internal(pid, s_bits, flags, timeout);
-
- return 0;
-}
-
-int display_plugin_pm_unlock_internal(pid_t pid, int s_bits, int flags)
-{
- if (g_display_plugin.pm_unlock_internal)
- return g_display_plugin.pm_unlock_internal(pid, s_bits, flags);
-
- return 0;
-}
-
-int display_plugin_pm_change_internal(pid_t pid, int s_bits)
-{
- if (g_display_plugin.pm_change_internal)
- return g_display_plugin.pm_change_internal(pid, s_bits);
-
- return 0;
-}
-
int display_plugin_update_pm_setting(int key_idx, int val)
{
if (g_display_plugin.update_pm_setting)
struct display_plugin {
void *handle;
- int (*pm_lock_internal) (pid_t pid, int s_bits, int flag, int timeout);
- int (*pm_unlock_internal) (pid_t pid, int s_bits, int flag);
- int (*pm_change_internal) (pid_t pid, int s_bits);
int (*update_pm_setting) (int key_idx, int val);
int (*get_lock_screen_state) (void);
bool system_wakeup_flag;
extern struct display_plugin g_display_plugin;
void* display_plugin_handle(void);
-int display_plugin_pm_lock_internal(pid_t pid, int s_bits, int flags, int timeout);
-int display_plugin_pm_unlock_internal(pid_t pid, int s_bits, int flags);
-int display_plugin_pm_change_internal(pid_t pid, int s_bits);
int display_plugin_update_pm_setting(int key_idx, int val);
bool display_plugin_is_there_update_pm_setting(void);
int display_plugin_get_lock_screen_state(void);
#include "display-lock.h"
#include "display-plugin.h"
#include "display-signal.h"
+#include "display-util.h"
#include "extcon/extcon.h"
#include "power/power.h"
#include "power/power-suspend.h"
return 0;
}
+
+int display_state_transition_request_state_transition_with_option(pid_t pid, int s_bits)
+{
+ int cond, ret;
+ PMMsg recv_data;
+ const int display_on = (LCD_NORMAL | LCD_DIM);
+
+ cond = display_util_get_display_state(s_bits);
+ if (cond < 0)
+ return cond;
+
+ ret = display_plugin_is_lcd_on_blocked();
+ if (ret != LCDON_BLOCK_NONE && (cond & display_on)) {
+ _W("LCDON is blocked, %d.", ret);
+ return -ENOTSUP;
+ }
+
+ if (!display_state_transition_is_display_state_support_transition(cond))
+ return -ENOTSUP;
+
+ cond = SET_COND_REQUEST(cond, PM_REQUEST_CHANGE);
+
+ recv_data.pid = pid;
+ recv_data.cond = cond;
+ recv_data.timeout = 0;
+
+ display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
+
+ return 0;
+}
\ No newline at end of file
#ifndef __DISPLAY_STATE_TRANSITION_H__
#define __DISPLAY_STATE_TRANSITION_H__
+#include <unistd.h>
+
#include "core.h"
#define LOCK_SCREEN_INPUT_TIMEOUT 10000
int display_state_transition_do_state_action(int timeout);
void display_state_transition_do_proc_change_state_action(enum state_t 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);
#endif /* __DISPLAY_STATE_TRANSITION_H__ */
\ No newline at end of file
return 0;
}
+
+int display_util_get_display_state(int s_bits)
+{
+ switch (s_bits) {
+ case LCD_NORMAL:
+ return S_NORMAL;
+ case LCD_DIM:
+ return S_LCDDIM;
+ case LCD_OFF:
+ return S_LCDOFF;
+ case STANDBY:
+ return S_STANDBY;
+ case SUSPEND:
+ return S_SLEEP;
+ default:
+ return -EINVAL;
+ }
+}
\ No newline at end of file
int display_util_get_device_flags_name(enum device_flags flags, const char **flag_name);
int display_util_get_device_flags(unsigned long *device_flags);
+int display_util_get_display_state(int s_bits);
#endif /* __DISPLAY_UTIL_H__ */
\ No newline at end of file
#include "shared/log.h"
#include "device-interface.h"
#include "display.h"
+#include "display-lock.h"
#include "display-plugin.h"
#include "display-config.h"
#include "display-misc.h"
return done;
_I("Booting done, release booting lock.");
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN);
return done;
}
+++ /dev/null
-/*
- * deviced
- *
- * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/**
- * @file poll.c
- * @brief Power Manager poll implementation
- *
- */
-
-#include <stdio.h>
-#include "core.h"
-#include "device-interface.h"
-#include "poll.h"
-#include "display-ops.h"
-#include "display-plugin.h"
-#include "display-state-transition.h"
-#include "shared/log.h"
-#include "shared/plugin.h"
-
-static PMMsg recv_data;
-
-int check_dimstay(int next_state, int flag)
-{
- if (next_state != LCD_OFF)
- return false;
-
- if (!(flag & GOTO_STATE_NOW))
- return false;
-
- if (!(get_pm_status_flag() & DIMSTAY_FLAG))
- return false;
-
- return true;
-}
-
-static enum state_t get_state(int s_bits)
-{
- switch (s_bits) {
- case LCD_NORMAL:
- return S_NORMAL;
- case LCD_DIM:
- return S_LCDDIM;
- case LCD_OFF:
- return S_LCDOFF;
- case STANDBY:
- return S_STANDBY;
- case SUSPEND:
- return S_SLEEP;
- default:
- return -EINVAL;
- }
-}
-
-static int __pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout)
-{
- int cond;
-
- cond = get_state(s_bits);
- if (cond < 0)
- return cond;
-
- if (!display_state_transition_is_display_state_support_transition(cond))
- return -ENOTSUP;
-
- cond = SET_COND_REQUEST(cond, PM_REQUEST_LOCK);
-
- if (flag & GOTO_STATE_NOW)
- /* if the flag is true, go to the locking state directly */
- cond = SET_COND_FLAG(cond, PM_REQUEST_CHANGE);
-
- recv_data.pid = pid;
- recv_data.cond = cond;
- recv_data.timeout = timeout;
-
- display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
-
- return 0;
-}
-
-static int __pm_unlock_internal(pid_t pid, int s_bits, int flag)
-{
- int cond;
-
- cond = get_state(s_bits);
- if (cond < 0)
- return cond;
-
- if (!display_state_transition_is_display_state_support_transition(cond))
- return -ENOTSUP;
-
- cond = SET_COND_REQUEST(cond, PM_REQUEST_UNLOCK);
-
- if (flag & PM_KEEP_TIMER)
- cond = SET_COND_FLAG(cond, PM_FLAG_KEEP_TIMER);
-
- if (flag & PM_RESET_TIMER)
- cond = SET_COND_FLAG(cond, PM_FLAG_RESET_TIMER);
-
- recv_data.pid = pid;
- recv_data.cond = cond;
- recv_data.timeout = 0;
-
- display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
-
- return 0;
-}
-
-static int __pm_change_internal(pid_t pid, int s_bits)
-{
- int cond, ret;
- const int display_on = LCD_NORMAL | LCD_DIM;
-
- cond = get_state(s_bits);
- if (cond < 0)
- return cond;
-
- ret = display_plugin_is_lcd_on_blocked();
- if (ret != LCDON_BLOCK_NONE && (cond & display_on)) {
- _W("LCDON is blocked, %d.", ret);
- return -ENOTSUP;
- }
-
- if (!display_state_transition_is_display_state_support_transition(cond))
- return -ENOTSUP;
-
- cond = SET_COND_REQUEST(cond, PM_REQUEST_CHANGE);
-
- recv_data.pid = pid;
- recv_data.cond = cond;
- recv_data.timeout = 0;
-
- display_state_transition_do_state_transition_by_pm_control_event(&recv_data);
-
- return 0;
-}
-
-void init_pm_internal(void *data)
-{
- struct display_plugin *dp = (struct display_plugin *) data;
-
- dp->pm_lock_internal = __pm_lock_internal;
- dp->pm_unlock_internal = __pm_unlock_internal;
- dp->pm_change_internal = __pm_change_internal;
-}
#define RESET_TIMER_STR "resettimer"
#define KEEP_TIMER_STR "keeptimer"
-void init_pm_internal(void *data);
-
/**
* @}
*/
#include "shared/device-notifier.h"
#include "core/udev.h"
#include "core.h"
+#include "display-lock.h"
#include "display-ops.h"
#include "display-plugin.h"
+#include "display-state-transition.h"
#include "extcon/extcon.h"
#include "shared/plugin.h"
int ret;
_I("Cradle changed. status=%d", status);
- display_plugin_pm_change_internal(INTERNAL_LOCK_CRADLE, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_CRADLE, LCD_NORMAL);
cradle_send_broadcast(status);
ret = vconf_set_int(VCONFKEY_SYSMAN_CRADLE_STATUS, status);
if (ret < 0) {
}
if (status == DOCK_SOUND) {
- display_plugin_pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
} else if (status == DOCK_NONE) {
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, PM_SLEEP_MARGIN);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, PM_SLEEP_MARGIN);
}
return 0;
cradle = cradle_extcon_ops.status;
if (cradle == DOCK_SOUND) {
- display_plugin_pm_lock_internal(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0);
_I("Sound dock is connected. Dim lock is on.");
}
#include "poll.h"
#include "display-ops.h"
#include "display-plugin.h"
+#include "display-state-transition.h"
#include "extcon/extcon.h"
#include "shared/plugin.h"
earjack_send_broadcast(status);
earjack_send_system_event(status);
if (status != EARJACK_DISCONNECTED) {
- display_plugin_pm_change_internal(INTERNAL_LOCK_EARJACK, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_EARJACK, LCD_NORMAL);
}
old_status = status;
#include "shared/common.h"
#include "apps.h"
#include "display-plugin.h"
+#include "display-state-transition.h"
#include "shared/bitmap.h"
#define POPUP_METHOD "PopupLaunch"
va_end(args);
- display_plugin_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POPUP, LCD_NORMAL);
return ret;
}
g_variant_new("(s)", type),
__cb, -1, NULL);
- display_plugin_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POPUP, LCD_NORMAL);
return ret;
}
else
pm_state = 0x4;
- display_plugin_pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
ret = handle_date(argv[0]);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
return ret;
}
else
pm_state = 0x4;
- display_plugin_pm_lock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0);
ret = handle_timezone(argv[0]);
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE);
return ret;
}
#include "core/log.h"
#include "core/udev.h"
#include "poll.h"
+#include "display-lock.h"
#include "display-ops.h"
#include "display-plugin.h"
#include "shared/plugin.h"
int ret;
unsigned int mode = usb_state_get_selected_mode();
- display_plugin_pm_lock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0);
+ display_lock_request_lock_with_option(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0);
usb_state_set_connection(USB_CONNECTED);
send_usb_state_changed_event(VCONFKEY_SYSMAN_USB_CONNECTED);
ret = usb_disable();
if(ret < 0) {
_E("Failed to disable USB gadget: %d", ret);
- /* Important: You have to keep going to unlock display_plugin_pm_unlock_internal */
+ /* Important: You have to keep going to unlock display_lock_request_unlock_with_option */
}
- display_plugin_pm_unlock_internal(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE);
+ display_lock_request_unlock_with_option(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE);
return ret;
}
#include "display-ops.h"
#include "display-plugin.h"
#include "display-config.h"
+#include "display-state-transition.h"
#include "core.h"
#include "dd-usbhost.h"
#include "shared/plugin.h"
broadcast_usbhost_signal(USB_HOST_ADDED, usbhost);
if (display_on_usb_conn_changed)
- display_plugin_pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
/* for debugging */
_I("USB HOST Added.");
broadcast_usbhost_signal(USB_HOST_REMOVED, usbhost);
if (display_on_usb_conn_changed)
- display_plugin_pm_change_internal(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
+ display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_USB_HOST, LCD_NORMAL);
/* for debugging */
_I("USB HOST Removed.");
SET(WRAP_FLAGS "-Wl,--wrap=dlopen")
SET(WRAP_FLAGS "${WRAP_FLAGS} -Wl,--wrap=access")
-SET(WRAP_FLAGS "${WRAP_FLAGS} -Wl,--wrap=display_plugin_pm_change_internal")
+SET(WRAP_FLAGS "${WRAP_FLAGS} -Wl,--wrap=display_state_transition_request_state_transition_with_option")
FILE(GLOB ORIG_SRCS "${CMAKE_SOURCE_DIR}/src/shared/*.c")
ADD_LIBRARY(test-shared SHARED ${ORIG_SRCS})
/* FIXME: This would be replaced to plugin-api-deviced */
#include "display-plugin.h"
+#include "display-state-transition.h"
#include "test-main.h"
#include "test-mock.h"
return ret;
}
-int __wrap_display_plugin_pm_change_internal(pid_t pid, int s_bits)
+int __wrap_display_state_transition_request_state_transition_with_option(pid_t pid, int s_bits)
{
return 0;
}