Add display feature for headless profile 31/254131/5 accepted/tizen/unified/20210225.130511 submit/tizen/20210224.093227
authorlokilee73 <changjoo.lee@samsung.com>
Wed, 24 Feb 2021 01:59:18 +0000 (10:59 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Wed, 24 Feb 2021 08:31:01 +0000 (17:31 +0900)
Return DEVICE_ERROR_NOT_SUPPORTED about below API
ex) device_power_request_lock
    device_power_release_lock

Change-Id: I119e3a8839c8986af81257202545abc14e2438ec
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/callback.c
src/power.c

index e8006d0..b3cf676 100644 (file)
@@ -27,6 +27,7 @@
 #include "callback.h"
 #include "battery.h"
 #include "display.h"
+#include "display-internal.h"
 #include "common.h"
 
 #define SIGNAL_FLASH_STATE  "ChangeFlashState"
index d47041b..238f2d7 100644 (file)
@@ -29,6 +29,7 @@
 #include "power.h"
 #include "power-internal.h"
 #include "display.h"
+#include "display-internal.h"
 #include "common.h"
 
 /**
@@ -446,6 +447,17 @@ int device_power_request_lock(power_lock_e type, int timeout_ms)
 
        _I("power_lock_e = %d", type);
 
+       if (!is_feature_display_supported() || !is_feature_display_state_supported()) {
+               if ((type == POWER_LOCK_DISPLAY) || (type == POWER_LOCK_DISPLAY_DIM))
+                       return DEVICE_ERROR_NOT_SUPPORTED;
+               /*
+                * In case of POWER_LOCK_CPU for headless profile, temporary return DEVICE_ERROR_NONE.
+                * It will be implemented later.
+                */
+               else if (type == POWER_LOCK_CPU)
+                       return DEVICE_ERROR_NONE;
+       }
+
        if (check_async_call_rate(&num_calls) < 0) {
 //LCOV_EXCL_START System Error
                _E("Rejected by too frequent calls; %d (calls per sec.) limit is violated."
@@ -483,6 +495,17 @@ int device_power_release_lock(power_lock_e type)
 
        _I("power_lock_e = %d", type);
 
+       if (!is_feature_display_supported() || !is_feature_display_state_supported()) {
+               if ((type == POWER_LOCK_DISPLAY) || (type == POWER_LOCK_DISPLAY_DIM))
+                       return DEVICE_ERROR_NOT_SUPPORTED;
+               /*
+                * In case of POWER_LOCK_CPU for headless profile, temporary return DEVICE_ERROR_NONE.
+                * It will be implemented later.
+                */
+               else if (type == POWER_LOCK_CPU)
+                       return DEVICE_ERROR_NONE;
+       }
+
        if (type == POWER_LOCK_CPU && power_locked_CPU) {
                ret = unlock_state(DISPLAY_STATE_SCREEN_OFF, PM_SLEEP_MARGIN);
                if (ret == 0) {