input: Replace syscommon notifier with resource-manager 25/299925/3 accepted/tizen/unified/20231115.024832
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 12 Oct 2023 02:06:59 +0000 (11:06 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 16 Oct 2023 07:59:07 +0000 (16:59 +0900)
- syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT)
  => syscommon_resman_subscribe_resource_attribute_event(),
     : subscribe DEVICED_CORE_ATTR_INT_DELAYED_INIT_DONE from resource
       type of DEVICED_RESOURCE_TYPE_CORE.

- syscommon_notifier_emit_notify(DEVICED_NOTIFIER_VITAL_STATE)
  => syscommon_resman_set_resource_attr_int()
     : set DEVICED_POWER_ATTR_INT_VITAL_MODE attribute of resource type
       of DEVICED_RESOURCE_TYPE_POWER.

- syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LONGKEY_RESTORE)
  : It has been removed as currently the input core doesn't care about
    longkey restore. (It is currently only a feature of wearable plugin.)

Change-Id: I93638893e2ddedf860e8e15efe7d1346774f5610
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/deviced-input/deviced-input.c

index 0884553f3d1dd4b8cd7da0ba0fe37f2292d27ae7..732dfdec33061675018be9d1a425d07a3823b9f4 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <system/syscommon-plugin-common-interface.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
+#include <system/syscommon-plugin-deviced-core-interface.h>
 #include <system/syscommon-plugin-deviced-display-interface.h>
 #include <system/syscommon-plugin-deviced-power-interface.h>
 #include <system/syscommon-plugin-deviced-input.h>
@@ -92,6 +93,7 @@ static bool touch_pressed = false;
 static int skip_lcd_off = false;
 static int skip_combination = false;
 static int booting_check = true;
+static int init_done_callback_id;
 
 #define POPUP_METHOD "PopupLaunch"
 #define APP_POWERKEY "powerkey"
@@ -294,7 +296,6 @@ static void longkey_pressed(void)
 
 static gboolean longkey_restore_cb(void *data)
 {
-       syscommon_notifier_emit_notify(DEVICED_NOTIFIER_LONGKEY_RESTORE, (void *)NULL);
        longkey_restore_id = 0;
 
        return G_SOURCE_REMOVE;
@@ -711,7 +712,6 @@ static void process_hardkey_backlight(struct input_event *pinput)
 
 static void update_vital_state(struct input_event *pinput)
 {
-       int type;
        int vital_mode;
        int ret;
 
@@ -725,8 +725,8 @@ static void update_vital_state(struct input_event *pinput)
        if (pinput->type == EV_ABS || (pinput->type == EV_KEY &&
            pinput->value == KEY_RELEASED && pinput->code == KEY_MENU)) {
                /* Enable all services upon receiving user input, else maintain same state */
-               type = SYSCOMMON_DEVICED_VITAL_EXIT;
-               syscommon_notifier_emit_notify(DEVICED_NOTIFIER_VITAL_STATE, &type);
+               syscommon_resman_set_resource_attr_int(SYSCOMMON_RESOURCE_ID(DEVICED_RESOURCE_TYPE_POWER),
+                       DEVICED_POWER_ATTR_INT_VITAL_MODE, SYSCOMMON_DEVICED_VITAL_EXIT);
        }
 }
 
@@ -907,11 +907,13 @@ static void check_key_filter(struct timeval time, unsigned short type, unsigned
                SYSCOMMON_DEVICED_DISPLAY_STATE_ON, DEVICED_EVENT_INPUT);
 }
 
-static int delayed_init_done(void *data)
+static void delayed_init_done(int resource_type, int resource_id, int attr_id,
+       const void *data, void *user_data, int count)
 {
        booting_check = 0;
 
-       return 0;
+       syscommon_resman_unsubscribe_event(init_done_callback_id);
+       init_done_callback_id = 0;
 }
 
 static syscommon_plugin_backend_deviced_input_funcs g_input_funcs = {
@@ -936,7 +938,8 @@ static int deviced_input_init(void **data)
                SYSCOMMON_DEVICED_DISPLAY_CAPA_LCDON,
                1);
 
-       syscommon_notifier_subscribe_notify(DEVICED_NOTIFIER_DELAYED_INIT, delayed_init_done);
+       syscommon_resman_subscribe_resource_attribute_event(DEVICED_RESOURCE_TYPE_CORE, DEVICED_CORE_ATTR_INT_DELAYED_INIT_DONE,
+               delayed_init_done, NULL, &init_done_callback_id);
 
        *data = (void *)&g_input_funcs;