bootstrap: Code and logic clean up when display off state 52/260952/6
authorWoochanlee <wc0917.lee@samsung.com>
Wed, 7 Jul 2021 10:06:24 +0000 (19:06 +0900)
committerWoochanlee <wc0917.lee@samsung.com>
Thu, 8 Jul 2021 05:57:57 +0000 (14:57 +0900)
there is no need to call device_power_wakeup(), if display already on

Change-Id: Ic42d9625cf04b0a1ffec79652c4c8a5fb0d363e3

org.tizen.aurum-bootstrap/src/Commands/PreCommand.cc
packaging/aurum.spec

index b291289..82d10d5 100644 (file)
@@ -15,22 +15,26 @@ PreCommand::PreCommand(Command *cmd) : mCommand{cmd} {}
 
 ::grpc::Status PreCommand::execute()
 {
-    {
-        LOGI("PreCommand --------------- ");
-        display_state_e state;
-        if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
-            LOGI("getting display state has failed");
-        }
+#ifndef TIZEN_TV
+    display_state_e state;
+    if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
+        LOGE("getting display state has failed");
+        return grpc::Status::CANCELLED;
+    }
 
-        bool isDisplayOn = DISPLAY_STATE_SCREEN_OFF != state;
+    bool isDisplayOn = DISPLAY_STATE_SCREEN_OFF != state;
 
+    if (!isDisplayOn) {
+        LOGI("Display off state try to wake up");
         if (device_power_wakeup(false) != DEVICE_ERROR_NONE) {
-             LOGI("turning on display has failed");
+            LOGE("turning on display has failed");
+            return grpc::Status::CANCELLED;
         }
 
-        if (!isDisplayOn)
-            std::this_thread::sleep_for(std::chrono::milliseconds{INTV_TURNON_MARGIN});
+        std::this_thread::sleep_for(std::chrono::milliseconds{INTV_TURNON_MARGIN});
     }
+#endif /* TIZEN_TV */
+
     mCommand->executePre();
     return mCommand->execute();
 }
index 21e21fc..f002269 100644 (file)
@@ -131,6 +131,11 @@ meson \
         -e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'
 
 %build
+
+%if "%{tizen_profile_name}" == "tv"
+        CFLAGS+=" -DTIZEN_TV";export CFLAGS
+%endif
+
 ninja \
     -C gbsbuild \
     -j %(echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \