[Tizen] Add Component Application Structure 67/220367/2 submit/tizen_5.5/20191219.070549
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 18 Dec 2019 01:19:06 +0000 (10:19 +0900)
committerhuiyu eun <huiyu.eun@samsung.com>
Thu, 19 Dec 2019 06:52:36 +0000 (06:52 +0000)
This reverts commit c2396b46b8a4c64de2c678c5721561b7cce134fa.

Change-Id: I1cd12afe92867968cd245898ea7215aeed5e8f72

build/tizen/deps-check.cmake
dali/devel-api/adaptor-framework/component-application.h [new file with mode: 0644]
dali/devel-api/file.list
dali/internal/adaptor/common/framework.h
dali/internal/adaptor/file.list
dali/internal/adaptor/tizen-wayland/component-application-impl.cpp [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/component-application-impl.h [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/component-application.cpp [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/framework-tizen.cpp
packaging/dali-adaptor.spec

index fbea7f1..70db018 100644 (file)
@@ -93,6 +93,7 @@ CHECK_MODULE_AND_SET( CAPI_SYSTEM_INFO capi-system-info [] )
 CHECK_MODULE_AND_SET( CAPI_SYSTEM_SENSOR capi-system-sensor capi_system_sensor_support )
 CHECK_MODULE_AND_SET( CAPI_SYSTEM_SYSTEM_SETTINGS capi-system-system-settings [] )
 CHECK_MODULE_AND_SET( CAPI_APPFW_APPLICATION capi-appfw-application [] )
+CHECK_MODULE_AND_SET( COMPONENT_BASED_APPLICATION component-based-application [] )
 
 CHECK_MODULE_AND_SET( ELEMENTARY elementary [] )
 CHECK_MODULE_AND_SET( BUNDLE bundle [] )
@@ -348,6 +349,7 @@ IF( enable_appfw )
     ${CAPI_APPFW_WIDGET_BASE_CFLAGS}
     ${ECORE_IMF_CFLAGS}
     ${FRIBIDI_CFLAGS}
+    ${COMPONENT_BASED_APPLICATION_CFLAGS}
   )
 
   SET( DALI_LDFLAGS ${DALI_LDFLAGS}
@@ -362,6 +364,7 @@ IF( enable_appfw )
     ${CAPI_APPFW_WIDGET_BASE_LDFLAGS}
     ${ECORE_IMF_LDFLAGS}
     ${FRIBIDI_LDFLAGS}
+    ${COMPONENT_BASED_APPLICATION_LDFLAGS}
   )
 ELSE()
   SET( DALI_CFLAGS ${DALI_CFLAGS}
diff --git a/dali/devel-api/adaptor-framework/component-application.h b/dali/devel-api/adaptor-framework/component-application.h
new file mode 100644 (file)
index 0000000..1e72b02
--- /dev/null
@@ -0,0 +1,93 @@
+#ifndef DALI_COMPONENT_APPLICATION_H\r
+#define DALI_COMPONENT_APPLICATION_H\r
+\r
+/*\r
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+#ifdef COMPONENT_APPLICATION_SUPPORT\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/public-api/adaptor-framework/application.h>\r
+#include <component_based_app.h>\r
+namespace Dali\r
+{\r
+namespace Internal DALI_INTERNAL\r
+{\r
+\r
+namespace Adaptor\r
+{\r
+class ComponentApplication;\r
+}\r
+\r
+}\r
+\r
+class DALI_ADAPTOR_API ComponentApplication : public Application\r
+{\r
+\r
+public:\r
+  static ComponentApplication New( );\r
+  static ComponentApplication New( int* argc, char **argv[] );\r
+  static ComponentApplication New( int* argc, char **argv[], const std::string& stylesheet );\r
+\r
+  /**\r
+   * @brief The default constructor.\r
+   */\r
+  ComponentApplication();\r
+\r
+  /**\r
+   * @brief Copy Constructor.\r
+   *\r
+   * @param[in] componentApplication Handle to an object\r
+   */\r
+  ComponentApplication( const ComponentApplication& componentApplication );\r
+\r
+  /**\r
+   * @brief Assignment operator.\r
+   *\r
+   * @param[in] componentApplication Handle to an object\r
+   * @return A reference to this\r
+   */\r
+  ComponentApplication& operator=( const ComponentApplication& componentApplication );\r
+\r
+ /**\r
+   * @brief Destructor\r
+   */\r
+  ~ComponentApplication();\r
+\r
+ public:\r
+  typedef Signal< component_class_h (void* user_data) > CreateSignalType;\r
+\r
+  CreateSignalType& CreateSignal();\r
+\r
+public:\r
+  /// @cond internal\r
+  /**\r
+   * @brief Internal constructor.\r
+   */\r
+  explicit DALI_INTERNAL ComponentApplication(Internal::Adaptor::ComponentApplication* componentApplication);\r
+  /// @endcond\r
+};\r
+\r
+/**\r
+ * @}\r
+ */\r
+} // namespace Dali\r
+\r
+#endif\r
+\r
+#endif // DALI_COMPONENT_APPLICATION_H\r
+\r
index 062abc2..a59d2bd 100644 (file)
@@ -89,6 +89,7 @@ SET( devel_api_adaptor_framework_header_files
   ${adaptor_devel_api_dir}/adaptor-framework/key-devel.h
   ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.h
   ${adaptor_devel_api_dir}/adaptor-framework/window-devel.h
+  ${adaptor_devel_api_dir}/adaptor-framework/component-application.h
 )
 
 
index d95388c..9a4f268 100644 (file)
@@ -24,6 +24,9 @@
 #ifdef APPCORE_WATCH_AVAILABLE
 #include <dali/public-api/watch/watch-application.h>
 #endif
+#ifdef COMPONENT_APPLICATION_SUPPORT
+#include <component_based_app.h>
+#endif
 
 // INTERNAL INCLUDES
 #include <dali/internal/system/common/abort-handler.h>
@@ -54,7 +57,8 @@ public:
   {
     NORMAL,       ///< normal appFramework
     WATCH,        ///< watch appFramework
-    WIDGET        ///< widget appFramework
+    WIDGET,       ///< widget appFramework
+    COMPONENT     ///< component appFramework
   };
 
   /**
@@ -141,6 +145,13 @@ public:
      * Invoked when the platform surface is destroyed.
      */
     virtual void OnSurfaceDestroyed( Any newSurface ) {}
+
+#ifdef COMPONENT_APPLICATION_SUPPORT
+    /**
+    * Invoked when the component application is created.
+    */
+    virtual void* OnCreate(void *) { return NULL; }
+#endif
   };
 
 public:
