display: Replace change state of iot-headed/mobile/tv plugin 55/297255/1
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 16 Aug 2023 02:10:07 +0000 (11:10 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 16 Aug 2023 02:13:51 +0000 (11:13 +0900)
The display_state_transition_request_state_transition_with_option()
has been replaced by resource-manager API of the libsyscommon that
sets display attribute DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE.

Change-Id: I7e9cecd3246914c5a323eac7acb3051b907737bb
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/iot-headed/display/key-filter.c
plugins/mobile/battery/battery-notification.c
plugins/mobile/display/key-filter.c
plugins/tv/display/key-filter.c

index 5248142..c5a1d8f 100644 (file)
@@ -153,8 +153,9 @@ static void longkey_pressed(void)
 
        if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
                /* change state - LCD on */
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL);
-               display_state_transition_do_state_transition_by_input_poll_event();
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
@@ -408,7 +409,9 @@ static int lcdoff_powerkey(void)
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
        } else {
                ignore = false;
                skip_combination = false;
@@ -518,7 +521,9 @@ static int process_screenlock_key(struct input_event *pinput)
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
-       display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
+       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+               DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
 
        return true;
 }
@@ -733,7 +738,9 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
                return;
 
        /* lcd on or update lcd timeout */
-       display_state_transition_do_state_transition_by_input_poll_event();
+       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+               DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT);
 }
 
 static int delayed_init_done(void *data)
index b42ec4c..f9856f7 100644 (file)
@@ -20,7 +20,9 @@
 #include <stdbool.h>
 #include <string.h>
 #include <libsyscommon/libgdbus.h>
+#include <libsyscommon/resource-manager.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
+#include <system/syscommon-plugin-deviced-display-interface.h>
 
 #include "core/log.h"
 #include "battery.h"
@@ -163,7 +165,9 @@ static int launch_lowbat_noti(int capacity, int option)
                        noti_type = METHOD_LOW_NOTI_UPDATE;
                else {
                        noti_type = METHOD_LOW_NOTI_ON;
-                       display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_NORMAL);
+                       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                               DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_BATTERY_CAPACITY_LOW);
                }
                prev_level = battery_info.warning;
                if (battery->charge_now)
@@ -203,7 +207,9 @@ static int launch_lowbat_noti(int capacity, int option)
                        noti_type = METHOD_CRITICAL_NOTI_UPDATE;
                else {
                        noti_type = METHOD_CRITICAL_NOTI_ON;
-                       display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_NORMAL);
+                       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                               DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_BATTERY_CAPACITY_LOW);
                }
                prev_level = battery_info.critical;
                if (battery->charge_now)
index 3530cf5..cb38e6a 100644 (file)
@@ -145,8 +145,9 @@ static void longkey_pressed(void)
 
        if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
                /* change state - LCD on */
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL);
-               display_state_transition_do_state_transition_by_input_poll_event();
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
@@ -398,7 +399,9 @@ static int lcdoff_powerkey(void)
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
        } else {
                ignore = false;
                skip_combination = false;
@@ -550,7 +553,9 @@ static int process_screenlock_key(struct input_event *pinput)
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
-       display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
+       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+               DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
 
        return true;
 }
index 7708ff3..ec5c859 100644 (file)
@@ -152,8 +152,9 @@ static void longkey_pressed(void)
 
        if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) {
                /* change state - LCD on */
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL);
-               display_state_transition_do_state_transition_by_input_poll_event();
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT_POWERKEY);
        }
 
        if (!display_has_caps(caps, DISPLAY_CAPA_LCDOFF)) {
@@ -407,7 +408,9 @@ static int lcdoff_powerkey(void)
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_ON);
                display_lock_release_lock_all(DEVICED_DISPLAY_STATE_DIM);
                display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
-               display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF);
+               syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+                       DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
        } else {
                ignore = false;
                skip_combination = false;
@@ -517,7 +520,9 @@ static int process_screenlock_key(struct input_event *pinput)
        display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
-       display_state_transition_request_state_transition_with_option(-1, LCD_OFF);
+       syscommon_resman_set_resource_attr_uint64_2(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_TUPLE2_SET_CURRENT_STATE,
+               DEVICED_DISPLAY_STATE_OFF, DEVICED_EVENT_INPUT_POWERKEY);
 
        return true;
 }