[compatibility] Implemented window resize for non circular apps 65/189665/1 accepted/tizen/unified/20180928.142127 submit/tizen/20180928.065515
authorGuneet K <g.khosla@samsung.com>
Thu, 1 Feb 2018 13:38:51 +0000 (19:08 +0530)
committerguneet khosla <g.khosla@samsung.com>
Wed, 19 Sep 2018 12:28:51 +0000 (17:58 +0530)
Apps with 320x320 and square apps are not displayed properly.
View is truncated.

Resize the view to 320x320 so that maximum
possible view is displayed in visible area.
These kind of apps are identified by profile
tag.
              ---------------------------------------------
              | SlNo|  Profile     | Value    |  Display  |
              ---------------------------------------------
              |  1  | Not Present  | NA       |  320x320  |
              |  2  |  Present     | mobile   |  320x320  |
              |  3  |  Present     | NULL     |  320x320  |
              |  4  |  Present     | wearable |  360x360  |
              ---------------------------------------------

[Reference] http://slp-info.sec.samsung.net/gerrit/#/c/3119525/

Change-Id: Id39ce8f39c939de083e1ae2a7bc9efcaae8ca39a
Signed-off-by: Guneet K <g.khosla@samsung.com>
Signed-off-by: deepti <d.saraswat@samsung.com>
12 files changed:
common/application_data.cc
common/application_data.h
common/platform_info.h
runtime/browser/native_window.cc
runtime/browser/native_window.h
runtime/browser/preload_manager.cc
runtime/browser/ui_runtime.cc
runtime/browser/watch_runtime.cc
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/resources/xwalk_tizen.edc
runtime/runtime.gyp

index a205ecc4487a33407cda5319b5496fa26527d8eb..cbcd2ad15f9a941a9d263820c2cff5ba2ef3c9af 100755 (executable)
@@ -122,6 +122,11 @@ std::shared_ptr<const wgt::parse::CSPInfo>
   return csp_report_info_;
 }
 
