From 89776d0a79aebe546335d5bcb40d90a4d812c3b6 Mon Sep 17 00:00:00 2001 From: Wonki Kim Date: Thu, 7 May 2020 14:03:11 +0900 Subject: [PATCH] bootstrap: fix display turning on logic it's necessary for display to be turn on status while executing command. there is a logic which does a kind of stuffs but which is buggy. this patch fix the bug. Change-Id: Ifaa93b00b8a369e05a3c2aa1338048991112e406 --- .../inc/Commands/PreCommand.h | 2 + .../org.tizen.aurum-bootstrap.xml | 1 + .../src/Commands/PreCommand.cc | 45 +++++-------------- 3 files changed, 14 insertions(+), 34 deletions(-) diff --git a/org.tizen.aurum-bootstrap/inc/Commands/PreCommand.h b/org.tizen.aurum-bootstrap/inc/Commands/PreCommand.h index ad3145b..a5c8f09 100644 --- a/org.tizen.aurum-bootstrap/inc/Commands/PreCommand.h +++ b/org.tizen.aurum-bootstrap/inc/Commands/PreCommand.h @@ -12,6 +12,8 @@ private: Command *mCommand; PreCommand(); + static const int INTV_TURNON_MARGIN = 5000; + public: PreCommand(Command *cmd); ::grpc::Status execute() override; diff --git a/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml b/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml index 04f7f0e..fcac948 100644 --- a/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml +++ b/org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml @@ -25,4 +25,5 @@ http://tizen.org/privilege/display true + true diff --git a/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc index b978b9c..2f28f50 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc @@ -18,48 +18,25 @@ PreCommand::PreCommand(Command *cmd) : mCommand{cmd} {} { LOG_SCOPE_F(INFO, "PreCommand --------------- "); - bool isDisplayOn = (bool)ecore_main_loop_thread_safe_call_sync([](void *data)->void*{ + bool isDisplayOn = DISPLAY_STATE_SCREEN_OFF != (display_state_e)((int)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); } + LOG_F(INFO, "getting display state has failed"); return NULL; - }, NULL) != (display_state_e)DISPLAY_STATE_SCREEN_OFF; + }, NULL)); - 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; - } + ecore_main_loop_thread_safe_call_sync([](void *data)->void*{ + if (device_power_wakeup(false) != DEVICE_ERROR_NONE) { + LOG_F(INFO, "turning on display has failed"); return NULL; - }, NULL); //FIXME : extract ecore dep from here - } + } + return NULL; + }, NULL); - AtspiAccessible *n = atspi_get_desktop(0); - if (n) { - char *name = atspi_accessible_get_name(n, NULL); - if(name) free(name); - g_object_unref(n); - } + if (!isDisplayOn) + std::this_thread::sleep_for(std::chrono::milliseconds{INTV_TURNON_MARGIN}); } mCommand->executePre(); return mCommand->execute(); -- 2.34.1