Framework refactoring 87/294687/13
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 23 Jun 2023 07:36:47 +0000 (16:36 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 29 Jun 2023 08:06:53 +0000 (17:06 +0900)
Change-Id: I047e92153a9ff3aa320512e3d86a54e8265e951c

53 files changed:
dali/internal/adaptor/android/android-framework-impl.h
dali/internal/adaptor/android/framework-android-interface.h [new file with mode: 0644]
dali/internal/adaptor/android/framework-android.cpp
dali/internal/adaptor/android/framework-android.h [new file with mode: 0644]
dali/internal/adaptor/android/framework-factory-android.cpp [new file with mode: 0644]
dali/internal/adaptor/android/framework-factory-android.h [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-androidjni.cpp
dali/internal/adaptor/androidjni/framework-androidjni.h [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp [new file with mode: 0644]
dali/internal/adaptor/androidjni/framework-factory-androidjni.h [new file with mode: 0644]
dali/internal/adaptor/common/application-impl.cpp
dali/internal/adaptor/common/application-impl.h
dali/internal/adaptor/common/framework-factory.h [new file with mode: 0644]
dali/internal/adaptor/common/framework.cpp [new file with mode: 0644]
dali/internal/adaptor/common/framework.h
dali/internal/adaptor/file.list
dali/internal/adaptor/glib/framework-factory-glib.cpp [new file with mode: 0644]
dali/internal/adaptor/glib/framework-factory-glib.h [new file with mode: 0644]
dali/internal/adaptor/glib/framework-glib.cpp
dali/internal/adaptor/glib/framework-glib.h [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-factory-libuv.cpp [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-factory-libuv.h [new file with mode: 0644]
dali/internal/adaptor/libuv/framework-libuv.cpp
dali/internal/adaptor/libuv/framework-libuv.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-factory-mac.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-factory-mac.mm [new file with mode: 0644]
dali/internal/adaptor/macos/framework-mac.h [new file with mode: 0644]
dali/internal/adaptor/macos/framework-mac.mm
dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h [new file with mode: 0644]
dali/internal/adaptor/tizen-wayland/framework-tizen.cpp
dali/internal/adaptor/tizen-wayland/framework-tizen.h [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h [new file with mode: 0644]
dali/internal/adaptor/ubuntu/framework-ubuntu.cpp
dali/internal/adaptor/ubuntu/framework-ubuntu.h [new file with mode: 0644]
dali/internal/adaptor/windows/framework-factory-win.cpp [new file with mode: 0644]
dali/internal/adaptor/windows/framework-factory-win.h [new file with mode: 0644]
dali/internal/adaptor/windows/framework-win.cpp
dali/internal/adaptor/windows/framework-win.h [new file with mode: 0644]
dali/internal/system/android/system-settings-android.cpp
dali/internal/system/common/system-settings.h
dali/internal/system/file.list
dali/internal/system/glib/callback-manager-glib.cpp
dali/internal/system/macos/system-settings-mac.cpp [new file with mode: 0644]
dali/internal/system/tizen-wayland/system-settings-tizen.cpp
dali/internal/system/ubuntu-x11/system-settings-x.cpp
dali/internal/system/windows/system-settings-win.cpp
third-party/file.list
third-party/macos-platform/environment.cpp [deleted file]
third-party/macos-platform/extern-definitions.h
third-party/windows-platform/environment.cpp [deleted file]
third-party/windows-platform/extern-definitions.h

index 8dae6be..a925eca 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_ANDROID_FRAMEWORK_IMPL_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -22,7 +22,7 @@
 #include <dali/integration-api/adaptor-framework/android/android-framework.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/android/framework-android.h>
 
 namespace Dali
 {
@@ -154,7 +154,7 @@ public:
   /**
    * @brief Sets an internal framework.
    */
-  void SetFramework(Framework* framework)
+  void SetFramework(FrameworkAndroidInterface* framework)
   {
     mFramework = framework;
   }
@@ -164,7 +164,7 @@ public:
    *
    * @return a pointer to the internal framework
    */
-  Framework* GetFramework()
+  FrameworkAndroidInterface* GetFramework()
   {
     return mFramework;
   }
@@ -183,7 +183,7 @@ public:
 private:
   AndroidFramework(Dali::Integration::AndroidFramework* androidFramework);
   Dali::Integration::AndroidFramework* mAndroidFramework;
-  Framework*                           mFramework;
+  FrameworkAndroidInterface*           mFramework;
 
   android_app*    mNativeApplication;
   ANativeWindow*  mWindow;
@@ -197,7 +197,7 @@ public:
   {
     return *androidFramework.mImpl;
   }
-  static Framework& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
+  static FrameworkAndroidInterface& GetFramework(Dali::Integration::AndroidFramework& androidFramework)
   {
     return *androidFramework.mImpl->mFramework;
   }
diff --git a/dali/internal/adaptor/android/framework-android-interface.h b/dali/internal/adaptor/android/framework-android-interface.h
new file mode 100644 (file)
index 0000000..3e9b31f
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroid interface class
+ */
+class FrameworkAndroidInterface
+{
+public:
+  /**
+   * Called by the App framework when an application lifecycle event occurs.
+   * @param[in] type The type of event occurred.
+   * @param[in] data The data of event occurred.
+   */
+  virtual bool AppStatusHandler(int type, void* data) = 0;
+
+  /**
+   * Called by the adaptor when an idle callback is added.
+   * @param[in] timeout The timeout of the callback.
+   * @param[in] data The data of of the callback.
+   * @param[in] callback The callback.
+   * @return The callback id.
+   */
+  virtual unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) = 0;
+
+  /**
+   * Called by the adaptor when an idle callback is removed.
+   * @param[in] id The callback id.
+   */
+  virtual void RemoveIdle(unsigned int id) = 0;
+
+protected:
+  /**
+   * Destructor
+   */
+  virtual ~FrameworkAndroidInterface() = default;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_INTERFACE_H
index 8151ba8..c0ccb13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * 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.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/android/framework-android.h>
 
 // EXTERNAL INCLUDES
 #include <android_native_app_glue.h>
@@ -35,7 +34,6 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/android/android-framework-impl.h>
-#include <dali/internal/system/common/callback-manager.h>
 
 namespace Dali
 {
@@ -110,7 +108,7 @@ void RemoveAllConstraints(const Dali::WindowContainer& windows)
 /**
  * Impl to hide android data members
  */
-struct Framework::Impl
+struct FrameworkAndroid::Impl
 {
   struct IdleCallback
   {
@@ -142,12 +140,8 @@ struct Framework::Impl
 
   // Constructor
 
-  Impl(Framework* framework)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED"),
-    mFinishRequested(false),
+  Impl(FrameworkAndroid* framework)
+  : mFinishRequested(false),
     mIdleId(0),
     mIdleReadPipe(-1),
     mIdleWritePipe(-1)
@@ -159,25 +153,6 @@ struct Framework::Impl
   ~Impl()
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(nullptr);
-
-    delete mAbortCallBack;
-    mAbortCallBack = nullptr;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-    mCallbackManager = nullptr;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
   }
 
   void OnIdle()
@@ -271,11 +246,7 @@ struct Framework::Impl
   }
 
   // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
-  bool             mFinishRequested;
+  bool mFinishRequested;
 
   int                               mIdleReadPipe;
   int                               mIdleWritePipe;
@@ -288,7 +259,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_INIT_WINDOW event is processed.
    */
-  static void NativeWindowCreated(Framework* framework, ANativeWindow* window)
+  static void NativeWindowCreated(FrameworkAndroid* framework, ANativeWindow* window)
   {
     if(framework)
     {
@@ -299,7 +270,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_DESTROY event is processed.
    */
-  static void NativeWindowDestroyed(Framework* framework, ANativeWindow* window)
+  static void NativeWindowDestroyed(FrameworkAndroid* framework, ANativeWindow* window)
   {
     if(framework)
     {
@@ -310,7 +281,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_INIT_WINDOW event is processed.
    */
-  static void NativeAppPaused(Framework* framework)
+  static void NativeAppPaused(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -321,7 +292,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_TERM_WINDOW event is processed.
    */
-  static void NativeAppResumed(Framework* framework)
+  static void NativeAppResumed(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -332,7 +303,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application input touch event is processed.
    */
-  static void NativeAppTouchEvent(Framework* framework, Dali::TouchPoint& touchPoint, int64_t timeStamp)
+  static void NativeAppTouchEvent(FrameworkAndroid* framework, Dali::TouchPoint& touchPoint, int64_t timeStamp)
   {
     Dali::Adaptor::Get().FeedTouchPoint(touchPoint, timeStamp);
   }
@@ -340,7 +311,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application input key event is processed.
    */
-  static void NativeAppKeyEvent(Framework* framework, Dali::KeyEvent& keyEvent)
+  static void NativeAppKeyEvent(FrameworkAndroid* framework, Dali::KeyEvent& keyEvent)
   {
     Dali::Adaptor::Get().FeedKeyEvent(keyEvent);
   }
@@ -348,7 +319,7 @@ struct Framework::Impl
   /**
    * Called by the native activity loop when the application APP_CMD_DESTROY event is processed.
    */
-  static void NativeAppDestroyed(Framework* framework)
+  static void NativeAppDestroyed(FrameworkAndroid* framework)
   {
     if(framework)
     {
@@ -373,7 +344,7 @@ struct Framework::Impl
 
   static void HandleAppCmd(struct android_app* app, int32_t cmd)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
     switch(cmd)
     {
       case APP_CMD_SAVE_STATE:
@@ -389,29 +360,29 @@ struct Framework::Impl
       case APP_CMD_INIT_WINDOW:
         // The window is being shown, get it ready.
         AndroidFramework::Get().SetApplicationWindow(app->window);
-        Dali::Internal::Adaptor::Framework::Impl::NativeWindowCreated(framework, app->window);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppResumed(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeWindowCreated(framework, app->window);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppResumed(framework);
         break;
       case APP_CMD_TERM_WINDOW:
         // The window is being hidden or closed, clean it up.
         AndroidFramework::Get().SetApplicationWindow(nullptr);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppPaused(framework);
-        Dali::Internal::Adaptor::Framework::Impl::NativeWindowDestroyed(framework, app->window);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppPaused(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeWindowDestroyed(framework, app->window);
         break;
       case APP_CMD_GAINED_FOCUS:
         break;
       case APP_CMD_LOST_FOCUS:
         break;
       case APP_CMD_DESTROY:
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppPaused(framework);
-        Dali::Internal::Adaptor::Framework::Impl::NativeAppDestroyed(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppPaused(framework);
+        Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppDestroyed(framework);
         break;
     }
   }
 
   static int32_t HandleAppInput(struct android_app* app, AInputEvent* event)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
 
     if(AInputEvent_getType(event) == AINPUT_EVENT_TYPE_MOTION)
     {
@@ -441,7 +412,7 @@ struct Framework::Impl
       }
 
       Dali::TouchPoint point(deviceId, state, x, y);
-      Dali::Internal::Adaptor::Framework::Impl::NativeAppTouchEvent(framework, point, timeStamp);
+      Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppTouchEvent(framework, point, timeStamp);
       return 1;
     }
     else if(AInputEvent_getType(event) == AINPUT_EVENT_TYPE_KEY)
@@ -471,7 +442,7 @@ struct Framework::Impl
           break;
       }
       Dali::KeyEvent keyEvent = Dali::DevelKeyEvent::New(keyName, "", "", keyCode, 0, timeStamp, state, "", "", Device::Class::NONE, Device::Subclass::NONE);
-      Dali::Internal::Adaptor::Framework::Impl::NativeAppKeyEvent(framework, keyEvent);
+      Dali::Internal::Adaptor::FrameworkAndroid::Impl::NativeAppKeyEvent(framework, keyEvent);
       return 1;
     }
 
@@ -480,7 +451,7 @@ struct Framework::Impl
 
   static void HandleAppIdle(struct android_app* app, struct android_poll_source* source)
   {
-    Framework* framework = AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework();
+    FrameworkAndroid* framework = static_cast<FrameworkAndroid*>(AndroidFramework::GetImplementation(AndroidFramework::Get()).GetFramework());
     if(framework && framework->mImpl)
     {
       framework->mImpl->OnIdle();
@@ -488,23 +459,15 @@ struct Framework::Impl
   }
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkAndroid::FrameworkAndroid(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkAndroid::~FrameworkAndroid()
 {
   if(mRunning)
   {
@@ -515,11 +478,11 @@ Framework::~Framework()
   mImpl = nullptr;
 }
 
-void Framework::Run()
+void FrameworkAndroid::Run()
 {
   struct android_app* app = AndroidFramework::Get().GetNativeApplication();
-  app->onAppCmd           = Framework::Impl::HandleAppCmd;
-  app->onInputEvent       = Framework::Impl::HandleAppInput;
+  app->onAppCmd           = FrameworkAndroid::Impl::HandleAppCmd;
+  app->onInputEvent       = FrameworkAndroid::Impl::HandleAppInput;
 
   struct android_poll_source* source;
   struct android_poll_source  idlePollSource;
@@ -606,7 +569,7 @@ void Framework::Run()
   mRunning = false;
 }
 
-unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void* data))
+unsigned int FrameworkAndroid::AddIdle(int timeout, void* data, bool (*callback)(void* data))
 {
   if(mImpl)
   {
@@ -615,7 +578,8 @@ unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void*
 
   return 0;
 }
-void Framework::RemoveIdle(unsigned int id)
+
+void FrameworkAndroid::RemoveIdle(unsigned int id)
 {
   if(mImpl)
   {
@@ -623,7 +587,7 @@ void Framework::RemoveIdle(unsigned int id)
   }
 }
 
-void Framework::Quit()
+void FrameworkAndroid::Quit()
 {
   struct android_app* app = AndroidFramework::Get().GetNativeApplication();
   if(app && !app->destroyRequested && !mImpl->mFinishRequested)
@@ -633,60 +597,7 @@ void Framework::Quit()
   }
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  return DALI_DATA_RO_DIR;
-}
-
-std::string Framework::GetDataPath()
-{
-  return "";
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* data)
+bool FrameworkAndroid::AppStatusHandler(int type, void* data)
 {
   Dali::Adaptor* adaptor = nullptr;
   switch(type)
@@ -757,20 +668,6 @@ bool Framework::AppStatusHandler(int type, void* data)
   return true;
 }
 
-void Framework::InitThreads()
-{
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->GetLanguage();
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->GetRegion();
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/android/framework-android.h b/dali/internal/adaptor/android/framework-android.h
new file mode 100644 (file)
index 0000000..d6596fb
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/android/framework-android-interface.h>
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroid class provides an Framework Android implementation.
+ */
+class FrameworkAndroid : public Framework, public FrameworkAndroidInterface
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkAndroid(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkAndroid();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AppStatusHandler()
+   */
+  bool AppStatusHandler(int type, void* data) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AddIdle()
+   */
+  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::RemoveIdle()
+   */
+  void RemoveIdle(unsigned int id) override;
+
+private:
+  // Undefined
+  FrameworkAndroid(const FrameworkAndroid&);
+  FrameworkAndroid& operator=(FrameworkAndroid&);
+
+private:
+  bool mInitialised;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_H
diff --git a/dali/internal/adaptor/android/framework-factory-android.cpp b/dali/internal/adaptor/android/framework-factory-android.cpp
new file mode 100644 (file)
index 0000000..baec498
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/android/framework-factory-android.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/android/framework-android.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryAndroid::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkAndroid>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryAndroid>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/android/framework-factory-android.h b/dali/internal/adaptor/android/framework-factory-android.h
new file mode 100644 (file)
index 0000000..99b4caa
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryAndroid : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROID_FRAMEWORK_FACTORY_H
index 649d281..d699f76 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * 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.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/androidjni/framework-androidjni.h>
 
 // EXTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/application-devel.h>
@@ -28,7 +27,6 @@
 // INTERNAL INCLUDES
 #include <dali/internal/adaptor/android/android-framework-impl.h>
 #include <dali/internal/adaptor/common/application-impl.h>
-#include <dali/internal/system/common/callback-manager.h>
 
 using namespace Dali;
 
@@ -41,15 +39,11 @@ namespace Adaptor
 /**
  * Impl to hide android data members
  */
-struct Framework::Impl
+struct FrameworkAndroidJni::Impl
 {
   // Constructor
 
-  Impl(Framework* framework)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
+  Impl(FrameworkAndroidJni* framework)
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(framework);
   }
@@ -57,50 +51,18 @@ struct Framework::Impl
   ~Impl()
   {
     AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(nullptr);
-
-    delete mAbortCallBack;
-    mAbortCallBack = nullptr;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-    mCallbackManager = nullptr;
   }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
-  }
-
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkAndroidJni::FrameworkAndroidJni(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkAndroidJni::~FrameworkAndroidJni()
 {
   if(mRunning)
   {
@@ -111,13 +73,13 @@ Framework::~Framework()
   mImpl = nullptr;
 }
 
-void Framework::Run()
+void FrameworkAndroidJni::Run()
 {
   AndroidFramework::GetImplementation(AndroidFramework::Get()).SetFramework(this);
   mRunning = true;
 }
 
-unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void* data))
+unsigned int FrameworkAndroidJni::AddIdle(int timeout, void* data, bool (*callback)(void* data))
 {
   JNIEnv* env    = nullptr;
   JavaVM* javaVM = AndroidFramework::Get().GetJVM();
@@ -145,7 +107,7 @@ unsigned int Framework::AddIdle(int timeout, void* data, bool (*callback)(void*
   return static_cast<unsigned int>(id);
 }
 
-void Framework::RemoveIdle(unsigned int id)
+void FrameworkAndroidJni::RemoveIdle(unsigned int id)
 {
   JNIEnv* env    = nullptr;
   JavaVM* javaVM = AndroidFramework::Get().GetJVM();
@@ -172,65 +134,12 @@ void Framework::RemoveIdle(unsigned int id)
   env->CallStaticVoidMethod(clazz, removeIdle, static_cast<jint>(id));
 }
 
-void Framework::Quit()
+void FrameworkAndroidJni::Quit()
 {
   DALI_LOG_ERROR("Quit does nothing for DaliView!");
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  return DALI_DATA_RO_DIR;
-}
-
-std::string Framework::GetDataPath()
-{
-  return "";
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* data)
+bool FrameworkAndroidJni::AppStatusHandler(int type, void* data)
 {
   Dali::Adaptor* adaptor = nullptr;
   switch(type)
@@ -272,7 +181,6 @@ bool Framework::AppStatusHandler(int type, void* data)
     case APP_DESTROYED:
       mObserver.OnTerminate();
       mRunning     = false;
-      mPaused      = false;
       mInitialised = false;
       break;
 
@@ -283,20 +191,6 @@ bool Framework::AppStatusHandler(int type, void* data)
   return true;
 }
 
-void Framework::InitThreads()
-{
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->GetLanguage();
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->GetRegion();
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/androidjni/framework-androidjni.h b/dali/internal/adaptor/androidjni/framework-androidjni.h
new file mode 100644 (file)
index 0000000..461c568
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/android/framework-android-interface.h>
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkAndroidJni class provides an Framework Android JNI implementation.
+ */
+class FrameworkAndroidJni : public Framework, public FrameworkAndroidInterface
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkAndroidJni(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkAndroidJni();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AppStatusHandler()
+   */
+  bool AppStatusHandler(int type, void* data) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::AddIdle()
+   */
+  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data)) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::FrameworkAndroidInterface::RemoveIdle()
+   */
+  void RemoveIdle(unsigned int id) override;
+
+private:
+  // Undefined
+  FrameworkAndroidJni(const FrameworkAndroidJni&);
+  FrameworkAndroidJni& operator=(FrameworkAndroidJni&);
+
+private:
+  bool mInitialised;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_H
diff --git a/dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp b/dali/internal/adaptor/androidjni/framework-factory-androidjni.cpp
new file mode 100644 (file)
index 0000000..6573eb5
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/androidjni/framework-factory-androidjni.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/androidjni/framework-androidjni.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryAndroidJni::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkAndroidJni>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryAndroidJni>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/androidjni/framework-factory-androidjni.h b/dali/internal/adaptor/androidjni/framework-factory-androidjni.h
new file mode 100644 (file)
index 0000000..a4dac3c
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryAndroidJni : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_ANDROIDJNI_FRAMEWORK_FACTORY_H
index d6afc6d..602c4f9 100644 (file)
 #include <dali/devel-api/atspi-interfaces/accessible.h>
 #include <dali/devel-api/text-abstraction/font-client.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/framework-factory.h>
 #include <dali/internal/adaptor/common/framework.h>
 #include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
 #include <dali/internal/system/common/command-line-options.h>
 #include <dali/internal/system/common/environment-variables.h>
+#include <dali/internal/system/common/system-settings.h>
 #include <dali/internal/window-system/common/render-surface-factory.h>
 #include <dali/internal/window-system/common/window-impl.h>
 #include <dali/internal/window-system/common/window-render-surface.h>
@@ -124,8 +126,9 @@ Application::Application(int* argc, char** argv[], const std::string& stylesheet
   }
 
   mCommandLineOptions = new CommandLineOptions(argc, argv);
-  mFramework          = new Framework(*this, *this, argc, argv, applicationType, mUseUiThread);
-  mUseRemoteSurface   = (applicationType == Framework::WATCH);
+  mFramework          = Dali::Internal::Adaptor::GetFrameworkFactory()->CreateFramework(*this, *this, argc, argv, applicationType, mUseUiThread);
+
+  mUseRemoteSurface = (applicationType == Framework::WATCH);
 }
 
 Application::~Application()
@@ -140,7 +143,6 @@ Application::~Application()
   mMainWindow.Reset();
 
   delete mCommandLineOptions;
-  delete mFramework;
 
   // Application is created in Main thread whether UI Threading is enabled or not.
   // But some resources are created in Main thread or UI thread.
@@ -553,12 +555,12 @@ Dali::Window Application::GetWindow()
 
 std::string Application::GetResourcePath()
 {
-  return Internal::Adaptor::Framework::GetResourcePath();
+  return SystemSettings::GetResourcePath();
 }
 
 std::string Application::GetDataPath()
 {
-  return Internal::Adaptor::Framework::GetDataPath();
+  return SystemSettings::GetDataPath();
 }
 
 void Application::SetStyleSheet(const std::string& stylesheet)
index 6eeb016..ab1b2e8 100644 (file)
@@ -520,7 +520,7 @@ private:
   LowMemorySignalType                mTaskLowMemorySignal;
   DeviceOrientationChangedSignalType mTaskDeviceOrientationChangedSignal;
 
-  Framework* mFramework;
+  std::unique_ptr<Framework> mFramework;
 
   CommandLineOptions* mCommandLineOptions;
 
diff --git a/dali/internal/adaptor/common/framework-factory.h b/dali/internal/adaptor/common/framework-factory.h
new file mode 100644 (file)
index 0000000..8437474
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactory
+{
+public:
+  FrameworkFactory()          = default;
+  virtual ~FrameworkFactory() = default;
+
+  virtual std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) = 0;
+};
+
+extern std::unique_ptr<FrameworkFactory> GetFrameworkFactory();
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_FACTORY_H
diff --git a/dali/internal/adaptor/common/framework.cpp b/dali/internal/adaptor/common/framework.cpp
new file mode 100644 (file)
index 0000000..b53319d
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace
+{
+constexpr auto NOT_SUPPORTED = "NOT_SUPPORTED";
+} // namespace
+
+Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: mObserver(observer),
+  mTaskObserver(taskObserver),
+  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+  mArgc(argc),
+  mArgv(argv),
+  mAbortCallBack(),
+  mRunning(false)
+{
+}
+
+Framework::~Framework()
+{
+}
+
+std::string Framework::GetLanguage() const
+{
+  return NOT_SUPPORTED;
+}
+
+std::string Framework::GetRegion() const
+{
+  return NOT_SUPPORTED;
+}
+
+bool Framework::IsMainLoopRunning()
+{
+  return mRunning;
+}
+
+void Framework::AddAbortCallback(CallbackBase* callback)
+{
+  mAbortCallBack = std::unique_ptr<CallbackBase>(callback);
+}
+
+void Framework::AbortCallback()
+{
+  // if an abort call back has been installed run it.
+  if(mAbortCallBack)
+  {
+    CallbackBase::Execute(*mAbortCallBack);
+  }
+  else
+  {
+    Quit();
+  }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index cf8760f..0a367c0 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef DALI_INTERNAL_FRAMEWORK_H
-#define DALI_INTERNAL_FRAMEWORK_H
+#ifndef DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -45,7 +45,6 @@ namespace Adaptor
  * The class is also used to register callbacks with the TIZEN platform so that
  * we know when any of the application lifecycle events occur.  This includes events
  * like when our application is to be initialised, terminated, paused, resumed etc.
- *
  */
 class Framework
 {
@@ -276,18 +275,28 @@ public:
   /**
    * Destructor
    */
-  ~Framework();
+  virtual ~Framework();
 
 public:
   /**
    * Runs the main loop of framework
    */
-  void Run();
+  virtual void Run() = 0;
 
   /**
    * Quits the main loop
    */
-  void Quit();
+  virtual void Quit() = 0;
+
+  /**
+   * Gets system language.
+   */
+  virtual std::string GetLanguage() const;
+
+  /**
+   * Gets system region.
+   */
+  virtual std::string GetRegion() const;
 
   /**
    * Checks whether the main loop of the framework is running.
@@ -304,16 +313,6 @@ public:
   void AddAbortCallback(CallbackBase* callback);
 
   /**
-   * Gets bundle name which was passed in app_reset callback.
-   */
-  std::string GetBundleName() const;
-
-  /**
-   * Gets bundle id which was passed in app_reset callback.
-   */
-  std::string GetBundleId() const;
-
-  /**
    * Sets a command line options.
    * This is used in case of the preinitialized application.
    * @param[in] argc A pointer to the number of arguments
@@ -325,104 +324,25 @@ public:
     mArgv = argv;
   }
 
+private:
   /**
-   *  Gets the path at which application resources are stored.
-   */
-  static std::string GetResourcePath();
-
-  /**
-   *  Gets the path at which application data are stored.
-   */
-  static std::string GetDataPath();
-
-  /**
-   * Sets system language.
-   */
-  void SetLanguage(const std::string& language);
-
-  /**
-   * Sets system region.
-   */
-  void SetRegion(const std::string& region);
-
-  /**
-   * Gets system language.
-   */
-  std::string GetLanguage() const;
-
-  /**
-   * Gets system region.
-   */
-  std::string GetRegion() const;
-
-  /**
-   * Called by the App framework when an application lifecycle event occurs.
-   * @param[in] type The type of event occurred.
-   * @param[in] data The data of event occurred.
-   */
-  bool AppStatusHandler(int type, void* data);
-
-  /**
-   * Called by the adaptor when an idle callback is added.
-   * @param[in] timeout The timeout of the callback.
-   * @param[in] data The data of of the callback.
-   * @param[in] callback The callback.
-   * @return The callback id.
-   */
-  unsigned int AddIdle(int timeout, void* data, bool (*callback)(void* data));
-
-  /**
-   * Called by the adaptor when an idle callback is removed.
-   * @param[in] id The callback id.
+   * Called if the application is aborted.
    */
-  void RemoveIdle(unsigned int id);
+  void AbortCallback();
 
 private:
   // Undefined
   Framework(const Framework&);
   Framework& operator=(Framework&);
 
-private:
-  /**
-   * Called when the application is created.
-   */
-  bool Create();
-
-  /**
-   * Called app_reset callback was called with bundle.
-   */
-  void SetBundleName(const std::string& name);
-
-  /**
-   * Called app_reset callback was called with bundle.
-   */
-  void SetBundleId(const std::string& id);
-
-  /**
-   * Called if the application is aborted.
-   */
-  void AbortCallback();
-
-  /**
-   * Called for initializing on specified backend. (X11 or Wayland)
-   */
-  void InitThreads();
-
-private:
-  Observer&     mObserver;
-  TaskObserver& mTaskObserver;
-  bool          mInitialised;
-  bool          mPaused;
-  bool          mRunning;
-  int*          mArgc;
-  char***       mArgv;
-  std::string   mBundleName;
-  std::string   mBundleId;
-  AbortHandler  mAbortHandler;
-
-private: // impl members
-  struct Impl;
-  Impl* mImpl;
+protected:
+  Observer&                     mObserver;
+  TaskObserver&                 mTaskObserver;
+  AbortHandler                  mAbortHandler;
+  int*                          mArgc;
+  char***                       mArgv;
+  std::unique_ptr<CallbackBase> mAbortCallBack;
+  bool                          mRunning;
 };
 
 } // namespace Adaptor
@@ -431,4 +351,4 @@ private: // impl members
 
 } // namespace Dali
 
-#endif // DALI_INTERNAL_FRAMEWORK_H
+#endif // DALI_INTERNAL_ADAPTOR_COMMON_FRAMEWORK_H
index 3dae4b5..a313acb 100644 (file)
@@ -7,24 +7,28 @@ SET( adaptor_adaptor_common_src_files
     ${adaptor_adaptor_dir}/common/adaptor-builder-impl.cpp
     ${adaptor_adaptor_dir}/common/application-impl.cpp
     ${adaptor_adaptor_dir}/common/combined-update-render-controller.cpp
+    ${adaptor_adaptor_dir}/common/framework.cpp
     ${adaptor_adaptor_dir}/common/system-cache-path.cpp
 )
 
 # module: adaptor, backend: tizen-wayland
 SET( adaptor_adaptor_tizen_wayland_src_files
     ${adaptor_adaptor_dir}/tizen-wayland/adaptor-impl-tizen.cpp
+    ${adaptor_adaptor_dir}/tizen-wayland/framework-factory-tizen.cpp
     ${adaptor_adaptor_dir}/tizen-wayland/framework-tizen.cpp
 )
 
 # module: adaptor, backend: libuv-x11
 SET( adaptor_adaptor_libuv_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/libuv/framework-factory-libuv.cpp
     ${adaptor_adaptor_dir}/libuv/framework-libuv.cpp
 )
 
 # module: adaptor, backend: glib-x11
 SET( adaptor_adaptor_glib_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/glib/framework-factory-glib.cpp
     ${adaptor_adaptor_dir}/glib/framework-glib.cpp
 )
 
@@ -37,6 +41,7 @@ SET( adaptor_adaptor_tizen_wearable_src_files
 # module: adaptor, backend: ubuntu
 SET( adaptor_adaptor_ubuntu_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/ubuntu/framework-factory-ubuntu.cpp
     ${adaptor_adaptor_dir}/ubuntu/framework-ubuntu.cpp
 )
 
@@ -44,6 +49,7 @@ SET( adaptor_adaptor_ubuntu_src_files
 SET( adaptor_adaptor_android_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
     ${adaptor_adaptor_dir}/android/android-framework-impl.cpp
+    ${adaptor_adaptor_dir}/android/framework-factory-android.cpp
     ${adaptor_adaptor_dir}/android/framework-android.cpp
 )
 
@@ -51,12 +57,14 @@ SET( adaptor_adaptor_android_src_files
 SET( adaptor_adaptor_androidjni_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
     ${adaptor_adaptor_dir}/android/android-framework-impl.cpp
+    ${adaptor_adaptor_dir}/androidjni/framework-factory-androidjni.cpp
     ${adaptor_adaptor_dir}/androidjni/framework-androidjni.cpp
 )
 
 # module: adaptor, backend: windows
 SET( adaptor_adaptor_windows_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/windows/framework-factory-win.cpp
     ${adaptor_adaptor_dir}/windows/framework-win.cpp
 )
 
@@ -68,5 +76,6 @@ SET( adaptor_adaptor_component_application_src_files
 # module: adaptor, backend: macos
 SET( adaptor_adaptor_macos_src_files
     ${adaptor_adaptor_dir}/generic/adaptor-impl-generic.cpp
+    ${adaptor_adaptor_dir}/macos/framework-factory-mac.mm
     ${adaptor_adaptor_dir}/macos/framework-mac.mm
 )
diff --git a/dali/internal/adaptor/glib/framework-factory-glib.cpp b/dali/internal/adaptor/glib/framework-factory-glib.cpp
new file mode 100644 (file)
index 0000000..50e1704
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/glib/framework-factory-glib.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/glib/framework-glib.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryGlib::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkGlib>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryGlib>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/glib/framework-factory-glib.h b/dali/internal/adaptor/glib/framework-factory-glib.h
new file mode 100644 (file)
index 0000000..eef7081
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryGlib : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_FACTORY_H
index 9b2842f..90859dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/glib/framework-glib.h>
 
 // EXTERNAL INCLUDES
 #include <glib.h>
 #include <cstdio>
 #include <cstring>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
@@ -47,30 +42,17 @@ GMainContext* GetMainLoopContext()
 /**
  * Impl to hide GLib data members
  */
-struct Framework::Impl
+struct FrameworkGlib::Impl
 {
   // Constructor
   Impl(void* data)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(nullptr),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
   {
-    mCallbackManager = CallbackManager::New();
-
     // In future, may need to change this to have own context or use Tizen context
     gMainLoop = mMainLoop = g_main_loop_new(nullptr, false);
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-
     g_main_loop_unref(mMainLoop);
     gMainLoop = nullptr;
   }
@@ -86,35 +68,22 @@ struct Framework::Impl
   }
 
   // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  GMainLoop*       mMainLoop{nullptr};
-  GMainContext*    mContext{nullptr};
-
-  std::string mLanguage;
-  std::string mRegion;
+  GMainLoop*    mMainLoop{nullptr};
+  GMainContext* mContext{nullptr};
 
 private:
   Impl(const Impl& impl) = delete;
   Impl& operator=(const Impl& impl) = delete;
 };
 
-Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+FrameworkGlib::FrameworkGlib(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkGlib::~FrameworkGlib()
 {
   if(mRunning)
   {
@@ -124,7 +93,7 @@ Framework::~Framework()
   delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkGlib::Run()
 {
   mRunning = true;
   mObserver.OnInit();
@@ -133,100 +102,12 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkGlib::Quit()
 {
   mObserver.OnTerminate();
   mImpl->Quit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-}
-
-std::string Framework::GetBundleId() const
-{
-  return "";
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-  return resourcePath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  return true;
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->mLanguage;
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->mRegion;
-}
-
-std::string Framework::GetDataPath()
-{
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
-  {
-    dataPath = value;
-  }
-
-  return dataPath;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/glib/framework-glib.h b/dali/internal/adaptor/glib/framework-glib.h
new file mode 100644 (file)
index 0000000..301d238
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkGlib class provides an Framework Glib implementation.
+ */
+class FrameworkGlib : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkGlib(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkGlib();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkGlib(const FrameworkGlib&);
+  FrameworkGlib& operator=(FrameworkGlib&);
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_GLIB_FRAMEWORK_H
diff --git a/dali/internal/adaptor/libuv/framework-factory-libuv.cpp b/dali/internal/adaptor/libuv/framework-factory-libuv.cpp
new file mode 100644 (file)
index 0000000..d3cb580
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/libuv/framework-factory-libuv.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/libuv/framework-libuv.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryLibuv::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkLibuv>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryLibuv>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/libuv/framework-factory-libuv.h b/dali/internal/adaptor/libuv/framework-factory-libuv.h
new file mode 100644 (file)
index 0000000..1b5a4ba
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryLibuv : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_FACTORY_H
index ec8bf42..bce2382 100644 (file)
  * 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.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/libuv/framework-libuv.h>
 
 // EXTERNAL INCLUDES
 #include <X11/Xlib.h>
 #include <cstdio>
 #include <cstring>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
@@ -48,31 +42,19 @@ uv_loop_t* GetUVMainLoop()
 /**
  * Impl to hide LibUV data members
  */
-struct Framework::Impl
+struct FrameworkLibuv::Impl
 {
   // Constructor
   Impl(void* data)
-  : mAbortCallBack(nullptr),
-    mCallbackManager(nullptr),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
   {
-    mCallbackManager = CallbackManager::New();
-    mMainLoop        = new uv_loop_t;
-    gUVLoop          = mMainLoop; // "There can be only one!"
+    mMainLoop = new uv_loop_t;
+    gUVLoop   = mMainLoop; // "There can be only one!"
 
     uv_loop_init(mMainLoop);
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-
     delete mMainLoop;
   }
 
@@ -88,35 +70,21 @@ struct Framework::Impl
   }
 
   // Data
-
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  uv_loop_t*       mMainLoop;
-
-  std::string mLanguage;
-  std::string mRegion;
+  uv_loop_t* mMainLoop;
 
 private:
   Impl(const Impl& impl) = delete;
   Impl& operator=(const Impl& impl) = delete;
 };
 
-Framework::Framework(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
+FrameworkLibuv::FrameworkLibuv(Framework::Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mImpl(NULL)
 {
   mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkLibuv::~FrameworkLibuv()
 {
   if(mRunning)
   {
@@ -126,7 +94,7 @@ Framework::~Framework()
   delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkLibuv::Run()
 {
   mRunning = true;
   mObserver.OnInit();
@@ -135,100 +103,12 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkLibuv::Quit()
 {
   mObserver.OnTerminate();
   mImpl->Quit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-}
-
-std::string Framework::GetBundleId() const
-{
-  return "";
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-  return resourcePath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  return true;
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->mLanguage;
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->mRegion;
-}
-
-std::string Framework::GetDataPath()
-{
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
-  {
-    dataPath = value;
-  }
-
-  return dataPath;
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/libuv/framework-libuv.h b/dali/internal/adaptor/libuv/framework-libuv.h
new file mode 100644 (file)
index 0000000..15ce4ea
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkLibuv class provides an Framework Libuv implementation.
+ */
+class FrameworkLibuv : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Framework()
+   */
+  FrameworkLibuv(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkLibuv();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkLibuv(const FrameworkLibuv&);
+  FrameworkLibuv& operator=(FrameworkLibuv&);
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_LIBUV_FRAMEWORK_H
diff --git a/dali/internal/adaptor/macos/framework-factory-mac.h b/dali/internal/adaptor/macos/framework-factory-mac.h
new file mode 100644 (file)
index 0000000..4710077
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryMac : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_MAC_FRAMEWORK_FACTORY_H
diff --git a/dali/internal/adaptor/macos/framework-factory-mac.mm b/dali/internal/adaptor/macos/framework-factory-mac.mm
new file mode 100644 (file)
index 0000000..9de706e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/macos/framework-factory-mac.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/macos/framework-mac.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryMac::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkMac>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryMac>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/macos/framework-mac.h b/dali/internal/adaptor/macos/framework-mac.h
new file mode 100644 (file)
index 0000000..38770b9
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkMac class provides an Framework Mac implementation.
+ */
+class FrameworkMac : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkMac(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkMac();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * Called by the App framework when an application lifecycle event occurs.
+   * @param[in] type The type of event occurred.
+   * @param[in] data The data of event occurred.
+   */
+  bool AppStatusHandler(int type, void* data);
+
+private:
+  // Undefined
+  FrameworkMac(const FrameworkMac&);
+  FrameworkMac& operator=(FrameworkMac&);
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_MACOS_FRAMEWORK_H
index b9c1439..cb7b71f 100644 (file)
@@ -1,5 +1,5 @@
 ï»¿/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -12,7 +12,6 @@
  * 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.
- *
  */
 
 #import <Cocoa/Cocoa.h>
 #include "extern-definitions.h"
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/macos/framework-mac.h>
 
 // EXTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 
@@ -53,102 +49,28 @@ enum
 
 } // Unnamed namespace
 
-/**
- * Impl to hide WindowsSystem data members
- */
-struct Framework::Impl
+FrameworkMac::FrameworkMac(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread)
 {
-  // Constructor
-
-  Impl(void* data)
-  : mAbortCallBack( nullptr ),
-    mLanguage( "NOT_SUPPORTED" ),
-    mRegion( "NOT_SUPPORTED" )
-  {
-  }
-
-  ~Impl()
-  {
-    delete mAbortCallBack;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
-  }
+  // ensures the NSApp global object is initialized
+  [NSApplication sharedApplication];
 
-  void SetAbortCallback( CallbackBase *base )
-  {
-    mAbortCallBack = base;
-  }
+  // this is needed for applications without a bundle
+  [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
 
-  bool ExecuteCallback()
-  {
-    if( nullptr != mAbortCallBack )
-    {
-      CallbackBase::Execute( *mAbortCallBack );
-      return true;
-    }
-
-    return false;
-  }
-
-private:
-  // Undefined
-  Impl( const Impl& impl ) = delete;
-
-  // Undefined
-  Impl& operator=( const Impl& impl ) = delete;
-
-private:
-  // Data
-  CallbackBase* mAbortCallBack;
-  std::string mLanguage;
-  std::string mRegion;
-};
-
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler( MakeCallback( this, &Framework::AbortCallback ) ),
-  mImpl(NULL)
-{
-    InitThreads();
-    mImpl = new Impl(this);
-
-    // ensures the NSApp global object is initialized
-    [NSApplication sharedApplication];
-
-    // this is needed for applications without a bundle
-    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
-
-    // make sure we can become the key window
-    [NSApp activateIgnoringOtherApps:YES];
+  // make sure we can become the key window
+  [NSApp activateIgnoringOtherApps:YES];
 }
 
-Framework::~Framework()
+FrameworkMac::~FrameworkMac()
 {
   if (mRunning)
   {
     Quit();
   }
-
-  delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkMac::Run()
 {
   mRunning = true;
   AppStatusHandler(APP_CREATE, nullptr);
@@ -156,82 +78,17 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkMac::Quit()
 {
   AppStatusHandler(APP_TERMINATE, nullptr);
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback( CallbackBase* callback )
-{
-  mImpl->SetAbortCallback( callback );
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by macOS specifically to get the already configured Application package path.
-  const char* macEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char* value = getenv( macEnvironmentVariable );
-
-  std::string resourcePath;
-  if ( value != NULL )
-  {
-    resourcePath = value;
-  }
-
-  if( resourcePath.back() != '/' )
-  {
-    resourcePath+="/";
-  }
-
-  return resourcePath;
-}
-
-std::string Framework::GetDataPath()
-{
-  return app_get_data_path();
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback( )
-{
-  // if an abort call back has been installed run it.
-  if( false == mImpl->ExecuteCallback() )
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void *)
+bool FrameworkMac::AppStatusHandler(int type, void *)
 {
   switch (type)
   {
     case APP_CREATE:
     {
-      mInitialised = true;
       mObserver.OnInit();
       break;
     }
@@ -263,20 +120,6 @@ bool Framework::AppStatusHandler(int type, void *)
   return true;
 }
 
-void Framework::InitThreads()
-{
-}
-
-std::string Framework::GetLanguage() const
-{
-  return mImpl->GetLanguage();
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->GetRegion();
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp b/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.cpp
new file mode 100644 (file)
index 0000000..75872a6
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/tizen-wayland/framework-tizen.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryTizen::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkTizen>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryTizen>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h b/dali/internal/adaptor/tizen-wayland/framework-factory-tizen.h
new file mode 100644 (file)
index 0000000..d56db17
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryTizen : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_FACTORY_H
index d379c51..46fcc4b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * 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.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/tizen-wayland/framework-tizen.h>
 
 // EXTERNAL INCLUDES
 #include <app_common.h>
 #include <Eldbus.h>
 #endif // DALI_ELDBUS_AVAILABLE
 
-#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
-#include <tzplatform_config.h>
-#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
-
 #ifdef COMPONENT_APPLICATION_SUPPORT
 #include <component_based_app_base.h>
 #endif
@@ -51,7 +46,6 @@
 #include <dali/integration-api/trace.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
 #include <dali/internal/system/linux/dali-ecore.h>
 
 using namespace tizen_cpp;
@@ -249,7 +243,7 @@ DeviceStatus::Orientation::Status GetOrientationStatus(app_device_orientation_e
 /**
  * Impl to hide EFL data members
  */
-struct Framework::Impl
+struct FrameworkTizen::Impl
 {
   class UiAppContext : public AppCoreUiBase
   {
@@ -257,7 +251,7 @@ struct Framework::Impl
     class Task : public AppCoreTaskBase
     {
     public:
-      explicit Task(Framework* framework)
+      explicit Task(FrameworkTizen* framework)
       : mFramework(framework),
         mNewBatteryStatus(Dali::DeviceStatus::Battery::Status::NORMAL),
         mNewMemoryStatus(Dali::DeviceStatus::Memory::NORMAL),
@@ -328,10 +322,9 @@ struct Framework::Impl
         mNewMemoryStatus = AppCore::GetMemoryStatus(static_cast<app_event_low_memory_status_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnMemoryLow(task->mNewMemoryStatus);
             return G_SOURCE_REMOVE;
           });
@@ -346,10 +339,9 @@ struct Framework::Impl
         mNewDeviceOrientationStatus = AppCore::GetOrientationStatus(static_cast<app_device_orientation_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnDeviceOrientationChanged(task->mNewDeviceOrientationStatus);
             return G_SOURCE_REMOVE;
           });
@@ -364,10 +356,9 @@ struct Framework::Impl
         mNewBatteryStatus = AppCore::GetBatteryStatus(static_cast<app_event_low_battery_status_e>(state));
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnBatteryLow(task->mNewBatteryStatus);
             return G_SOURCE_REMOVE;
           });
@@ -382,10 +373,9 @@ struct Framework::Impl
         mFramework->SetLanguage(mNewLanguage);
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnLanguageChanged();
             return G_SOURCE_REMOVE;
           });
@@ -401,10 +391,9 @@ struct Framework::Impl
         mFramework->SetRegion(mNewRegion);
 
         PostToUiThread(
-          [](gpointer userData) -> gboolean
-          {
+          [](gpointer userData) -> gboolean {
             auto* task      = static_cast<Task*>(userData);
-            auto* framework = static_cast<Framework*>(task->mFramework);
+            auto* framework = static_cast<FrameworkTizen*>(task->mFramework);
             framework->mObserver.OnRegionChanged();
             return G_SOURCE_REMOVE;
           });
@@ -439,7 +428,7 @@ struct Framework::Impl
       }
 
     private:
-      Framework*                              mFramework;
+      FrameworkTizen*                         mFramework;
       std::string                             mNewLanguage;
       std::string                             mNewRegion;
       Dali::DeviceStatus::Battery::Status     mNewBatteryStatus;
@@ -447,7 +436,7 @@ struct Framework::Impl
       Dali::DeviceStatus::Orientation::Status mNewDeviceOrientationStatus;
     };
 
-    explicit UiAppContext(unsigned int hint, Framework* framework)
+    explicit UiAppContext(unsigned int hint, FrameworkTizen* framework)
     : AppCoreUiBase(hint),
       mFramework(framework),
       mUseUiThread(false)
@@ -606,8 +595,8 @@ struct Framework::Impl
       auto*     framework = context->mFramework;
       Observer* observer  = &framework->mObserver;
 
-      char* lang = nullptr;
-      auto appEventReturn = app_event_get_language(event_info, &lang);
+      char* lang           = nullptr;
+      auto  appEventReturn = app_event_get_language(event_info, &lang);
       if(appEventReturn == APP_ERROR_NONE && lang)
       {
         framework->SetLanguage(std::string(lang));
@@ -626,8 +615,8 @@ struct Framework::Impl
       auto*     framework = context->mFramework;
       Observer* observer  = &framework->mObserver;
 
-      char* region = nullptr;
-      auto appEventReturn = app_event_get_region_format(event_info, &region);
+      char* region         = nullptr;
+      auto  appEventReturn = app_event_get_region_format(event_info, &region);
       if(appEventReturn == APP_ERROR_NONE && region)
       {
         framework->SetRegion(std::string(region));
@@ -647,7 +636,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_event_low_battery_status_e status;
-      auto appEventReturn = app_event_get_low_battery_status(event_info, &status);
+      auto                           appEventReturn = app_event_get_low_battery_status(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Battery::Status result = AppCore::GetBatteryStatus(status);
@@ -666,7 +655,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_event_low_memory_status_e status;
-      auto appEventReturn = app_event_get_low_memory_status(event_info, &status);
+      auto                          appEventReturn = app_event_get_low_memory_status(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Memory::Status result = AppCore::GetMemoryStatus(status);
@@ -685,7 +674,7 @@ struct Framework::Impl
       Observer* observer  = &framework->mObserver;
 
       app_device_orientation_e status;
-      auto appEventReturn = app_event_get_device_orientation(event_info, &status);
+      auto                     appEventReturn = app_event_get_device_orientation(event_info, &status);
       if(appEventReturn == APP_ERROR_NONE)
       {
         Dali::DeviceStatus::Orientation::Status result = AppCore::GetOrientationStatus(status);
@@ -697,7 +686,7 @@ struct Framework::Impl
       }
     }
 
-    void ProcessBundle(Framework* framework, bundle* bundleData)
+    void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
     {
       if(bundleData == nullptr)
       {
@@ -720,7 +709,7 @@ struct Framework::Impl
     }
 
   private:
-    Framework*                mFramework;
+    FrameworkTizen*           mFramework;
     std::shared_ptr<AppEvent> mLanguageChanged;
     std::shared_ptr<AppEvent> mDeviceOrientationChanged;
     std::shared_ptr<AppEvent> mRegionFormatChanged;
@@ -731,16 +720,14 @@ struct Framework::Impl
 
   // Constructor
   Impl(void* data, Type type, bool useUiThread)
-  : mAbortCallBack(NULL),
-    mCallbackManager(NULL),
-    handlers{nullptr, nullptr, nullptr, nullptr, nullptr},
+  : handlers{nullptr, nullptr, nullptr, nullptr, nullptr},
     mUseUiThread(useUiThread)
 #ifdef APPCORE_WATCH_AVAILABLE
     ,
     mWatchCallback()
 #endif
   {
-    mFramework = static_cast<Framework*>(data);
+    mFramework = static_cast<FrameworkTizen*>(data);
 
 #ifndef APPCORE_WATCH_AVAILABLE
     if(type == WATCH)
@@ -749,17 +736,10 @@ struct Framework::Impl
     }
 #endif
     mApplicationType = type;
-    mCallbackManager = CallbackManager::New();
   }
 
   ~Impl()
   {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
   }
 
   int AppMain()
@@ -866,13 +846,11 @@ struct Framework::Impl
   }
 
   // Data
-  Type             mApplicationType;
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage{};
-  std::string      mRegion{};
+  Type        mApplicationType;
+  std::string mLanguage{};
+  std::string mRegion{};
 
-  Framework*                    mFramework;
+  FrameworkTizen*               mFramework;
   AppCore::AppEventHandlerPtr   handlers[5];
   std::unique_ptr<UiAppContext> mUiAppContext{nullptr};
   bool                          mUseUiThread{false};
@@ -880,7 +858,7 @@ struct Framework::Impl
   watch_app_lifecycle_callback_s mWatchCallback;
 #endif
 
-  static void ProcessBundle(Framework* framework, bundle* bundleData)
+  static void ProcessBundle(FrameworkTizen* framework, bundle* bundleData)
   {
     if(bundleData == NULL)
     {
@@ -946,8 +924,8 @@ struct Framework::Impl
 
   static void AppLanguageChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
 
     if(event && event->value)
     {
@@ -962,8 +940,8 @@ struct Framework::Impl
 
   static void AppRegionChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
 
     if(event && event->value)
     {
@@ -978,7 +956,7 @@ struct Framework::Impl
 
   static void AppBatteryLow(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                           observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                           observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                 status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Battery::Status result   = Dali::DeviceStatus::Battery::Status::NORMAL;
 
@@ -1003,7 +981,7 @@ struct Framework::Impl
 
   static void AppMemoryLow(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                          observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                          observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Memory::Status result   = Dali::DeviceStatus::Memory::Status::NORMAL;
 
@@ -1033,7 +1011,7 @@ struct Framework::Impl
 
   static void AppDeviceOrientationChanged(AppCore::AppEventInfoPtr event, void* data)
   {
-    Observer*                               observer = &static_cast<Framework*>(data)->mObserver;
+    Observer*                               observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     int                                     status   = *static_cast<int*>(event->value);
     Dali::DeviceStatus::Orientation::Status result   = Dali::DeviceStatus::Orientation::Status::ORIENTATION_0;
 
@@ -1121,12 +1099,12 @@ struct Framework::Impl
   static int WidgetAppCreate(void* data)
   {
     widget_base_on_create();
-    return static_cast<int>(static_cast<Framework*>(data)->Create());
+    return static_cast<int>(static_cast<FrameworkTizen*>(data)->Create());
   }
 
   static int WidgetAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     observer->OnTerminate();
 
     widget_base_on_terminate();
@@ -1167,12 +1145,12 @@ struct Framework::Impl
 #ifdef APPCORE_WATCH_AVAILABLE
   static bool WatchAppCreate(int width, int height, void* data)
   {
-    return static_cast<Framework*>(data)->Create();
+    return static_cast<FrameworkTizen*>(data)->Create();
   }
 
   static void WatchAppTimeTick(watch_time_h time, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     WatchTime curTime(time);
 
     observer->OnTimeTick(curTime);
@@ -1180,7 +1158,7 @@ struct Framework::Impl
 
   static void WatchAppAmbientTick(watch_time_h time, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     WatchTime curTime(time);
 
     observer->OnAmbientTick(curTime);
@@ -1188,16 +1166,16 @@ struct Framework::Impl
 
   static void WatchAppAmbientChanged(bool ambient, void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnAmbientChanged(ambient);
   }
 
   static void WatchAppControl(app_control_h app_control, void* data)
   {
-    Framework* framework  = static_cast<Framework*>(data);
-    Observer*  observer   = &framework->mObserver;
-    bundle*    bundleData = NULL;
+    FrameworkTizen* framework  = static_cast<FrameworkTizen*>(data);
+    Observer*       observer   = &framework->mObserver;
+    bundle*         bundleData = NULL;
 
     app_control_to_bundle(app_control, &bundleData);
     ProcessBundle(framework, bundleData);
@@ -1208,21 +1186,21 @@ struct Framework::Impl
 
   static void WatchAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnTerminate();
   }
 
   static void WatchAppPause(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnPause();
   }
 
   static void WatchAppResume(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
 
     observer->OnResume();
   }
@@ -1277,8 +1255,8 @@ struct Framework::Impl
 
   static void* ComponentAppCreate(void* data)
   {
-    Framework* framework = static_cast<Framework*>(data);
-    Observer*  observer  = &framework->mObserver;
+    FrameworkTizen* framework = static_cast<FrameworkTizen*>(data);
+    Observer*       observer  = &framework->mObserver;
     observer->OnInit();
 
     return Dali::AnyCast<void*>(observer->OnCreate());
@@ -1286,7 +1264,7 @@ struct Framework::Impl
 
   static void ComponentAppTerminate(void* data)
   {
-    Observer* observer = &static_cast<Framework*>(data)->mObserver;
+    Observer* observer = &static_cast<FrameworkTizen*>(data)->mObserver;
     observer->OnTerminate();
   }
 
@@ -1316,17 +1294,12 @@ private:
   Impl& operator=(const Impl& impl);
 };
 
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
+FrameworkTizen::FrameworkTizen(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),
   mInitialised(false),
   mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
   mBundleName(""),
   mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
   mImpl(NULL)
 {
   if(mArgc == nullptr || mArgv == nullptr)
@@ -1343,12 +1316,10 @@ Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& tas
     set_last_result(TIZEN_ERROR_NOT_SUPPORTED);
   }
 
-  InitThreads();
-
   mImpl = new Impl(this, type, useUiThread);
 }
 
-Framework::~Framework()
+FrameworkTizen::~FrameworkTizen()
 {
   if(mRunning)
   {
@@ -1358,14 +1329,14 @@ Framework::~Framework()
   delete mImpl;
 }
 
-bool Framework::Create()
+bool FrameworkTizen::Create()
 {
   mInitialised = true;
   mObserver.OnInit();
   return true;
 }
 
-void Framework::Run()
+void FrameworkTizen::Run()
 {
   mRunning = true;
   int ret;
@@ -1380,116 +1351,47 @@ void Framework::Run()
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkTizen::Quit()
 {
   mImpl->AppExit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
+std::string FrameworkTizen::GetBundleName() const
 {
   return mBundleName;
 }
 
-void Framework::SetBundleName(const std::string& name)
+void FrameworkTizen::SetBundleName(const std::string& name)
 {
   mBundleName = name;
 }
 
-std::string Framework::GetBundleId() const
+std::string FrameworkTizen::GetBundleId() const
 {
   return mBundleId;
 }
 
-std::string Framework::GetResourcePath()
-{
-  std::string resourcePath = "";
-#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
-  char* app_rsc_path = app_get_resource_path();
-  if(app_rsc_path)
-  {
-    resourcePath = app_rsc_path;
-    free(app_rsc_path);
-  }
-#else // For backwards compatibility with older Tizen versions
-
-  // "DALI_APPLICATION_PACKAGE" is used to get the already configured Application package path.
-  const char* environmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value               = getenv(environmentVariable);
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
-
-  return resourcePath;
-}
-
-std::string Framework::GetDataPath()
-{
-  std::string result;
-  char*       dataPath = app_get_data_path();
-  if(dataPath)
-  {
-    result = dataPath;
-    free(dataPath);
-  }
-  return result;
-}
-
-void Framework::SetBundleId(const std::string& id)
+void FrameworkTizen::SetBundleId(const std::string& id)
 {
   mBundleId = id;
 }
 
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-void Framework::InitThreads()
-{
-}
-
-void Framework::SetLanguage(const std::string& language)
+void FrameworkTizen::SetLanguage(const std::string& language)
 {
   mImpl->SetLanguage(language);
 }
 
-void Framework::SetRegion(const std::string& region)
+void FrameworkTizen::SetRegion(const std::string& region)
 {
   mImpl->SetRegion(region);
 }
 
-std::string Framework::GetLanguage() const
+std::string FrameworkTizen::GetLanguage() const
 {
   return mImpl->GetLanguage();
 }
 
-std::string Framework::GetRegion() const
+std::string FrameworkTizen::GetRegion() const
 {
   return mImpl->GetRegion();
 }
diff --git a/dali/internal/adaptor/tizen-wayland/framework-tizen.h b/dali/internal/adaptor/tizen-wayland/framework-tizen.h
new file mode 100644 (file)
index 0000000..724cfbf
--- /dev/null
@@ -0,0 +1,124 @@
+#ifndef DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkTizen class provides an Framework Tizen implementation.
+ */
+class FrameworkTizen : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkTizen(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkTizen();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+  /**
+   * Gets bundle name which was passed in app_reset callback.
+   */
+  std::string GetBundleName() const;
+
+  /**
+   * Gets bundle id which was passed in app_reset callback.
+   */
+  std::string GetBundleId() const;
+
+  /**
+   * Sets system language.
+   */
+  void SetLanguage(const std::string& language);
+
+  /**
+   * Sets system region.
+   */
+  void SetRegion(const std::string& region);
+
+  /**
+   * Gets system language.
+   */
+  std::string GetLanguage() const override;
+
+  /**
+   * Gets system region.
+   */
+  std::string GetRegion() const override;
+
+private:
+  // Undefined
+  FrameworkTizen(const FrameworkTizen&);
+  FrameworkTizen& operator=(FrameworkTizen&);
+
+private:
+  /**
+   * Called when the application is created.
+   */
+  bool Create();
+
+  /**
+   * Called app_reset callback was called with bundle.
+   */
+  void SetBundleName(const std::string& name);
+
+  /**
+   * Called app_reset callback was called with bundle.
+   */
+  void SetBundleId(const std::string& id);
+
+private:
+  bool        mInitialised;
+  bool        mPaused;
+  std::string mBundleName;
+  std::string mBundleId;
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_TIZEN_FRAMEWORK_H
diff --git a/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp b/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.cpp
new file mode 100644 (file)
index 0000000..f8bcc62
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/ubuntu/framework-ubuntu.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryUbuntu::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkUbuntu>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryUbuntu>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h b/dali/internal/adaptor/ubuntu/framework-factory-ubuntu.h
new file mode 100644 (file)
index 0000000..c765922
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryUbuntu : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_FACTORY_H
index 60529c5..ab4f353 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  * 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.
- *
  */
 
 // CLASS HEADER
-#include <dali/internal/adaptor/common/framework.h>
+#include <dali/internal/adaptor/ubuntu/framework-ubuntu.h>
 
 // EXTERNAL INCLUDES
 #include <X11/Xlib.h>
+
+// INTERNAL INCLUDES
 #include <dali/internal/system/linux/dali-ecore.h>
 #include <dali/internal/system/linux/dali-efreet.h>
 #include <dali/internal/system/linux/dali-elementary.h>
 
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/callback-manager.h>
-
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-namespace
-{
-/// Application Status Enum
-enum
-{
-  APP_CREATE,
-  APP_TERMINATE,
-  APP_PAUSE,
-  APP_RESUME,
-  APP_RESET,
-  APP_LANGUAGE_CHANGE,
-};
-
-} // Unnamed namespace
-
-/**
- * Impl to hide EFL data members
- */
-struct Framework::Impl
-{
-  // Constructor
-
-  Impl(void* data)
-  : mAbortCallBack(NULL),
-    mCallbackManager(CallbackManager::New()),
-    mLanguage("NOT_SUPPORTED"),
-    mRegion("NOT_SUPPORTED")
-  {
-  }
-
-  ~Impl()
-  {
-    delete mAbortCallBack;
-
-    // we're quiting the main loop so
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called
-    // to delete our abort handler
-    delete mCallbackManager;
-  }
-
-  std::string GetLanguage() const
-  {
-    return mLanguage;
-  }
-
-  std::string GetRegion() const
-  {
-    return mRegion;
-  }
-
-  // Data
-  CallbackBase*    mAbortCallBack;
-  CallbackManager* mCallbackManager;
-  std::string      mLanguage;
-  std::string      mRegion;
-
-  // Static methods
-
-  /**
-   * Called by AppCore on application creation.
-   */
-  static bool AppCreate(void* data)
-  {
-    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application should terminate.
-   */
-  static void AppTerminate(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application is paused.
-   */
-  static void AppPause(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
-  }
-
-  /**
-   * Called by AppCore when the application is resumed.
-   */
-  static void AppResume(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
-  }
-
-  /**
-   * Called by AppCore when the language changes on the device.
-   */
-  static void AppLanguageChange(void* data)
-  {
-    static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
-  }
-};
-
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
-: mObserver(observer),
-  mTaskObserver(taskObserver),
-  mInitialised(false),
-  mPaused(false),
-  mRunning(false),
-  mArgc(argc),
-  mArgv(argv),
-  mBundleName(""),
-  mBundleId(""),
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),
-  mImpl(NULL)
+FrameworkUbuntu::FrameworkUbuntu(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)
+: Framework(observer, taskObserver, argc, argv, type, useUiThread)
 {
   InitThreads();
-  mImpl = new Impl(this);
 }
 
-Framework::~Framework()
+FrameworkUbuntu::~FrameworkUbuntu()
 {
   if(mRunning)
   {
     Quit();
   }
-
-  delete mImpl;
 }
 
-void Framework::Run()
+void FrameworkUbuntu::Run()
 {
   mRunning = true;
 
   efreet_cache_disable();
   elm_init(mArgc ? *mArgc : 0, mArgv ? *mArgv : nullptr);
 
-  Impl::AppCreate(this);
+  mObserver.OnInit();
 
   elm_run();
 
   mRunning = false;
 }
 
-void Framework::Quit()
+void FrameworkUbuntu::Quit()
 {
-  Impl::AppTerminate(this);
+  mObserver.OnTerminate();
 
   elm_exit();
 }
 
-bool Framework::IsMainLoopRunning()
-{
-  return mRunning;
-}
-
-void Framework::AddAbortCallback(CallbackBase* callback)
-{
-  mImpl->mAbortCallBack = callback;
-}
-
-std::string Framework::GetBundleName() const
-{
-  return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
-  mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
-  return mBundleId;
-}
-
-std::string Framework::GetResourcePath()
-{
-  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string resourcePath;
-  if(value != NULL)
-  {
-    resourcePath = value;
-  }
-
-  if(resourcePath.back() != '/')
-  {
-    resourcePath += "/";
-  }
-
-  return resourcePath;
-}
-
-std::string Framework::GetDataPath()
-{
-  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
-  char*       value                     = getenv(ubuntuEnvironmentVariable);
-  std::string dataPath;
-  if(value != NULL)
-  {
-    dataPath = value;
-  }
-
-  return dataPath;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
-  mBundleId = id;
-}
-
-void Framework::AbortCallback()
-{
-  // if an abort call back has been installed run it.
-  if(mImpl->mAbortCallBack)
-  {
-    CallbackBase::Execute(*mImpl->mAbortCallBack);
-  }
-  else
-  {
-    Quit();
-  }
-}
-
-bool Framework::AppStatusHandler(int type, void* bundleData)
-{
-  switch(type)
-  {
-    case APP_CREATE:
-    {
-      mInitialised = true;
-
-      mObserver.OnInit();
-      break;
-    }
-
-    case APP_RESET:
-      mObserver.OnReset();
-      break;
-
-    case APP_RESUME:
-      mObserver.OnResume();
-      break;
-
-    case APP_TERMINATE:
-      mObserver.OnTerminate();
-      break;
-
-    case APP_PAUSE:
-      mObserver.OnPause();
-      break;
-
-    case APP_LANGUAGE_CHANGE:
-      mObserver.OnLanguageChanged();
-      break;
-
-    default:
-      break;
-  }
-
-  return true;
-}
-
-void Framework::InitThreads()
+void FrameworkUbuntu::InitThreads()
 {
   XInitThreads();
 }
 
-std::string Framework::GetLanguage() const
-{
-  return mImpl->GetLanguage();
-}
-
-std::string Framework::GetRegion() const
-{
-  return mImpl->GetRegion();
-}
-
 } // namespace Adaptor
 
 } // namespace Internal
diff --git a/dali/internal/adaptor/ubuntu/framework-ubuntu.h b/dali/internal/adaptor/ubuntu/framework-ubuntu.h
new file mode 100644 (file)
index 0000000..4da3904
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkUbuntu class provides an Framework Ubuntu implementation.
+ */
+class FrameworkUbuntu : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkUbuntu(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkUbuntu();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkUbuntu(const FrameworkUbuntu&);
+  FrameworkUbuntu& operator=(FrameworkUbuntu&);
+
+private:
+  /**
+   * Called for initializing on specified backend. (X11 or Wayland)
+   */
+  void InitThreads();
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_UBUNTU_FRAMEWORK_H
diff --git a/dali/internal/adaptor/windows/framework-factory-win.cpp b/dali/internal/adaptor/windows/framework-factory-win.cpp
new file mode 100644 (file)
index 0000000..6d45a3e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/adaptor/windows/framework-factory-win.h>
+
+// INTERNAL HEADERS
+#include <dali/internal/adaptor/windows/framework-win.h>
+#include <dali/internal/window-system/common/display-utils.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+std::unique_ptr<Framework> FrameworkFactoryWin::CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread)
+{
+  return Utils::MakeUnique<FrameworkWin>(observer, taskObserver, argc, argv, type, useUiThread);
+}
+
+std::unique_ptr<FrameworkFactory> GetFrameworkFactory()
+{
+  return Utils::MakeUnique<FrameworkFactoryWin>();
+}
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
diff --git a/dali/internal/adaptor/windows/framework-factory-win.h b/dali/internal/adaptor/windows/framework-factory-win.h
new file mode 100644 (file)
index 0000000..1fe335a
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
+#define DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
+
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+#include <dali/internal/adaptor/common/framework-factory.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class FrameworkFactoryWin : public FrameworkFactory
+{
+public:
+  std::unique_ptr<Framework> CreateFramework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Framework::Type type, bool useUiThread) override;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_FACTORY_H
index 0623baf..90e3fa9 100644 (file)
@@ -1,5 +1,5 @@
 ï»¿/*\r
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.\r
+ * Copyright (c) 2023 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
  * 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
 // CLASS HEADER\r
-#include <dali/internal/adaptor/common/framework.h>\r
+#include <dali/internal/adaptor/windows/framework-win.h>\r
 \r
 // EXTERNAL INCLUDES\r
 #include <dali/integration-api/debug.h>\r
@@ -32,95 +31,18 @@ namespace Internal
 {\r
 namespace Adaptor\r
 {\r
-namespace\r
-{\r
-/// Application Status Enum\r
-enum\r
-{\r
-  APP_CREATE,\r
-  APP_TERMINATE,\r
-  APP_PAUSE,\r
-  APP_RESUME,\r
-  APP_RESET,\r
-  APP_LANGUAGE_CHANGE,\r
-};\r
-\r
-} // Unnamed namespace\r
 /**\r
  * Impl to hide WindowsSystem data members\r
  */\r
-struct Framework::Impl\r
+struct FrameworkWin::Impl\r
 {\r
   // Constructor\r
-\r
   Impl(void* data)\r
-  : mAbortCallBack(NULL),\r
-    mCallbackManager(CallbackManager::New()),\r
-    mLanguage("NOT_SUPPORTED"),\r
-    mRegion("NOT_SUPPORTED")\r
   {\r
   }\r
 \r
   ~Impl()\r
   {\r
-    delete mAbortCallBack;\r
-\r
-    // we're quiting the main loop so\r
-    // mCallbackManager->RemoveAllCallBacks() does not need to be called\r
-    // to delete our abort handler\r
-    delete mCallbackManager;\r
-  }\r
-\r
-  std::string GetLanguage() const\r
-  {\r
-    return mLanguage;\r
-  }\r
-\r
-  std::string GetRegion() const\r
-  {\r
-    return mRegion;\r
-  }\r
-\r
-  // Static methods\r
-\r
-  /**\r
-   * Called by AppCore on application creation.\r
-   */\r
-  static bool AppCreate(void* data)\r
-  {\r
-    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application should terminate.\r
-   */\r
-  static void AppTerminate(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application is paused.\r
-   */\r
-  static void AppPause(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the application is resumed.\r
-   */\r
-  static void AppResume(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);\r
-  }\r
-\r
-  /**\r
-   * Called by AppCore when the language changes on the device.\r
-   */\r
-  static void AppLanguageChange(void* data)\r
-  {\r
-    static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);\r
   }\r
 \r
   void Run()\r
@@ -138,8 +60,6 @@ struct Framework::Impl
       TranslateMessage(&nMsg);\r
       DispatchMessage(&nMsg);\r
 \r
-      mCallbackManager->ClearIdleCallbacks();\r
-\r
       if(WM_CLOSE == nMsg.message)\r
       {\r
         break;\r
@@ -147,61 +67,22 @@ struct Framework::Impl
     }\r
   }\r
 \r
-  void Quit()\r
-  {\r
-  }\r
-\r
-  void SetCallbackBase(CallbackBase* base)\r
-  {\r
-    mAbortCallBack = base;\r
-  }\r
-\r
-  bool ExcuteCallback()\r
-  {\r
-    if(NULL != mAbortCallBack)\r
-    {\r
-      CallbackBase::Execute(*mAbortCallBack);\r
-      return true;\r
-    }\r
-    else\r
-    {\r
-      return false;\r
-    }\r
-  }\r
-\r
 private:\r
   // Undefined\r
   Impl(const Impl& impl) = delete;\r
 \r
   // Undefined\r
   Impl& operator=(const Impl& impl) = delete;\r
-\r
-private:\r
-  // Data\r
-  CallbackBase*    mAbortCallBack;\r
-  CallbackManager* mCallbackManager;\r
-  std::string      mLanguage;\r
-  std::string      mRegion;\r
 };\r
 \r
-Framework::Framework(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)\r
-: mObserver(observer),\r
-  mTaskObserver(taskObserver),\r
-  mInitialised(false),\r
-  mPaused(false),\r
-  mRunning(false),\r
-  mArgc(argc),\r
-  mArgv(argv),\r
-  mBundleName(""),\r
-  mBundleId(""),\r
-  mAbortHandler(MakeCallback(this, &Framework::AbortCallback)),\r
+FrameworkWin::FrameworkWin(Framework::Observer& observer, Framework::TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread)\r
+: Framework(observer, taskObserver, argc, argv, type, useUiThread),\r
   mImpl(NULL)\r
 {\r
-  InitThreads();\r
   mImpl = new Impl(this);\r
 }\r
 \r
-Framework::~Framework()\r
+FrameworkWin::~FrameworkWin()\r
 {\r
   if(mRunning)\r
   {\r
@@ -211,142 +92,18 @@ Framework::~Framework()
   delete mImpl;\r
 }\r
 \r
-void Framework::Run()\r
+void FrameworkWin::Run()\r
 {\r
   mRunning = true;\r
 \r
-  Impl::AppCreate(this);\r
+  mObserver.OnInit();\r
   mImpl->Run();\r
   mRunning = false;\r
 }\r
 \r
-void Framework::Quit()\r
-{\r
-  Impl::AppTerminate(this);\r
-}\r
-\r
-bool Framework::IsMainLoopRunning()\r
-{\r
-  return mRunning;\r
-}\r
-\r
-void Framework::AddAbortCallback(CallbackBase* callback)\r
-{\r
-  mImpl->SetCallbackBase(callback);\r
-}\r
-\r
-std::string Framework::GetBundleName() const\r
-{\r
-  return mBundleName;\r
-}\r
-\r
-void Framework::SetBundleName(const std::string& name)\r
-{\r
-  mBundleName = name;\r
-}\r
-\r
-std::string Framework::GetBundleId() const\r
-{\r
-  return mBundleId;\r
-}\r
-\r
-std::string Framework::GetResourcePath()\r
-{\r
-  // "DALI_APPLICATION_PACKAGE" is used by Windows specifically to get the already configured Application package path.\r
-  const char* winEnvironmentVariable = "DALI_APPLICATION_PACKAGE";\r
-  char*       value                  = getenv(winEnvironmentVariable);\r
-\r
-  std::string resourcePath;\r
-  if(value != NULL)\r
-  {\r
-    resourcePath = value;\r
-  }\r
-\r
-  if(resourcePath.back() != '/')\r
-  {\r
-    resourcePath += "/";\r
-  }\r
-\r
-  return resourcePath;\r
-}\r
-\r
-std::string Framework::GetDataPath()\r
-{\r
-  std::string result = app_get_data_path();\r
-  return result;\r
-}\r
-\r
-void Framework::SetBundleId(const std::string& id)\r
-{\r
-  mBundleId = id;\r
-}\r
-\r
-void Framework::AbortCallback()\r
-{\r
-  // if an abort call back has been installed run it.\r
-  if(false == mImpl->ExcuteCallback())\r
-  {\r
-    Quit();\r
-  }\r
-}\r
-\r
-bool Framework::AppStatusHandler(int type, void* bundleData)\r
-{\r
-  switch(type)\r
-  {\r
-    case APP_CREATE:\r
-    {\r
-      mInitialised = true;\r
-\r
-      mObserver.OnInit();\r
-      break;\r
-    }\r
-    case APP_RESET:\r
-    {\r
-      mObserver.OnReset();\r
-      break;\r
-    }\r
-    case APP_RESUME:\r
-    {\r
-      mObserver.OnResume();\r
-      break;\r
-    }\r
-    case APP_TERMINATE:\r
-    {\r
-      mObserver.OnTerminate();\r
-      break;\r
-    }\r
-    case APP_PAUSE:\r
-    {\r
-      mObserver.OnPause();\r
-      break;\r
-    }\r
-    case APP_LANGUAGE_CHANGE:\r
-    {\r
-      mObserver.OnLanguageChanged();\r
-      break;\r
-    }\r
-    default:\r
-    {\r
-      break;\r
-    }\r
-  }\r
-\r
-  return true;\r
-}\r
-\r
-void Framework::InitThreads()\r
-{\r
-}\r
-\r
-std::string Framework::GetLanguage() const\r
-{\r
-  return mImpl->GetLanguage();\r
-}\r
-\r
-std::string Framework::GetRegion() const\r
+void FrameworkWin::Quit()\r
 {\r
-  return mImpl->GetRegion();\r
+  mObserver.OnTerminate();\r
 }\r
 \r
 } // namespace Adaptor\r
diff --git a/dali/internal/adaptor/windows/framework-win.h b/dali/internal/adaptor/windows/framework-win.h
new file mode 100644 (file)
index 0000000..d155a09
--- /dev/null
@@ -0,0 +1,72 @@
+#ifndef DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
+#define DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
+
+/*
+ * Copyright (c) 2023 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.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/adaptor/common/framework.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+/**
+ * FrameworkWin class provides an Framework Windows implementation.
+ */
+class FrameworkWin : public Framework
+{
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework()
+   */
+  FrameworkWin(Observer& observer, TaskObserver& taskObserver, int* argc, char*** argv, Type type, bool useUiThread);
+
+  /**
+   * Destructor
+   */
+  ~FrameworkWin();
+
+public:
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Run()
+   */
+  void Run() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::Framework::Quit()
+   */
+  void Quit() override;
+
+private:
+  // Undefined
+  FrameworkWin(const FrameworkWin&);
+  FrameworkWin& operator=(FrameworkWin&);
+
+private: // impl members
+  struct Impl;
+  Impl* mImpl;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ADAPTOR_WINDOWS_FRAMEWORK_H
index bdeadae..877308a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -15,9 +15,7 @@
  *
  */
 
-// EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
 namespace Dali
@@ -26,16 +24,20 @@ namespace Internal
 {
 namespace Adaptor
 {
-int GetElmAccessActionOver()
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return 0;
+  return DALI_DATA_RO_DIR;
 }
 
-int GetLongPressTime(int defaultTime)
+std::string GetDataPath()
 {
-  return defaultTime;
+  return "";
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index 1fd4ea8..4150ec6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SYSTEM_SETTINGS_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <string>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-// Get SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY from system setting if available
-int GetLongPressTime(int defaultTime);
+namespace SystemSettings
+{
+/**
+ *  Gets the path at which application resources are stored.
+ */
+std::string GetResourcePath();
+
+/**
+ *  Gets the path at which application data are stored.
+ */
+std::string GetDataPath();
 
-// Get ELM_ACCESS_ACTION_OVER from Elementary if available
-int GetElmAccessActionOver();
+} // namespace SystemSettings
 
 } // namespace Adaptor
 
index d366736..c22e0b2 100644 (file)
@@ -133,6 +133,7 @@ SET( adaptor_system_windows_src_files
 SET( adaptor_system_macos_src_files
     ${adaptor_system_dir}/ubuntu-x11/logging-x.cpp
     ${adaptor_system_dir}/macos/file-descriptor-monitor-macos.cpp
+    ${adaptor_system_dir}/macos/system-settings-mac.cpp
     ${adaptor_system_dir}/macos/timer-impl-mac.cpp
     ${adaptor_system_dir}/common/shared-file.cpp
     ${adaptor_system_dir}/common/trigger-event-factory.cpp
index f6724da..948a659 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -59,7 +59,7 @@ struct CallbackData
       mSource = g_idle_source_new();
       g_source_set_priority(mSource, G_PRIORITY_HIGH_IDLE);
       g_source_set_callback(mSource, &CallbackData::IdleCallback, this, nullptr); // No destroyNotify
-      guint id = g_source_attach(mSource, context);
+      g_source_attach(mSource, context);
     }
   }
 
diff --git a/dali/internal/system/macos/system-settings-mac.cpp b/dali/internal/system/macos/system-settings-mac.cpp
new file mode 100644 (file)
index 0000000..98c59ea
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2023 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/system/common/system-settings.h>
+
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+namespace SystemSettings
+{
+std::string GetResourcePath()
+{
+  // "DALI_APPLICATION_PACKAGE" is used by macOS specifically to get the already configured Application package path.
+  const char* macEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                  = getenv(macEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
+}
+
+std::string GetDataPath()
+{
+  const char* macEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                  = getenv(macEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
+}
+
+} // namespace SystemSettings
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index ea151a3..1e9d53d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  *
  */
 
+// CLASS HEADER
+#include <dali/internal/system/common/system-settings.h>
+
 // EXTERNAL INCLUDES
-#include <system_settings.h>
+#include <app_common.h>
 
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/system-settings.h>
+#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
+#include <tzplatform_config.h>
+#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
 
 namespace Dali
 {
@@ -27,16 +31,52 @@ namespace Internal
 {
 namespace Adaptor
 {
-int GetLongPressTime(int defaultTime)
+namespace SystemSettings
 {
-  return defaultTime;
+std::string GetResourcePath()
+{
+  std::string resourcePath = "";
+#if defined(TIZEN_PLATFORM_CONFIG_SUPPORTED) && TIZEN_PLATFORM_CONFIG_SUPPORTED
+  char* app_rsc_path = app_get_resource_path();
+  if(app_rsc_path)
+  {
+    resourcePath = app_rsc_path;
+    free(app_rsc_path);
+  }
+#else // For backwards compatibility with older Tizen versions
+
+  // "DALI_APPLICATION_PACKAGE" is used to get the already configured Application package path.
+  const char* environmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value               = getenv(environmentVariable);
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+#endif // TIZEN_PLATFORM_CONFIG_SUPPORTED
+
+  return resourcePath;
 }
 
-int GetElmAccessActionOver()
+std::string GetDataPath()
 {
-  return 0;
+  std::string result;
+  char*       dataPath = app_get_data_path();
+  if(dataPath)
+  {
+    result = dataPath;
+    free(dataPath);
+  }
+  return result;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index bfaca6a..bd37ba8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  *
  */
 
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-int GetElmAccessActionOver()
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return 0;
+  // "DALI_APPLICATION_PACKAGE" is used by Ubuntu specifically to get the already configured Application package path.
+  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                     = getenv(ubuntuEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
 }
 
-int GetLongPressTime(int defaultTime)
+std::string GetDataPath()
 {
-  return defaultTime;
+  const char* ubuntuEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                     = getenv(ubuntuEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index c4d82b3..6dd6ab7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
  *
  */
 
-// INTERNAL INCLUDES
+// CLASS HEADER
 #include <dali/internal/system/common/system-settings.h>
 
+// EXTERNAL INCLUDES
+#include <stdlib.h>
+
 namespace Dali
 {
 namespace Internal
 {
 namespace Adaptor
 {
-int GetLongPressTime(int defaultTime)
+namespace SystemSettings
+{
+std::string GetResourcePath()
 {
-  return defaultTime;
+  // "DALI_APPLICATION_PACKAGE" is used by Windows specifically to get the already configured Application package path.
+  const char* winEnvironmentVariable = "DALI_APPLICATION_PACKAGE";
+  char*       value                  = getenv(winEnvironmentVariable);
+  std::string resourcePath;
+  if(value != NULL)
+  {
+    resourcePath = value;
+  }
+
+  if(resourcePath.back() != '/')
+  {
+    resourcePath += "/";
+  }
+
+  return resourcePath;
 }
 
-int GetElmAccessActionOver()
+std::string GetDataPath()
 {
-  return 0;
+  const char* winEnvironmentVariable = "DALI_APPLICATION_DATA_DIR";
+  char*       value                  = getenv(winEnvironmentVariable);
+  std::string dataPath;
+  if(value != NULL)
+  {
+    dataPath = value;
+  }
+
+  return dataPath;
 }
 
+} // namespace SystemSettings
+
 } // namespace Adaptor
 
 } // namespace Internal
index 918eeac..2587713 100644 (file)
@@ -25,7 +25,6 @@ SET( adaptor_resampler_src_files
 
 SET( adaptor_windows_platform_src_files
     ${adaptor_thirdparty_dir}/windows-platform/dlfcn.cpp
-    ${adaptor_thirdparty_dir}/windows-platform/environment.cpp
     ${adaptor_thirdparty_dir}/windows-platform/network.cpp
     ${adaptor_thirdparty_dir}/windows-platform/thread.cpp
     ${adaptor_thirdparty_dir}/windows-platform/Win32File/CustomFile.cpp
@@ -39,6 +38,5 @@ SET( static_libraries_nanosvg_src_files
 )
 
 SET( adaptor_macos_platform_src_files
-    ${adaptor_thirdparty_dir}/macos-platform/environment.cpp
     ${adaptor_thirdparty_dir}/macos-platform/thread.cpp
 )
diff --git a/third-party/macos-platform/environment.cpp b/third-party/macos-platform/environment.cpp
deleted file mode 100644 (file)
index ddecce9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <cstdlib>
-#include <string>
-
-const char* app_get_data_path()
-{
-  static std::string envValue;
-
-  if( envValue.empty() )
-  {
-    envValue = std::getenv( "DemoData" );
-    envValue += "/";
-  }
-
-  return envValue.c_str();
-}
index c6af7e2..f7a4a8c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -21,8 +21,6 @@
 #include <memory>
 #include <type_traits>
 
-const char* app_get_data_path();
-
 // Specialiation of std::unique_ptr for Foundation Objects
 template<typename T>
 using CFRef = std::unique_ptr<
diff --git a/third-party/windows-platform/environment.cpp b/third-party/windows-platform/environment.cpp
deleted file mode 100644 (file)
index f218e20..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <cstdlib>
-#include <string>
-
-using namespace std;
-
-const char* app_get_data_path()
-{
-  static std::string envValue = "";
-
-  if( true == envValue.empty() )
-  {
-    envValue = std::getenv( "DemoData" );
-    envValue += "/";
-  }
-
-  return envValue.c_str();
-}
index 4b4ef27..5efd789 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -20,8 +20,6 @@
 
 #include <xlocale>
 
-const char* app_get_data_path();
-
 static int strncasecmp(const char *s1, const char *s2, register int n)
 {
   while (--n >= 0 && toupper((unsigned char)*s1) == toupper((unsigned char)*s2++))