@@ -293,6 +304,13 @@ private:
    */
   void InitThreads();
 
+#ifdef COMPONENT_APPLICATION_SUPPORT
+  /**
+   * Called when the component application is created.
+   */
+  component_class_h CreateComponent(void * data);
+#endif
+
 private:
   Observer&          mObserver;
   bool               mInitialised;
index 866f6d4..5ca9af6 100644 (file)
@@ -14,6 +14,8 @@ SET( adaptor_adaptor_common_src_files
 SET( adaptor_adaptor_tizen_wayland_src_files 
     ${adaptor_adaptor_dir}/tizen-wayland/adaptor-impl-tizen.cpp 
     ${adaptor_adaptor_dir}/tizen-wayland/framework-tizen.cpp
+    ${adaptor_adaptor_dir}/tizen-wayland/component-application.cpp
+    ${adaptor_adaptor_dir}/tizen-wayland/component-application-impl.cpp
 )
 
 # module: adaptor, backend: tizen-wearable
diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp b/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp
new file mode 100644 (file)
index 0000000..786a350
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifdef COMPONENT_APPLICATION_SUPPORT
+
+// CLASS HEADER
+#include <dali/internal/adaptor/tizen-wayland/component-application-impl.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/system/common/environment-variables.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+ComponentApplicationPtr ComponentApplication::New(
+  int* argc,
+  char **argv[],
+  const std::string& stylesheet,
+  Dali::Application::WINDOW_MODE windowMode)
+{
+  ComponentApplicationPtr application ( new ComponentApplication (argc, argv, stylesheet, windowMode ) );
+  return application;
+}
+
+ComponentApplication::ComponentApplication( int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode )
+: Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::COMPONENT)
+{
+}
+
+ComponentApplication::~ComponentApplication()
+{
+}
+
+component_class_h ComponentApplication::OnCreate(void* user_data)
+{
+  return mCreateSignal.Emit( user_data );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+#endif
diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.h b/dali/internal/adaptor/tizen-wayland/component-application-impl.h
new file mode 100644 (file)
index 0000000..6ede5a7
--- /dev/null
@@ -0,0 +1,92 @@
+#ifndef DALI_INTERNAL_COMPONENT_APPLICATION_H
+#define DALI_INTERNAL_COMPONENT_APPLICATION_H
+
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifdef COMPONENT_APPLICATION_SUPPORT
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/tizen-wayland/component-application-impl.h>
+#include <dali/devel-api/adaptor-framework/component-application.h>
+#include <dali/internal/adaptor/common/application-impl.h>
+
+namespace Dali
+{
+class Adaptor;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class ComponentApplication;
+typedef IntrusivePtr<ComponentApplication> ComponentApplicationPtr;
+
+class ComponentApplication : public Application
+{
+public:
+  typedef Dali::ComponentApplication::CreateSignalType CreateSignal;
+
+  static ComponentApplicationPtr New( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
+
+  ComponentApplication( int* argc, char **argv[], const std::string& stylesheet, WINDOW_MODE windowMode );
+
+  /**
+   * Destructor
+   */
+  virtual ~ComponentApplication();
+  virtual component_class_h OnCreate(void*user_data);
+
+private:
+
+  // @brief Undefined copy constructor.
+  ComponentApplication( const ComponentApplication& );
+
+  // @brief Undefined assignment operator.
+  ComponentApplication& operator=( const ComponentApplication& );
+
+public:
+  CreateSignal                           mCreateSignal;
+};
+
+inline ComponentApplication& GetImplementation(Dali::ComponentApplication& application)
+{
+  DALI_ASSERT_ALWAYS(application && "application handle is empty");
+
+  BaseObject& handle = application.GetBaseObject();
+
+  return static_cast<Internal::Adaptor::ComponentApplication&>(handle);
+}
+
+inline const ComponentApplication& GetImplementation(const Dali::ComponentApplication& application)
+{
+  DALI_ASSERT_ALWAYS(application && "Time handle is empty");
+
+  const BaseObject& handle = application.GetBaseObject();
+
+  return static_cast<const Internal::Adaptor::ComponentApplication&>(handle);
+}
+
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+#endif
+#endif // DALI_INTERNAL_COMPONENT_APPLICATION_H
diff --git a/dali/internal/adaptor/tizen-wayland/component-application.cpp b/dali/internal/adaptor/tizen-wayland/component-application.cpp
new file mode 100644 (file)
index 0000000..e9669b9
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifdef COMPONENT_APPLICATION_SUPPORT
+
+// CLASS HEADER
+#include <dali/devel-api/adaptor-framework/component-application.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/tizen-wayland/component-application-impl.h>
+
+namespace Dali
+{
+
+ComponentApplication ComponentApplication::New()
+{
+  return New( NULL, NULL );
+}
+
+ComponentApplication ComponentApplication::New( int* argc, char **argv[] )
+{
+  Internal::Adaptor::ComponentApplicationPtr internal = Internal::Adaptor::ComponentApplication::New( argc, argv, "", OPAQUE );
+  return ComponentApplication(internal.Get());
+}
+
+ComponentApplication ComponentApplication::New( int* argc, char **argv[], const std::string& stylesheet )
+{
+  Internal::Adaptor::ComponentApplicationPtr internal = Internal::Adaptor::ComponentApplication::New( argc, argv, stylesheet, OPAQUE );
+  return ComponentApplication(internal.Get());
+}
+
+ComponentApplication::~ComponentApplication()
+{
+}
+
+ComponentApplication::ComponentApplication()
+{
+}
+
+ComponentApplication::ComponentApplication(const ComponentApplication& implementation)
+: Application(implementation)
+{
+}
+
+ComponentApplication& ComponentApplication::operator=(const ComponentApplication& application)
+{
+  if( *this != application )
+  {
+    BaseHandle::operator=( application );
+  }
+  return *this;
+}
+
+ComponentApplication::CreateSignalType& ComponentApplication::CreateSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).mCreateSignal;
+}
+
+ComponentApplication::ComponentApplication(Internal::Adaptor::ComponentApplication* implementation)
+: Application(implementation)
+{
+}
+
+} // namespace Dali
+
+#endif
index c440eeb..edc79f1 100644 (file)
 #include <tzplatform_config.h>
 #endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
 
+#ifdef COMPONENT_APPLICATION_SUPPORT
+#include <component_based_app.h>
+#include <component_based_app_base.h>
+#endif
+
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
@@ -231,10 +236,16 @@ struct Framework::Impl
     {
       ret = AppWidgetMain();
     }
-    else
+    else if(mApplicationType == WATCH)
     {
       ret = AppWatchMain();
     }
+#ifdef COMPONENT_APPLICATION_SUPPORT
+    else
+    {
+      ret = AppComponentMain();
+    }
+#endif
     return ret;
   }
 
