From b30916ce150c89157d3e361f194752afd7698f22 Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Fri, 24 Apr 2020 19:52:42 +0900 Subject: [PATCH] bootstrap: turn display on just before executing commands commands might be working properly while display isn't in off state. this patch turns the display on just before executing commands. Change-Id: I8a6b38fbe13a7d1b04e6ba65e9f1c58492ab7578 --- org.tizen.aurum-bootstrap/meson.build | 1 + .../org.tizen.aurum-bootstrap.xml | 1 + .../src/Commands/LaunchAppCommand.cc | 2 +- .../src/Commands/PreCommand.cc | 47 +++++++++++++++++++++- packaging/aurum.spec | 1 + 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/org.tizen.aurum-bootstrap/meson.build b/org.tizen.aurum-bootstrap/meson.build index aeb2413..4327453 100644 --- a/org.tizen.aurum-bootstrap/meson.build +++ b/org.tizen.aurum-bootstrap/meson.build @@ -49,6 +49,7 @@ bootstrap_svr_dep = [ if get_option('tizen') == true bootstrap_svr_dep += [ dependency('capi-appfw-app-control'), + dependency('capi-system-device'), dependency('capi-appfw-app-manager'), dependency('capi-appfw-package-manager'), dependency('capi-appfw-service-application'), diff --git a/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml b/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml index f7c6fa1..04f7f0e 100644 --- a/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml +++ b/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml @@ -22,6 +22,7 @@ http://tizen.org/privilege/inputgenerator http://tizen.org/privilege/screenshot http://tizen.org/privilege/location + http://tizen.org/privilege/display true diff --git a/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc index 6002a94..86326eb 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/LaunchAppCommand.cc @@ -49,6 +49,6 @@ LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp* request, ::grpc::Status LaunchAppCommand::executePost() { LOG_SCOPE_F(INFO, "LaunchAppCommand::executePost"); - std::this_thread::sleep_for(std::chrono::milliseconds{1500}); + std::this_thread::sleep_for(std::chrono::milliseconds{2500}); return grpc::Status::OK; } \ No newline at end of file diff --git a/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc index a0f13ff..b978b9c 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc @@ -2,6 +2,14 @@ #include #include +#include +#include + +#include +#include +#include +#include + PreCommand::PreCommand() : PreCommand(nullptr) {} PreCommand::PreCommand(Command *cmd) : mCommand{cmd} {} @@ -9,6 +17,43 @@ PreCommand::PreCommand(Command *cmd) : mCommand{cmd} {} { { LOG_SCOPE_F(INFO, "PreCommand --------------- "); + + bool isDisplayOn = (bool)ecore_main_loop_thread_safe_call_sync([](void *data)->void*{ + display_state_e state; + if(device_display_get_state(&state) == DEVICE_ERROR_NONE) { + return (void*)(state); + } + return NULL; + }, NULL) != (display_state_e)DISPLAY_STATE_SCREEN_OFF; + + if (!isDisplayOn) + { + LOG_F(INFO, "display state : SCREEN_OFF, turn display on"); + ecore_main_loop_thread_safe_call_sync([](void *data)->void*{ + if (device_power_wakeup(false) != DEVICE_ERROR_NONE) { + LOG_F(INFO, "turning display up has failed"); + return NULL; + } + if (device_power_request_lock(POWER_LOCK_DISPLAY, 10*1000) != DEVICE_ERROR_NONE) { + LOG_F(INFO, "request lock device has failed"); + return NULL; + } + return NULL; + }, NULL); //FIXME : extract ecore dep from here + + // sleep for display on effect + std::this_thread::sleep_for(std::chrono::milliseconds{5*1000}); + } else { + LOG_F(INFO, "display state : SCREEN_ON, lock display on"); + ecore_main_loop_thread_safe_call_sync([](void *data)->void*{ + if (device_power_request_lock(POWER_LOCK_DISPLAY, 10*1000) != DEVICE_ERROR_NONE) { + LOG_F(INFO, "request lock device has failed"); + return NULL; + } + return NULL; + }, NULL); //FIXME : extract ecore dep from here + } + AtspiAccessible *n = atspi_get_desktop(0); if (n) { char *name = atspi_accessible_get_name(n, NULL); @@ -23,4 +68,4 @@ PreCommand::PreCommand(Command *cmd) : mCommand{cmd} {} ::grpc::Status PreCommand::executePost() { return mCommand->executePost(); -} \ No newline at end of file +} diff --git a/packaging/aurum.spec b/packaging/aurum.spec index 60f5072..bfea344 100644 --- a/packaging/aurum.spec +++ b/packaging/aurum.spec @@ -24,6 +24,7 @@ BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(capi-appfw-app-control) BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(capi-appfw-service-application) +BuildRequires: pkgconfig(capi-system-device) BuildRequires: pkgconfig(libtzplatform-config) %if "%{?profile}" == "tv" -- 2.7.4