display: Add pmlock type and power lock type conversion 37/303937/1 accepted/tizen/7.0/unified/20240109.160531
authorYunhee Seo <yuni.seo@samsung.com>
Mon, 8 Jan 2024 07:33:02 +0000 (16:33 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 8 Jan 2024 07:33:02 +0000 (16:33 +0900)
When the emit power lock state signal, it was omitted pmlock and power lock conversion from deviced.
For accurate signal emitting, this is necessary.

Change-Id: Ida02a4cacda603c911d89c318e4d93274540f4a6
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/display/display-lock.c

index 21585ae..ba937f8 100644 (file)
@@ -81,6 +81,20 @@ enum state_t power_lock_type_to_pmlock(power_lock_e power_lock_type)
        }
 }
 
+static int pmlock_type_to_power_lock(enum state_t pmlock_type)
+{
+       switch(pmlock_type) {
+       case S_LCDOFF:
+               return POWER_LOCK_CPU;
+       case S_LCDON:
+               return POWER_LOCK_DISPLAY;
+       case S_LCDDIM:
+               return POWER_LOCK_DISPLAY_DIM;
+       default:
+               return -EINVAL;
+       }
+}
+
 static void refresh_app_cond(void)
 {
        trans_condition = 0;
@@ -96,15 +110,11 @@ static void refresh_app_cond(void)
 static void broadcast_pmlock_state_changed(enum state_t state)
 {
        int num_of_pmlock;
+       int power_lock_type = 0;
 
-       switch(state) {
-       case S_LCDON:
-       case S_LCDDIM:
-       case S_LCDOFF:
-               break;
-       default:
+       power_lock_type = pmlock_type_to_power_lock(state);
+       if (power_lock_type < 0)
                return;
-       }
 
        num_of_pmlock = g_list_length(cond_head[state]);
 
@@ -113,7 +123,7 @@ static void broadcast_pmlock_state_changed(enum state_t state)
                DEVICED_PATH_DISPLAY,
                DEVICED_INTERFACE_DISPLAY,
                DEVICED_SIGNAL_POWER_LOCK_COUNT_CHANGED,
-               g_variant_new("(ii)", state, num_of_pmlock));
+               g_variant_new("(ii)", power_lock_type, num_of_pmlock));
 
        if (num_of_pmlock > 1)
                return;
@@ -122,7 +132,7 @@ static void broadcast_pmlock_state_changed(enum state_t state)
                DEVICED_PATH_DISPLAY,
                DEVICED_INTERFACE_DISPLAY,
                DEVICED_SIGNAL_POWER_LOCK_STATE_CHANGED,
-               g_variant_new("(ii)", state, num_of_pmlock));
+               g_variant_new("(ii)", power_lock_type, num_of_pmlock));
 }
 
 static void broadcast_pmlock_expired(pid_t pid, enum state_t state, const char* appid, time_t locktime)