bootstrap: fix display turning on logic submit/tizen/20200507.060934
authorWonki Kim <wonki_.kim@samsung.com>
Thu, 7 May 2020 05:03:11 +0000 (14:03 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Thu, 7 May 2020 05:03:11 +0000 (14:03 +0900)
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

org.tizen.aurum-bootstrap/inc/Commands/PreCommand.h
org.tizen.aurum-bootstrap/org.tizen.aurum-bootstrap.xml
org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc

index ad3145b..a5c8f09 100644 (file)
@@ -12,6 +12,8 @@ private:
     Command *mCommand;
     PreCommand();
 
+    static const int INTV_TURNON_MARGIN = 5000;
+
 public:
     PreCommand(Command *cmd);
     ::grpc::Status execute() override;
index 04f7f0e..fcac948 100644 (file)
@@ -25,4 +25,5 @@
                <privilege>http://tizen.org/privilege/display</privilege>
        </privileges>
        <feature name="http://tizen.org/feature/network.ethernet">true</feature>
+       <feature name="http://tizen.org/feature/display.state">true</feature>
 </manifest>
index b978b9c..2f28f50 100644 (file)
@@ -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();