display: lock: Relocate custom_holdkey_block variable 32/292632/10
authorYunhee Seo <yuni.seo@samsung.com>
Wed, 10 May 2023 06:38:27 +0000 (15:38 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 30 May 2023 11:47:39 +0000 (20:47 +0900)
To remove build dependency, custom_holdkey_block variable should be moved to display-lock.
And then, custom_holdkey_block getter/setter is added.
void display_lock_set_custom_holdkey_block(bool blocked);
void display_lock_get_custom_holdkey_block(bool *blocked);

custom_holdkey_block is set through the dbus method dbus_setlcdtimeout.
This variable is used for screenlock, lcdoff process.

Change-Id: If8b19fd66d388271ccc51c327302ed00196097f7
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
plugins/iot-headed/display/core.c
plugins/mobile/display/core.c
plugins/tv/display/core.c
plugins/wearable/display/core.c
src/display/plugin-common/display-lock.c
src/display/plugin-common/display-lock.h

index a493e31..b0b9aa6 100644 (file)
@@ -102,7 +102,6 @@ static guint timeout_src_id;
 static int system_wakeup_flag = false;
 static unsigned int custom_normal_timeout = 0;
 static unsigned int custom_dim_timeout = 0;
-int custom_holdkey_block = false;
 static char *custom_change_name;
 static guint lock_timeout_id;
 static int lock_screen_timeout = LOCK_SCREEN_INPUT_TIMEOUT;
@@ -1658,10 +1657,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
                states[get_pm_cur_state()].trans(EVENT_INPUT);
 
        if (holdkey_block) {
-               custom_holdkey_block = true;
+               display_lock_set_custom_holdkey_block(true);
                _I("Hold key disabled.");
        } else {
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                _I("Hold key enabled.");
        }
 
@@ -1679,7 +1678,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
        if (!custom_change_name) {
                _E("Failed to malloc.");
                custom_normal_timeout = custom_dim_timeout = 0;
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                return -ENOMEM;
        }
 
@@ -1705,7 +1704,7 @@ void reset_lcd_timeout(GDBusConnection *conn,
        free(custom_change_name);
        custom_change_name = 0;
        custom_normal_timeout = custom_dim_timeout = 0;
-       custom_holdkey_block = false;
+       display_lock_set_custom_holdkey_block(false);
 
        update_display_time();
        if (get_pm_cur_state() == S_NORMAL)
index e156705..a6a31f7 100644 (file)
@@ -104,7 +104,6 @@ static guint timeout_src_id;
 static int system_wakeup_flag = false;
 static unsigned int custom_normal_timeout = 0;
 static unsigned int custom_dim_timeout = 0;
-int custom_holdkey_block = false;
 static char *custom_change_name;
 static guint lock_timeout_id;
 static int lock_screen_timeout = LOCK_SCREEN_INPUT_TIMEOUT;
@@ -1668,10 +1667,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
                states[get_pm_cur_state()].trans(EVENT_INPUT);
 
        if (holdkey_block) {
-               custom_holdkey_block = true;
+               display_lock_set_custom_holdkey_block(true);
                _I("Hold key disabled.");
        } else {
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                _I("Hold key enabled.");
        }
 
@@ -1689,7 +1688,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
        if (!custom_change_name) {
                _E("Failed to malloc.");
                custom_normal_timeout = custom_dim_timeout = 0;
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                return -ENOMEM;
        }
 
@@ -1715,7 +1714,7 @@ void reset_lcd_timeout(GDBusConnection *conn,
        free(custom_change_name);
        custom_change_name = 0;
        custom_normal_timeout = custom_dim_timeout = 0;
-       custom_holdkey_block = false;
+       display_lock_set_custom_holdkey_block(false);
 
        update_display_time();
        if (get_pm_cur_state() == S_NORMAL)
index c6e4132..b6b472e 100644 (file)
@@ -102,7 +102,6 @@ static guint timeout_src_id;
 static int system_wakeup_flag = false;
 static unsigned int custom_normal_timeout = 0;
 static unsigned int custom_dim_timeout = 0;
-int custom_holdkey_block = false;
 static char *custom_change_name;
 static guint lock_timeout_id;
 static int lock_screen_timeout = LOCK_SCREEN_INPUT_TIMEOUT;
@@ -1658,10 +1657,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
                states[get_pm_cur_state()].trans(EVENT_INPUT);
 
        if (holdkey_block) {
-               custom_holdkey_block = true;
+               display_lock_set_custom_holdkey_block(true);
                _I("Hold key disabled.");
        } else {
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                _I("Hold key enabled.");
        }
 
@@ -1679,7 +1678,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
        if (!custom_change_name) {
                _E("Failed to malloc.");
                custom_normal_timeout = custom_dim_timeout = 0;
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                return -ENOMEM;
        }
 
@@ -1705,7 +1704,7 @@ void reset_lcd_timeout(GDBusConnection *conn,
        free(custom_change_name);
        custom_change_name = 0;
        custom_normal_timeout = custom_dim_timeout = 0;
-       custom_holdkey_block = false;
+       display_lock_set_custom_holdkey_block(false);
 
        update_display_time();
        if (get_pm_cur_state() == S_NORMAL)
index 960895c..ac74b6e 100644 (file)
@@ -115,7 +115,6 @@ static guint timeout_src_id;
 static int system_wakeup_flag = false;
 static unsigned int custom_normal_timeout = 0;
 static unsigned int custom_dim_timeout = 0;
-int custom_holdkey_block = false;
 static char *custom_change_name;
 static guint lock_timeout_id;
 static guint transit_timer;
@@ -1984,10 +1983,10 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
                states[get_pm_cur_state()].trans(EVENT_INPUT);
 
        if (holdkey_block) {
-               custom_holdkey_block = true;
+               display_lock_set_custom_holdkey_block(true);
                _I("Hold key disabled.");
        } else {
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                _I("Hold key enabled.");
        }
 
@@ -2005,7 +2004,7 @@ int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name)
        if (!custom_change_name) {
                _E("Failed to malloc.");
                custom_normal_timeout = custom_dim_timeout = 0;
-               custom_holdkey_block = false;
+               display_lock_set_custom_holdkey_block(false);
                return -ENOMEM;
        }
 
@@ -2031,7 +2030,7 @@ void reset_lcd_timeout(GDBusConnection *conn,
        free(custom_change_name);
        custom_change_name = 0;
        custom_normal_timeout = custom_dim_timeout = 0;
-       custom_holdkey_block = false;
+       display_lock_set_custom_holdkey_block(false);
 
        update_display_time();
        if (get_pm_cur_state() == S_NORMAL)
index 747b876..35431c3 100644 (file)
@@ -42,6 +42,7 @@
 
 static GList *cond_head[S_END];
 static int trans_condition;
+static bool custom_holdkey_block = false;
 
 bool check_lock_state(int state)
 {
@@ -563,3 +564,19 @@ void update_lock_timer(PMMsg *data,
                g_source_remove(node->timeout_id);
        node->timeout_id = timeout_id;
 }
+
+int display_lock_set_custom_holdkey_block(bool blocked)
+{
+       custom_holdkey_block = blocked;
+       return 0;
+}
+
+int display_lock_get_custom_holdkey_block(bool *blocked)
+{
+       if (!blocked)
+               return -EINVAL;
+
+       *blocked = custom_holdkey_block;
+       return 0;
+}
+
index 98e3376..22d3063 100644 (file)
@@ -70,6 +70,8 @@ int display_app_background(void *data);
 int display_app_foreground(void *data);
 int display_app_terminated(void *data);
 void update_lock_timer(PMMsg *data, PmLockNode *node, guint timeout_id);
-extern int custom_holdkey_block;
+
+int display_lock_set_custom_holdkey_block(bool blocked);
+int display_lock_get_custom_holdkey_block(bool *blocked);
 
 #endif /* __DISPLAY_LOCK_H__ */