[WRTjs][VD] Fix portrait mode, ConnecTime app is flickering issue 08/304608/5
authorzhaosy <shiyusy.zhao@samsung.com>
Mon, 22 Jan 2024 06:58:54 +0000 (14:58 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 1 Feb 2024 08:57:40 +0000 (08:57 +0000)
Issue:
In portrait mode, when app is launched, window size is 1920*1080.
When app is showing, "wm,rotation,changed" callback is received,
resize it to 1080*1920, so app is flickering.

Solution:
When app is initializing, resize app to 1080*1920.

Change-Id: Ia43e73293da0b39a7a90445f3f6ffe6aa6eacf46
Signed-off-by: zhaosy <shiyusy.zhao@samsung.com>
wrt/src/browser/tv/wrt_native_window_tv.cc
wrt/src/browser/wrt_native_window.h

index 242a8400e86f15ae22bd8c182a4fd951c713892f..ed1eced5c053b7a777993285714cac1fb348804f 100644 (file)
@@ -67,6 +67,7 @@ const char* kMultiScreenInfoVconfKey = "memory/multiscreen/info";
 const char* kProxyExceptionList =
     "db/menu/network/server_network_settings/proxy_exceptional_address";
 const char* kProxyVconfKey = "memory/dnet/proxy";
+const char* kRotationState = "db/sysman/rotation_state";
 const char* kWebAppProxyVconfKey = "db/webapp/proxy";
 
 // metadata
@@ -232,6 +233,23 @@ void OnScreenshotCapturedCB(Evas_Object* image, void* user_data) {
   delete file_name;
 }
 
+int GetTVRotationDegree() {
+  auto rotation_state = VconfHandle(kRotationState).Int();
+  switch (rotation_state) {
+    case DISPLAY_ROTATOR_ORIENTATION_PORTRAIT:
+      return 270;
+    case DISPLAY_ROTATOR_ORIENTATION_LANDSCAPE:
+      return 0;
+    case DISPLAY_ROTATOR_ORIENTATION_PORTRAIT_R:
+      return 90;
+    case DISPLAY_ROTATOR_ORIENTATION_LANDSCAPE_R:
+      return 180;
+    default:
+      break;
+  }
+  return 0;
+}
+
 WRTNativeWindow::ScreenOrientation ConvertRotatorOrientation(
     display_rotator_orientation_e rotator_orientation) {
   switch (rotator_orientation) {
@@ -424,6 +442,8 @@ void WRTNativeWindowTV::SetRotation() {
   } else if (meta_data_info.GetValue(kScreenOrientation) == "all") {
     LOG(INFO) << "ScreenOrientation is all";
     SetAutoRotation();
+    rotation_ = GetTVRotationDegree();
+    LOG(INFO) << "rotation_ : " << rotation_;
   }
 }
 
index fc91fbee6667329883c185690500f0b6103da8b0..980d7f0d7034c63124eb689e334cc7e4da40c9e1 100644 (file)
@@ -171,6 +171,7 @@ class WRTNativeWindow : public electron::NativeWindow {
   bool is_main_native_window_ = false;
   bool is_enabled_ = true;
   content::WebContents* web_contents_;
+  int rotation_;
 
  private:
   static void OnHWBackKey(void*, Evas_Object*, void*);
@@ -196,7 +197,6 @@ class WRTNativeWindow : public electron::NativeWindow {
 
   int handler_id_;
   int rotation_handler_id_;
-  int rotation_;
   ScreenOrientation natural_orientation_;
   std::map<int, RotationHandler> handler_table_;
   std::string title_;