display: Add attribute for releasing all lock 43/297643/2
authorYoungjae Cho <y0.cho@samsung.com>
Tue, 22 Aug 2023 02:40:19 +0000 (11:40 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 22 Aug 2023 07:48:54 +0000 (16:48 +0900)
New attribute:
 - id: DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL
 - type: SYSCOMMON_RESMAN_DATA_TYPE_INT
 - setter: O
 - getter: X
 It releases all lock of the given parameter, state.

Removed display-lock.h so that it is independent to the display core.
Due to the removal, the below codes has been changed
 - The macro __CONSTRUCTOR__ has been replaced in primitive way,
   __attribute__((constructor)), as its dependency has been removed
   that was display-lock.h -> common.h.
 - The prototype of get_var_display_config() has been relocated to
   the plugin-util.h.

Change-Id: Ida2d5c887469f331d1790fa021f3fea60108beb3
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
plugins/iot-headed/display/core.c
plugins/iot-headed/display/key-filter.c
plugins/iot-headed/display/plugin-util.h
src/display/resource-display.c

index 38fa14cc818c4776b8cd80850674432a3b00fd08..fc5c02e392928540257b4907b828e8b3896a94aa 100644 (file)
@@ -101,7 +101,7 @@ int display_plugin_config_touch_wakeup(void)
        return display_conf.touch_wakeup;
 }
 
-inline const struct syscommon_deviced_display_config* get_var_display_config()
+const struct syscommon_deviced_display_config* get_var_display_config(void)
 {
        return &display_conf;
 }
index 36b809c79663d12d02f65485fdb43cb5bd4d2488..994932156755ec8b9b97dfb23f08c4c287fa5ff7 100644 (file)
@@ -32,9 +32,7 @@
 #include <system/syscommon-plugin-deviced-power-interface.h>
 #include <linux/input.h>
 
-#include "display-config.h"
 #include <libsyscommon/log.h>
-#include "display-lock.h"
 #include "input/input.h"
 #include "plugin-util.h"
 
@@ -451,8 +449,10 @@ static int lcdoff_powerkey(void)
 
        if (decide_lcdoff() == true) {
                switch_off_lcd();
-               display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON);
-               display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM);
+               syscommon_resman_set_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL, SYSCOMMON_DEVICED_DISPLAY_STATE_ON);
+               syscommon_resman_set_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+                       DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL, SYSCOMMON_DEVICED_DISPLAY_STATE_DIM);
                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,
@@ -558,8 +558,10 @@ static int process_screenlock_key(struct input_event *pinput)
        if (!current_state_in_on())
                return false;
 
-       display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_ON);
-       display_lock_release_lock_all(SYSCOMMON_DEVICED_DISPLAY_STATE_DIM);
+       syscommon_resman_set_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL, SYSCOMMON_DEVICED_DISPLAY_STATE_ON);
+       syscommon_resman_set_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_DISPLAY),
+               DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL, SYSCOMMON_DEVICED_DISPLAY_STATE_DIM);
        set_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY);
 
        /* LCD off forcly */
@@ -809,7 +811,7 @@ static int bezel_wakeup_cb(void *data)
        return 0;
 }
 
-static void __CONSTRUCTOR__ initialize(void)
+static void __attribute__ ((constructor)) initialize(void)
 {
        /*
         * Default capability
index ac7c2d6878fa74580a2abfa0789bac0c853f31d0..df220792cd762e26fee3c2052173cd855edf8a4a 100644 (file)
@@ -28,6 +28,7 @@
 
 int launch_system_app(char *type, int num, ...);
 int display_plugin_config_touch_wakeup(void);
+const struct syscommon_deviced_display_config* get_var_display_config(void);
 
 #endif /* __PLUGIN_UTIL_H__ */
 
index a1a1758f6a7a72d6aa74eba982b89a0dc71a1f97..c4f7c2ce7abc4a77499af08b6e8cdb636f8a82f9 100644 (file)
@@ -30,6 +30,7 @@
 #include "display-actor.h"
 #include "device-interface.h"
 #include "display-misc.h"
+#include "display-lock.h"
 
 typedef union {
        int32_t i32;
@@ -76,6 +77,13 @@ static int set_display_attr_data(int resource_id,
                        return 0;
                }
                break;
+       case DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL:
+               {
+                       enum syscommon_deviced_display_state state = *(enum syscommon_deviced_display_state *) data;
+                       display_lock_release_lock_all(state);
+
+                       return 0;
+               }
        default:
                return -EINVAL;
        }
@@ -384,6 +392,15 @@ static const struct syscommon_resman_resource_attribute display_attrs[] = {
                        .get = get_display_attr_data,
                        .is_supported = syscommon_resman_resource_attr_supported_always,
                },
+       }, {
+               .name = "DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL",
+               .id = DEVICED_DISPLAY_ATTR_INT_SET_RELEASE_LOCK_ALL,
+               .flag = SYSCOMMON_RESMAN_RESOURCE_FLAG_PUBLIC,
+               .type = SYSCOMMON_RESMAN_DATA_TYPE_INT,
+               .ops = {
+                       .set = set_display_attr_data,
+                       .is_supported = syscommon_resman_resource_attr_supported_always,
+               },
        }
 };