From e8a401ba663e55eb50413e7a5cd22b99f70913d2 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Wed, 24 Feb 2021 10:59:18 +0900 Subject: [PATCH] Add display feature for headless profile Return DEVICE_ERROR_NOT_SUPPORTED about below API ex) device_power_request_lock device_power_release_lock Change-Id: I119e3a8839c8986af81257202545abc14e2438ec Signed-off-by: lokilee73 --- src/callback.c | 1 + src/power.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/callback.c b/src/callback.c index e8006d0..b3cf676 100644 --- a/src/callback.c +++ b/src/callback.c @@ -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" diff --git a/src/power.c b/src/power.c index d47041b..238f2d7 100644 --- a/src/power.c +++ b/src/power.c @@ -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) { -- 2.7.4