@@ -248,10 +259,16 @@ struct Framework::Impl
     {
       AppWidgetExit();
     }
-    else
+    else if(mApplicationType == WATCH)
     {
       AppWatchExit();
     }
+#ifdef COMPONENT_APPLICATION_SUPPORT
+    else
+    {
+      AppComponentExit();
+    }
+#endif
   }
 
   void SetLanguage( const std::string& language )
@@ -697,6 +714,57 @@ struct Framework::Impl
 #endif
   }
 
+#ifdef COMPONENT_APPLICATION_SUPPORT
+  int AppComponentMain()
+  {
+    int ret;
+
+    /*Crate component_based_app_base_lifecycle_callback*/
+    component_based_app_base_lifecycle_callback_s callback;
+    callback.init = AppInit;
+    callback.run = AppRun;
+    callback.exit = AppExit;
+    callback.create = AppComponentCreate;
+    callback.terminate = AppComponentTerminate;
+    callback.fini = AppComponentFinish;
+
+    ret = component_based_app_base_main(*mFramework->mArgc, *mFramework->mArgv, &callback, mFramework);
+
+    if (ret != TIZEN_ERROR_NONE)
+    return ret;
+
+    return TIZEN_ERROR_NONE;
+  }
+
+  static void* AppComponentCreate( void *data )
+  {
+    return static_cast<component_class_h>( static_cast<Framework*>(data)->CreateComponent(data) );
+  }
+
+  static void AppComponentTerminate( void *data )
+  {
+    Observer *observer = &static_cast<Framework*>(data)->mObserver;
+    observer->OnTerminate();
+  }
+
+  static void AppComponentFinish( void *data )
+  {
+    ecore_shutdown();
+
+    if(getenv("AUL_LOADER_INIT"))
+    {
+      unsetenv("AUL_LOADER_INIT");
+      ecore_shutdown();
+    }
+  }
+
+  void AppComponentExit()
+  {
+    component_based_app_base_exit();
+  }
+
+#endif
+
 private:
   // Undefined
   Impl( const Impl& impl );
