update_lcdoff_source() is used for setting lcdoff reason.
This function is called when the display state goes to lcdoff state.
Same code was copied and used in all plugins.
Thus, this function is added below display-state-transition
int display_state_transition_update_lcdoff_reason(int source);
-> This function sets the lcdoff reason to VCONFKEY_PM_LCDOFF_SOURCE.
Change-Id: Idc857d4b52502612eaccb01373d984815806a153
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
return 0;
}
-void update_lcdoff_source(int source)
-{
- int ret;
-
- switch (source) {
- case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
- _I("LCD OFF by timeout.");
- break;
- case VCONFKEY_PM_LCDOFF_BY_POWERKEY:
- _I("LCD OFF by powerkey.");
- break;
- default:
- _E("Invalid value(%d).", source);
- return;
- }
- ret = vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source);
- if (ret < 0)
- _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno());
-}
-
/* SIGHUP signal handler
* For debug... print info to syslog
*/
/* enter action */
if (st->action) {
if (get_pm_cur_state() == S_LCDOFF)
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
+ 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 (set_custom_lcdon_timeout(0) == true)
#include "display-backlight.h"
#include "display-ops.h"
#include "display-config.h"
+#include "display-state-transition.h"
#include "shared/common.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
switch_off_lcd();
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ 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);
}
if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) {
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
if (disp_plgn->pm_change_internal)
return 0;
}
-void update_lcdoff_source(int source)
-{
- int ret;
-
- switch (source) {
- case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
- _I("LCD OFF by timeout.");
- break;
- case VCONFKEY_PM_LCDOFF_BY_POWERKEY:
- _I("LCD OFF by powerkey.");
- break;
- default:
- _E("Invalid value(%d).", source);
- return;
- }
- ret = vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source);
- if (ret < 0)
- _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno());
-}
-
/* SIGHUP signal handler
* For debug... print info to syslog
*/
/* enter action */
if (st->action) {
if (get_pm_cur_state() == S_LCDOFF)
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
+ 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 (set_custom_lcdon_timeout(0) == true)
#include "display-backlight.h"
#include "display-ops.h"
#include "display-config.h"
+#include "display-state-transition.h"
#include "shared/common.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
switch_off_lcd();
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ 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);
}
if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) {
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
if (disp_plgn->pm_change_internal)
return 0;
}
-void update_lcdoff_source(int source)
-{
- int ret;
-
- switch (source) {
- case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
- _I("LCD OFF by timeout.");
- break;
- case VCONFKEY_PM_LCDOFF_BY_POWERKEY:
- _I("LCD OFF by powerkey.");
- break;
- default:
- _E("Invalid value(%d).", source);
- return;
- }
- ret = vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source);
- if (ret < 0)
- _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno());
-}
-
/* SIGHUP signal handler
* For debug... print info to syslog
*/
/* enter action */
if (st->action) {
if (get_pm_cur_state() == S_LCDOFF)
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
+ 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 (set_custom_lcdon_timeout(0) == true)
#include "display-backlight.h"
#include "display-ops.h"
#include "display-config.h"
+#include "display-state-transition.h"
#include "shared/common.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
switch_off_lcd();
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ 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);
}
if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) {
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
if (disp_plgn->pm_change_internal)
return 0;
}
-void update_lcdoff_source(int source)
-{
- int ret;
-
- switch (source) {
- case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
- _I("LCD OFF by timeout.");
- break;
- case VCONFKEY_PM_LCDOFF_BY_POWERKEY:
- _I("LCD OFF by powerkey.");
- break;
- default:
- _E("Invalid value(%d).", source);
- return;
- }
- ret = vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source);
- if (ret < 0)
- _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno());
-}
-
/* SIGHUP signal handler
* For debug... print info to syslog
*/
/* enter action */
if (st->action) {
if (get_pm_cur_state() == S_LCDOFF)
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
+ 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 (set_custom_lcdon_timeout(0) == true)
#include "display-panel.h"
#include "display-backlight.h"
#include "display-config.h"
+#include "display-state-transition.h"
#include "shared/common.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
switch_off_lcd();
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ 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);
}
if (!check_holdkey_block(S_NORMAL) && !check_holdkey_block(S_LCDDIM)) {
delete_condition(S_NORMAL);
delete_condition(S_LCDDIM);
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
+ display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
/* LCD off forcly */
if (disp_plgn->pm_change_internal)
int custom_lcdoff(enum device_flags flag);
int display_on_by_reason(const char *reason, int timeout);
int display_off_by_reason(const char *reason);
-void update_lcdoff_source(int source);
int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name);
int custom_lcdon(int timeout);
void lcd_on_direct(enum device_flags flags);
}
return 0; /* transitable */
+}
+
+int display_state_transition_update_lcdoff_reason(int source)
+{
+ int ret;
+
+ switch (source) {
+ case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
+ _I("LCD OFF by timeout.");
+ break;
+ case VCONFKEY_PM_LCDOFF_BY_POWERKEY:
+ _I("LCD OFF by powerkey.");
+ break;
+ default:
+ _E("Invalid value(%d).", source);
+ return -EINVAL;
+ }
+ ret = vconf_set_int(VCONFKEY_PM_LCDOFF_SOURCE, source);
+ if (ret < 0) {
+ _E("Failed to set vconf value for lcd off source: %d", vconf_get_ext_errno());
+ return -EPERM;
+ }
+
+ return 0;
}
\ No newline at end of file
int display_state_transition_get_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_update_lcdoff_reason(int source);
#endif /* __DISPLAY_STATE_TRANSITION_H__ */
\ No newline at end of file
#include "display-lock.h"
#include "display-panel.h"
#include "display-config.h"
+#include "display-state-transition.h"
//#include "display/display.h"
#include "display-backlight.h"
#include "display-misc.h"
ret = disp_plgn->pm_change_internal(pid, state);
if (!ret && state == LCD_OFF)
- update_lcdoff_source(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
+ display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_TIMEOUT);
out:
g_free(state_str);
return g_variant_new("(i)", ret);