From: Youngjae Cho Date: Mon, 21 Aug 2023 07:45:30 +0000 (+0900) Subject: display: headed: Add set_lcdoff_reason() X-Git-Tag: accepted/tizen/unified/20230823.021355~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b4b2b5c5fcf61f95a5931d2dd21a4920bc69dde;p=platform%2Fcore%2Fsystem%2Fdeviced.git display: headed: Add set_lcdoff_reason() It is copy of display_state_transition_update_lcdoff_reason() of the src/display/display-state-transition.c. Its operation is not related to the display core but just related to vconf API. It remove dependency to the core display-state-transition.h. Change-Id: I26e630ca7e61d8dcb8f45b48715d0170fc8684fb Signed-off-by: Youngjae Cho --- diff --git a/plugins/iot-headed/display/key-filter.c b/plugins/iot-headed/display/key-filter.c index ef86c4ff..b011d5af 100644 --- a/plugins/iot-headed/display/key-filter.c +++ b/plugins/iot-headed/display/key-filter.c @@ -34,7 +34,6 @@ #include "display-actor.h" #include "display-config.h" #include "display-misc.h" -#include "display-state-transition.h" #include #include "display-lock.h" #include "input/input.h" @@ -118,6 +117,29 @@ static inline void restore_custom_brightness(void) DEVICED_DISPLAY_ATTR_INT_CUSTOM_BRIGHTNESS, true); } +static int set_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; +} + static void pwroff_popup(void) { int ret; @@ -417,7 +439,7 @@ static int lcdoff_powerkey(void) switch_off_lcd(); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + set_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY), DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE, SYSCOMMON_DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY); @@ -527,7 +549,7 @@ static int process_screenlock_key(struct input_event *pinput) display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON); display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM); - display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); + set_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); /* LCD off forcly */ syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),