+std::shared_ptr<const wgt::parse::ProfileTagInfo>
+    ApplicationData::profile_tag_info() const {
+  return profile_tag_info_;
+}
+
 const std::string ApplicationData::pkg_id() const {
   if (pkg_id_.empty()) {
     app_info_h app_info;
@@ -244,6 +249,11 @@ bool ApplicationData::LoadManifestData() {
       widget_config_parser->GetManifestData(
           wgt::parse::CSPInfo::Report_only_key()));
 
+  profile_tag_info_ =
+    std::static_pointer_cast<const wgt::parse::ProfileTagInfo>(
+      widget_config_parser->GetManifestData(
+          wgt::parse::ProfileTagInfo::Key()));
+
   // Set default empty object
   if (widget_info_.get() == NULL) {
     widget_info_.reset(new wgt::parse::WidgetInfo);
index aa910e21f5d522377b6162e8a9ed09d797898c6c..441912329d3c343fb4e30e6c3205894e6a878339 100755 (executable)
@@ -28,6 +28,7 @@
 #include <wgt_manifest_handlers/metadata_handler.h>
 #include <wgt_manifest_handlers/navigation_handler.h>
 #include <wgt_manifest_handlers/permissions_handler.h>
+#include <wgt_manifest_handlers/profile_tag_handler.h>
 #include <wgt_manifest_handlers/service_handler.h>
 #include <wgt_manifest_handlers/setting_handler.h>
 #include <wgt_manifest_handlers/tizen_application_handler.h>
@@ -78,6 +79,8 @@ class ApplicationData {
     csp_info() const;
   std::shared_ptr<const wgt::parse::CSPInfo>
     csp_report_info() const;
+  std::shared_ptr<const wgt::parse::ProfileTagInfo>
+    profile_tag_info() const;
 
   const std::string application_path() const { return application_path_; }
   const std::string pkg_id() const;
@@ -111,6 +114,10 @@ class ApplicationData {
     csp_info_;
   std::shared_ptr<const wgt::parse::CSPInfo>
     csp_report_info_;
+
+  std::shared_ptr<const wgt::parse::ProfileTagInfo>
+    profile_tag_info_;
+
   ApplicationData::AppType GetAppType();
 
   std::string application_path_;
index 009c6f7fc5fcefb7061504e58cbd92c7d35daf62..20732f77fff25b635ed45e751a23ae5d88fa7084 100644 (file)
@@ -38,6 +38,8 @@ enum _profile {
        (common::getProfile() & ((common::kPROFILE_WEARABLE)))
 #define TIZEN_FEATURE_rotary_event_support     \
        (common::getProfile() & ((common::kPROFILE_WEARABLE)))
+#define TIZEN_FEATURE_display_resize_support \
+  (common::getProfile() & ((common::kPROFILE_WEARABLE)))
 
 extern enum _profile getProfile(void);
 
index 5bbbc4ddb52db4adfe28488682b6018b2a3d9980..7ca946e7cef5295fa38aa0f10668a569a7ec7d94 100755 (executable)
@@ -80,9 +80,11 @@ NativeWindow::NativeWindow()
       top_layout_(NULL),
       rotation_(0),
       handler_id_(0),
-      natural_orientation_(ScreenOrientation::LANDSCAPE_PRIMARY) {
+      natural_orientation_(ScreenOrientation::PORTRAIT_PRIMARY),
+      display_shape_type_(Shape::STANDARD){
 }
 
+
 NativeWindow::~NativeWindow() {
   if (window_)
     evas_object_del(window_);
@@ -126,7 +128,14 @@ void NativeWindow::Initialize() {
 
   // top layout
   Evas_Object* top_layout = elm_layout_add(conformant);
-  elm_layout_file_set(top_layout, kEdjePath, "web-application");
+  if (display_shape_type_ == Shape::SQUARE) {
+    LOGGER(DEBUG) << "Device shape square";
+    elm_layout_file_set(top_layout, kEdjePath, "web-applicationsview");
+  } else {
+    LOGGER(DEBUG) << "Device shape standard";
+    elm_layout_file_set(top_layout, kEdjePath, "web-application");
+  }
+
   EVAS_SIZE_EXPAND_FILL(top_layout);
   elm_object_content_set(conformant, top_layout);
   evas_object_show(top_layout);
index 3cd094d2b31239be71fc7db2b95941412d754941..981f2d5de8ee66703020741c38bab4f366349c53 100755 (executable)
@@ -38,6 +38,10 @@ class NativeWindow {
     NORMAL = 0,
     NOTIFICATION = 1
   };
+  enum class Shape {
+    STANDARD = 0,
+    SQUARE = 1
+  };
   typedef std::function<void(int)> RotationHandler;
   NativeWindow();
   virtual ~NativeWindow();
@@ -65,6 +69,8 @@ class NativeWindow {
   Type type() const { return window_type_;}
   void EnableManualRotation(bool enable);
   void ManualRotationDone();
+  void SetDisplayShape(Shape disp_shape) { display_shape_type_ = disp_shape; }
+  Shape GetDisplayShape() { return display_shape_type_; }
   void SignalEmit(const char* emission, const char* source);
   void UpdateProgress(double value);
 
@@ -89,6 +95,7 @@ class NativeWindow {
   int rotation_;
   int handler_id_;
   ScreenOrientation natural_orientation_;
+  Shape display_shape_type_;
   std::map<int, RotationHandler> handler_table_;
 };
 
index fe1cce7ca21259a5da65cb5c8df58951bb4cfa0a..a8c482a2f99d9d401ef486050e16227ec01e0a57 100755 (executable)
@@ -21,6 +21,7 @@
 #include <EWebKit_internal.h>
 #include <stdio.h>
 
+#include "common/platform_info.h"
 #include "common/logger.h"
 #include "runtime/browser/native_app_window.h"
 #include "extensions/common/xwalk_extension_server.h"
@@ -49,7 +50,8 @@ void PreloadManager::CreateCacheComponet() {
       ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH);
   context = context;  // To prevent build warning
   cached_window_.reset(new NativeAppWindow());
-  //cached_window_->Initialize();
+  if (!TIZEN_FEATURE_display_resize_support)
+    cached_window_->Initialize();
 }
 
 NativeWindow* PreloadManager::GetCachedNativeWindow() {
index bb0e11ae668b46a66d716763ea045aa2c1f0098d..45a465a143e29ffbc7c8740f003fd0fd5de95eb0 100755 (executable)
@@ -27,6 +27,7 @@
 #include "common/app_db.h"
 #include "common/command_line.h"
 #include "common/logger.h"
+#include "common/platform_info.h"
 #include "common/profiler.h"
 #include "runtime/common/constants.h"
 #include "runtime/browser/native_app_window.h"
@@ -40,9 +41,9 @@ namespace {
 
 const char kCategoryAlwaysOnTop[] = "http://tizen.org/category/always_on_top";
 
-static NativeWindow* CreateNativeWindow(NativeWindow::Type windowType) {
+static NativeWindow* CreateNativeWindow(NativeWindow::Type windowType,
+                                       NativeWindow::Shape win_shape) {
   SCOPE_PROFILE();
-
   NativeWindow* window;
 
   switch (windowType) {
@@ -58,6 +59,7 @@ static NativeWindow* CreateNativeWindow(NativeWindow::Type windowType) {
     }
     break;
   }
+  window->SetDisplayShape(win_shape);
 
   window->Initialize();
   return window;
@@ -76,6 +78,19 @@ bool AlwaysTopRequested(common::AppControl* appcontrol) {
   return appcontrol->data("always_on_top") == "true";
 }
 
+const char kConfigProfile[] = "mobile";
+NativeWindow::Shape GetWindowType(common::ApplicationData* app_data) {
+  // As profile tag is not present app will be treated as square app
+  if (!app_data->profile_tag_info()) {
+    return NativeWindow::Shape::SQUARE;
+  }
+  std::string type = app_data->profile_tag_info()->GetProfileType();
+  if (!type.compare(kConfigProfile)) {
+    return NativeWindow::Shape::SQUARE;
+  }
+  return NativeWindow::Shape::STANDARD;
+}
+
 }  // namespace
 
 UiRuntime::UiRuntime(common::ApplicationData* app_data)
@@ -100,8 +115,9 @@ void UiRuntime::ResetWebApplication(NativeWindow::Type windowType) {
 
   application_.reset();
   native_window_.reset();
-
-  native_window_.reset(CreateNativeWindow(windowType));
+  if (TIZEN_FEATURE_display_resize_support)
+    native_window_.reset(CreateNativeWindow(windowType, GetWindowType(app_data_)));
+  else native_window_.reset(CreateNativeWindow(windowType, NativeWindow::Shape::STANDARD));
   LOGGER(DEBUG) << "runtime.cc Created native window";
   application_.reset(new WebApplication(native_window_.get(),
                                         app_data_,
index 39302ca4108a40fd026065905bd75e1f441a95cc..749e4f90f77d416285416523d454775285f486b7 100755 (executable)
@@ -35,7 +35,7 @@ namespace runtime {
 
 namespace {
 
-static NativeWindow* CreateNativeWindow() {
+static NativeWindow* CreateNativeWindow(NativeWindow::Shape win_shape) {
   SCOPE_PROFILE();
   NativeWindow* window = NULL;
   auto cached = PreloadManager::GetInstance()->GetCachedNativeWindow();
@@ -43,11 +43,25 @@ static NativeWindow* CreateNativeWindow() {
     delete cached;
   }
   window = new NativeWatchWindow();
+  window->SetDisplayShape(win_shape);
   window->Initialize();
 
   return window;
 }
 
+const char kConfigProfile[] = "mobile";
+NativeWindow::Shape GetWindowType(common::ApplicationData* app_data) {
+  // As profile tag is not present app will be treated as square app
+  if (!app_data->profile_tag_info()) {
+    return NativeWindow::Shape::SQUARE;
+  }
+  std::string type = app_data->profile_tag_info()->GetProfileType();
+  if (!type.compare(kConfigProfile)) {
+    return NativeWindow::Shape::SQUARE;
+  }
+  return NativeWindow::Shape::STANDARD;
+}
+
 }  // namespace
 
 WatchRuntime::WatchRuntime(common::ApplicationData* app_data)
@@ -85,7 +99,7 @@ bool WatchRuntime::OnCreate() {
   appdb->Remove(kAppDBRuntimeSection, kAppDBRuntimeBundle);
 
   // Init WebApplication
-  native_window_ = CreateNativeWindow();
+  native_window_ = CreateNativeWindow(GetWindowType(app_data_));
   STEP_PROFILE_START("WebApplication Create");
   application_ = new WebApplication(native_window_, app_data_);
   STEP_PROFILE_END("WebApplication Create");
index c74d4be47ef9232869a5f1cdeaab8c4124e7ec85..c5f0c0adb145d6d7da229b2453722919b3f00144 100755 (executable)
@@ -515,6 +515,8 @@ void WebApplication::Launch(std::unique_ptr<common::AppControl> appcontrol) {
   WebView* view = new WebView(window_, ewk_context_);
   SetupWebView(view);
   SetupWebViewCompatibilitySettings(view);
+  if (TIZEN_FEATURE_display_resize_support)
+    SetDisplayEffect(view);
 
   std::unique_ptr<common::ResourceManager::Resource> res =
       resource_manager_->GetStartResource(appcontrol.get());
@@ -1273,6 +1275,16 @@ void WebApplication::SetupWebViewCompatibilitySettings(WebView* view) {
   }
 }
 
+void WebApplication::SetDisplayEffect(WebView* view) {
+  if (window_->GetDisplayShape() == NativeWindow::Shape::SQUARE) {
+    // Currently blur effect API is called on view, which is not
+    // correct. Needs to be moved to context. Once new API is
+    // provided on context below code will get changed.
+    LOGGER(DEBUG) << "WebApplication::Set Blur effect";
+    ewk_view_mirrored_blur_set(view->evas_object(), true);
+  }
+}
+
 bool WebApplication::OnDidNavigation(WebView* /*view*/,
                                      const std::string& url) {
   // scheme handling
index a724a09026f040e87ffe62204148eebbc2fadd85..5b247b22baf3fc7c0da03d0b965d08550426d657 100755 (executable)
@@ -125,6 +125,7 @@ class WebApplication : public WebView::EventListener {
   void LaunchInspector(common::AppControl* appcontrol);
   void SetupWebView(WebView* view);
   void SetupWebViewCompatibilitySettings(WebView* view);
+  void SetDisplayEffect(WebView* view);
   void RemoveWebViewFromStack(WebView* view);
 
   void SetupTizenVersion();
index a48c190a0b5004b57e0ba56de933b3c09a323116..c612e642a1ec4d4f90f094cf3a218a2fe60d173d 100755 (executable)
@@ -25,11 +25,6 @@ collections {
                 type: SWALLOW;
                 description {
                     state: "default" 0.0;
-                    fixed: 1 1;
-                    rel1 { relative: 0.0 0.0; to: base; }
-                    rel2 { relative: 1.0 1.0; to: base; }
-                    align: 0.0 0.0;
-
                 }
                 /* ratio 1x1 (only for gear3) */
                 description {
@@ -94,6 +89,41 @@ collections {
         }//end of programs
     }//end of group
 
+    group {
+        name: "web-applicationsview";
+        inherit: "web-application";
+        parts{
+            part {
+                name: "elm.swallow.content";
+                scale: 0;
+                type: SWALLOW;
+                description {
+                    state: "default" 0.0;
+                    //rel1 { offset: 20 20; }
+                    //rel2 { offset: -20 -20; }
+                    min: 320 320;
+                    max: 320 320;
+                    fixed: 1 1;
+                }
+                // Below code will also do the same
+                /*description {
+                    state: "default" 0.0;
+                    rel1 { offset: 20 20; }
+                    rel2 { offset: -20 -20; }
+                }*/
+
+                /* ratio 1x1 (only for gear3) */
+                description {
+                    state: "ratio1x1" 0.0;
+                    fixed: 1 1;
+                    aspect: 1 1;
+                    aspect_preference: BOTH;
+                    align: 0.5 0.5;
+                }
+            }
+        }
+    }
+
     group {
         name: "PopupTextEntrySet";
         parts{
index 5772a354b0f31c205f6c7846bc0778183e67e256..e56deee0f60b9c39e5c47e25309b1e2402ddfdaa 100755 (executable)
@@ -70,7 +70,8 @@
           'defines': ['TIZEN_PRODUCT_TV'],
         }],
         ['tizen_model_formfactor == "circle"', {
-          'defines': ['MODEL_FORMFACTOR_CIRCLE'],
+          'defines': ['MODEL_FORMFACTOR_CIRCLE',
+                      'DISPLAY_RESIZE_SUPPORT'],
         }],
         ['tizen_feature_rotary_event_support == 1', {
           'defines': ['ROTARY_EVENT_FEATURE_SUPPORT'],