@@ -884,6 +952,15 @@ std::string Framework::GetRegion() const
   return mImpl->GetRegion();
 }
 
+#ifdef COMPONENT_APPLICATION_SUPPORT
+component_class_h Framework::CreateComponent( void * data )
+{
+  mInitialised = true;
+  mObserver.OnInit();
+  return mObserver.OnCreate(data);
+}
+#endif
+
 } // namespace Adaptor
 
 } // namespace Internal
index f624a32..fe618c6 100644 (file)
@@ -83,7 +83,6 @@ BuildRequires:  pkgconfig(wayland-egl-tizen)
 %else
 BuildRequires:  pkgconfig(ecore-wayland)
 %endif
-
 # dali-adaptor needs tbm_surface in tizen 3.0 wayland
 BuildRequires:  pkgconfig(libtbm)
 
@@ -108,6 +107,10 @@ BuildRequires:  pkgconfig(capi-ui-autofill)
 BuildRequires:  pkgconfig(mm-sound)
 BuildRequires:  pkgconfig(feedback)
 
+%if 0%{?tizen_version_major} >= 5 && 0%{?tizen_version_minor} >= 5 || 0%{?tizen_version_major} >= 6
+BuildRequires:  pkgconfig(component-based-application)
+%endif
+
 # for multiprofile
 Requires:   %{name}-compat = %{version}-%{release}
 Recommends: %{name}-profile_common = %{version}-%{release}
@@ -276,6 +279,11 @@ cmake_flags+=" -DCMAKE_BUILD_TYPE=Debug"
 cmake_flags+=" -DENABLE_TRACE=ON"
 %endif
 
+%if 0%{?tizen_version_major} >= 5 && 0%{?tizen_version_minor} >= 5 || 0%{?tizen_version_major} >= 6
+CFLAGS+=" -DCOMPONENT_APPLICATION_SUPPORT"
+CXXFLAGS+=" -DCOMPONENT_APPLICATION_SUPPORT"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen