[compatibility] Implemented window resize for non circular apps 87/169287/9 accepted/tizen/4.0/unified/20180214.060236 submit/tizen_4.0/20180213.085105 submit/tizen_4.0/20180213.101128
authorGuneet K <g.khosla@samsung.com>
Thu, 1 Feb 2018 13:38:51 +0000 (19:08 +0530)
committerMallikarjun Voleti <vm.arjun@samsung.com>
Tue, 13 Feb 2018 04:53:14 +0000 (04:53 +0000)
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: I3b60cc73910b462becfa04e9112fe39f15203511
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 b25d347..d4e5c05 100755 (executable)
@@ -121,6 +121,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;
@@ -243,6 +248,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 aa910e2..4419123 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 009c6f7..20732f7 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 7845b2d..5cf9f35 100755 (executable)
@@ -78,9 +78,13 @@ NativeWindow::NativeWindow()
       progressbar_(NULL),
       top_layout_(NULL),
       rotation_(0),
-      handler_id_(0) {
+      handler_id_(0),
+      natural_orientation_(ScreenOrientation::PORTRAIT_PRIMARY),
+      display_shape_type_(Shape::STANDARD)
+      {
 }
 
+
 NativeWindow::~NativeWindow() {
   if (window_)
     evas_object_del(window_);
@@ -124,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 a305389..330edcf 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();
@@ -63,6 +67,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);
 
@@ -87,6 +93,7 @@ class NativeWindow {
   int rotation_;
   int handler_id_;
   ScreenOrientation natural_orientation_;
+  Shape display_shape_type_;
   std::map<int, RotationHandler> handler_table_;
 };
 
index 53317ae..a8c482a 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 7a6188f..9ea592b 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 39302ca..749e4f9 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 8838e50..0963b0f 100755 (executable)
@@ -539,6 +539,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());
@@ -1279,6 +1281,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 99e56d0..d85aa6e 100755 (executable)
@@ -120,6 +120,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 a48c190..c612e64 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 {
@@ -95,6 +90,41 @@ collections {
     }//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{
             part {
index 5b5d394..1a43272 100755 (executable)
@@ -72,7 +72,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'],