Merge remote-tracking branch 'origin/tizen' into new_text 63/36463/3
authorPaul Wisbey <p.wisbey@samsung.com>
Fri, 6 Mar 2015 15:40:09 +0000 (15:40 +0000)
committerPaul Wisbey <p.wisbey@samsung.com>
Fri, 6 Mar 2015 16:07:49 +0000 (16:07 +0000)
Conflicts:
build/tizen/adaptor/Makefile.am
platform-abstractions/slp/slp-platform-abstraction.cpp
platform-abstractions/slp/slp-platform-abstraction.h

Change-Id: Ie98f87b62386114568d85bd23d87c909e18fe6b5

26 files changed:
adaptors/common/adaptor-impl.cpp
adaptors/common/adaptor-impl.h
adaptors/common/application-impl.cpp
adaptors/common/application-impl.h
adaptors/common/framework.h
adaptors/common/indicator-impl.cpp
adaptors/common/indicator-impl.h
adaptors/common/server-connection.cpp
adaptors/public-api/adaptor-framework/application.cpp
adaptors/public-api/adaptor-framework/application.h
adaptors/tizen/adaptor-impl-tizen.cpp [new file with mode: 0644]
adaptors/tizen/file.list
adaptors/tizen/framework-tizen.cpp
adaptors/ubuntu/adaptor-impl-ubuntu.cpp [new file with mode: 0644]
adaptors/ubuntu/file.list
adaptors/ubuntu/framework-ubuntu.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.cpp
automated-tests/src/dali-adaptor/dali-test-suite-utils/test-platform-abstraction.h
build/tizen/adaptor/Makefile.am
build/tizen/configure.ac
packaging/dali-adaptor-mobile.spec
packaging/dali-adaptor-tv.spec
packaging/dali-adaptor-wearable.spec
packaging/dali-adaptor.spec
platform-abstractions/slp/slp-platform-abstraction.cpp
platform-abstractions/slp/slp-platform-abstraction.h

index 7699efc..652c057 100644 (file)
@@ -225,6 +225,10 @@ void Adaptor::Initialize(Dali::Configuration::ContextLoss configuration)
 
   mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
 
+  std::string path;
+  GetDataStoragePath( path );
+  mPlatformAbstraction->SetDataStoragePath( path );
+
   ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
   if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
   {
index a5bc94b..b650e8a 100644 (file)
@@ -449,6 +449,12 @@ private:
    */
   void ProcessCoreEventsFromIdle();
 
+  /**
+   * Gets path for data/resource storage.
+   * @param[out] path Path for data/resource storage
+   */
+  void GetDataStoragePath(std::string& path);
+
 private:
 
   /**
index 9610a66..d4ce1fc 100644 (file)
@@ -72,7 +72,11 @@ Application::Application( int* argc, char** argv[], const std::string& name, con
   mResumeSignal(),
   mResetSignal(),
   mResizeSignal(),
+  mAppControlSignal(),
   mLanguageChangedSignal(),
+  mRegionChangedSignal(),
+  mBatteryLowSignal(),
+  mMemoryLowSignal(),
   mEventLoop( NULL ),
   mFramework( NULL ),
   mCommandLineOptions( NULL ),
@@ -238,11 +242,35 @@ void Application::OnReset()
   mWindow.Raise();
 }
 
+void Application::OnAppControl(void *data)
+{
+  Dali::Application application(this);
+  mAppControlSignal.Emit( application , data );
+}
+
 void Application::OnLanguageChanged()
 {
   mAdaptor->NotifyLanguageChanged();
 }
 
+void Application::OnRegionChanged()
+{
+  Dali::Application application(this);
+  mRegionChangedSignal.Emit( application );
+}
+
+void Application::OnBatteryLow()
+{
+  Dali::Application application(this);
+  mBatteryLowSignal.Emit( application );
+}
+
+void Application::OnMemoryLow()
+{
+  Dali::Application application(this);
+  mMemoryLowSignal.Emit( application );
+}
+
 void Application::OnResize(Dali::Adaptor& adaptor)
 {
   Dali::Application application(this);
index 919a7e3..64ce521 100644 (file)
@@ -55,6 +55,7 @@ class Application : public BaseObject, public Framework::Observer
 public:
 
   typedef Dali::Application::AppSignalType AppSignalType;
+  typedef Dali::Application::AppControlSignalType AppControlSignalType;
 
   /**
    * Constructor
@@ -168,6 +169,12 @@ public: // From Framework::Observer
   virtual void OnResume();
 
   /**
+  * Called when the framework received AppControlSignal.
+  * @param[in] The bundle data of AppControl event.
+  */
+  virtual void OnAppControl(void *data);
+
+  /**
    * Called when the framework informs the application that it should reset itself.
    */
   virtual void OnReset();
@@ -177,6 +184,21 @@ public: // From Framework::Observer
    */
   virtual void OnLanguageChanged();
 
+  /**
+  * Called when the framework informs the application that the region of the device has changed.
+  */
+  virtual void OnRegionChanged();
+
+  /**
+  * Called when the framework informs the application that the battery level of the device is low.
+  */
+  virtual void OnBatteryLow();
+
+  /**
+  * Called when the framework informs the application that the memory level of the device is low.
+  */
+  virtual void OnMemoryLow();
+
 public:
 
   /**
@@ -213,6 +235,11 @@ public:  // Signals
   Dali::Application::AppSignalType& ResetSignal() { return mResetSignal; }
 
   /**
+  * @copydoc Dali::Application::AppControlSignal()
+  */
+  Dali::Application::AppControlSignalType& AppControlSignal() { return mAppControlSignal; }
+
+  /**
    * @copydoc Dali::Application::ResizeSignal()
    */
   Dali::Application::AppSignalType& ResizeSignal() { return mResizeSignal; }
@@ -222,6 +249,21 @@ public:  // Signals
    */
   Dali::Application::AppSignalType& LanguageChangedSignal() { return mLanguageChangedSignal; }
 
+  /**
+  * @copydoc Dali::Application::RegionChangedSignal()
+  */
+  Dali::Application::AppSignalType& RegionChangedSignal() { return mRegionChangedSignal; }
+
+  /**
+  * @copydoc Dali::Application::BatteryLowSignal()
+  */
+  Dali::Application::AppSignalType& BatteryLowSignal() { return mBatteryLowSignal; }
+
+  /**
+  * @copydoc Dali::Application::MemoryLowSignal()
+  */
+  Dali::Application::AppSignalType& MemoryLowSignal() { return mMemoryLowSignal; }
+
 private:
 
   // Undefined
@@ -252,7 +294,12 @@ private:
   AppSignalType                           mResumeSignal;
   AppSignalType                           mResetSignal;
   AppSignalType                           mResizeSignal;
+  AppControlSignalType                    mAppControlSignal;
   AppSignalType                           mLanguageChangedSignal;
+  AppSignalType                           mRegionChangedSignal;
+  AppSignalType                           mBatteryLowSignal;
+  AppSignalType                           mMemoryLowSignal;
+
 
   EventLoop*                            mEventLoop;
   Framework*                            mFramework;
index 19c5d25..4e414ba 100644 (file)
@@ -76,9 +76,31 @@ public:
     virtual void OnReset() {}
 
     /**
+    * Invoked when the AppControl message is received.
+    * @param[in] The bundle data of AppControl message.
+    */
+    virtual void OnAppControl(void *) {}
+
+    /**
      * Invoked when the language of the device is changed.
      */
     virtual void OnLanguageChanged() {}
+
+    /**
+    * Invoked when the region is changed.
+    */
+    virtual void OnRegionChanged() {}
+
+    /**
+    * Invoked when the battery level of the device is low.
+    */
+    virtual void OnBatteryLow() {}
+
+    /**
+    * Invoked when the memory level of the device is low.
+    */
+    virtual void OnMemoryLow() {}
+
   };
 
 public:
@@ -140,10 +162,11 @@ private:
 
 private:
   /**
-   * Called by the SLP framework when an application lifecycle event occurs.
+   * Called by the App framework when an application lifecycle event occurs.
    * @param[in]  type  The type of event occurred.
+   * @param[in] bundleData The bundle data of event occurred.
    */
-  bool SlpAppStatusHandler(int type);
+   bool AppStatusHandler(int type, void *bundleData);
 
   /**
    * Called app_reset callback was called with bundle.
index 0fa4860..98d8fe9 100644 (file)
@@ -97,58 +97,46 @@ const char* MESH_FRAGMENT_SHADER =
 "  gl_FragColor = vColor*uColor;\n"
 "}\n";
 
-// Copied from elm_win.h
-
-/**
- * Defines the type modes of indicator that can be shown
- * If the indicator can support several type of indicator,
- * you can use this enum value to deal with different type of indicator
- */
-typedef enum
-{
-   ELM_WIN_INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
-   ELM_WIN_INDICATOR_TYPE_1, /**< Type 0 the the indicator */
-   ELM_WIN_INDICATOR_TYPE_2, /**< Type 1 the indicator */
-} Elm_Win_Indicator_Type_Mode;
-
-// Copied from ecore_evas_extn.c
+// Copied from ecore_evas_extn_engine.h
 
 enum // opcodes
 {
-  OP_RESIZE,
-  OP_SHOW,
-  OP_HIDE,
-  OP_FOCUS,
-  OP_UNFOCUS,
-  OP_UPDATE,
-  OP_UPDATE_DONE,
-  OP_LOCK_FILE,
-  OP_SHM_REF,
-  OP_EV_MOUSE_IN,
-  OP_EV_MOUSE_OUT,
-  OP_EV_MOUSE_UP,
-  OP_EV_MOUSE_DOWN,
-  OP_EV_MOUSE_MOVE,
-  OP_EV_MOUSE_WHEEL,
-  OP_EV_MULTI_UP,
-  OP_EV_MULTI_DOWN,
-  OP_EV_MULTI_MOVE,
-  OP_EV_KEY_UP,
-  OP_EV_KEY_DOWN,
-  OP_EV_HOLD,
-  OP_MSG_PARENT,
-  OP_MSG,
-  OP_PIXMAP_REF
+   OP_RESIZE,
+   OP_SHOW,
+   OP_HIDE,
+   OP_FOCUS,
+   OP_UNFOCUS,
+   OP_UPDATE,
+   OP_UPDATE_DONE,
+   OP_SHM_REF0,
+   OP_SHM_REF1,
+   OP_SHM_REF2,
+   OP_PROFILE_CHANGE_REQUEST,
+   OP_PROFILE_CHANGE_DONE,
+   OP_EV_MOUSE_IN,
+   OP_EV_MOUSE_OUT,
+   OP_EV_MOUSE_UP,
+   OP_EV_MOUSE_DOWN,
+   OP_EV_MOUSE_MOVE,
+   OP_EV_MOUSE_WHEEL,
+   OP_EV_MULTI_UP,
+   OP_EV_MULTI_DOWN,
+   OP_EV_MULTI_MOVE,
+   OP_EV_KEY_UP,
+   OP_EV_KEY_DOWN,
+   OP_EV_HOLD,
+   OP_MSG_PARENT,
+   OP_MSG
 };
 
 // Copied from elm_conform.c
 
-const int MSG_DOMAIN_CONTROL_INDICATOR(0x10001);
-const int MSG_ID_INDICATOR_REPEAT_EVENT(0x10002);
-const int MSG_ID_INDICATOR_ROTATION(0x10003);
-const int MSG_ID_INDICATOR_OPACITY(0X1004);
-const int MSG_ID_INDICATOR_TYPE(0X1005);
-const int MSG_ID_INDICATOR_START_ANIMATION(0X10006);
+const int MSG_DOMAIN_CONTROL_INDICATOR( 0x10001 );
+const int MSG_ID_INDICATOR_REPEAT_EVENT( 0x10002 );
+const int MSG_ID_INDICATOR_ROTATION( 0x10003 );
+const int MSG_ID_INDICATOR_OPACITY( 0X1004 );
+const int MSG_ID_INDICATOR_TYPE( 0X1005 );
+const int MSG_ID_INDICATOR_START_ANIMATION( 0X10006 );
 
 struct IpcDataUpdate
 {
@@ -273,11 +261,11 @@ Debug::Filter* gIndicatorLogFilter = Debug::Filter::New(Debug::Concise, false, "
 #endif
 
 
-Indicator::LockFile::LockFile(const char* filename)
+Indicator::LockFile::LockFile(const std::string filename)
 : mFilename(filename),
   mErrorThrown(false)
 {
-  mFileDescriptor = open(filename, O_RDWR);
+  mFileDescriptor = open(filename.c_str(), O_RDWR);
   if( mFileDescriptor == -1 )
   {
     mFileDescriptor = 0;
@@ -372,8 +360,6 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat
   mState( DISCONNECTED ),
   mAdaptor(adaptor),
   mServerConnection( NULL ),
-  mLock( NULL ),
-  mSharedFile( NULL ),
   mObserver( observer ),
   mOrientation( orientation ),
   mRotation( 0 ),
@@ -381,7 +367,8 @@ Indicator::Indicator( Adaptor* adaptor, Dali::Window::WindowOrientation orientat
   mImageHeight( 0 ),
   mVisible( Dali::Window::INVISIBLE ),
   mIsShowing( true ),
-  mIsAnimationPlaying( false )
+  mIsAnimationPlaying( false ),
+  mCurrentSharedFile( 0 )
 {
   mIndicatorImageActor = Dali::ImageActor::New();
   mIndicatorImageActor.SetBlendFunc( Dali::BlendingFactor::ONE, Dali::BlendingFactor::ONE_MINUS_SRC_ALPHA,
@@ -479,7 +466,7 @@ void Indicator::Open( Dali::Window::WindowOrientation orientation )
 
 void Indicator::Close()
 {
-  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s\n", STATE_DEBUG_STRING(mState) );
+  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s", STATE_DEBUG_STRING(mState) );
 
   if( mState == CONNECTED )
   {
@@ -507,7 +494,7 @@ void Indicator::SetVisible( Dali::Window::IndicatorVisibleMode visibleMode, bool
     // If we were previously hidden, then we should update the image data before we display the indicator
     if ( mVisible == Dali::Window::INVISIBLE )
     {
-      UpdateImageData();
+      UpdateImageData( mCurrentSharedFile );
     }
     if ( visibleMode != Dali::Window::INVISIBLE )
     {
@@ -762,34 +749,10 @@ void Indicator::Disconnect()
 
   mState = DISCONNECTED;
 
-  delete mLock;
-  mLock = NULL;
-
-  delete mSharedFile;
-  mSharedFile = NULL;
-
   delete mServerConnection;
   mServerConnection = NULL;
-}
-
-void Indicator::NewLockFile( Ecore_Ipc_Event_Server_Data *epcEvent )
-{
-  DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
-  delete mLock;
-  mLock = NULL;
 
-  if ( (epcEvent->data) &&
-       (epcEvent->size > 0) &&
-       (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
-  {
-    const char* lockFile = static_cast< const char* >( epcEvent->data );
-    mLock = new Indicator::LockFile( lockFile );
-    if( mLock->RetrieveAndClearErrorStatus() )
-    {
-      DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", lockFile );
-    }
-  }
+  ClearSharedFileInfo();
 }
 
 void Indicator::Resize( int width, int height )
@@ -808,38 +771,121 @@ void Indicator::Resize( int width, int height )
     mImageWidth = width;
     mImageHeight = height;
 
-    // We don't currently handle the pixel buffer size being changed. Create a new image instead
-    if( mSharedFile )
+    mIndicatorImageActor.SetSize( mImageWidth, mImageHeight );
+    mIndicatorActor.SetSize( mImageWidth, mImageHeight );
+    mEventActor.SetSize(mImageWidth, mImageHeight);
+
+    SetBackground();
+    if( mBackgroundActor )
     {
-      CreateNewImage();
+      mBackgroundActor.SetSize( mImageWidth, mImageHeight );
     }
   }
 }
 
-void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+void Indicator::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
 {
   DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
 
   // epcEvent->ref == w
   // epcEvent->ref_to == h
-  // epcEvent->response == alpha
-  // epcEvent->data = pixmap id
-  if( ( epcEvent->data ) &&
-      (epcEvent->size >= (int)sizeof(PixmapId)) )
+  // epcEvent->response == buffer num
+  // epcEvent->data = lockfile + nul byte
+
+  if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) &&
+      (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
   {
-    if( mSharedFile != NULL )
+    int n = epcEvent->response;
+
+    if( n >= 0 && n < SHARED_FILE_NUMBER )
     {
-      delete mSharedFile;
-      mSharedFile = NULL;
+      mCurrentSharedFile = n;
+
+      mSharedFileInfo[n].mImageWidth  = epcEvent->ref;
+      mSharedFileInfo[n].mImageHeight = epcEvent->ref_to;
+
+      mSharedFileInfo[n].mLockFileName.clear();
+
+      mSharedFileInfo[n].mLockFileName = static_cast< char* >( epcEvent->data );
+
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetLockFileInfo: buffer num = %d, w = %d, h = %d, lock = %s\n",
+                     n, mSharedFileInfo[n].mImageWidth, mSharedFileInfo[n].mImageHeight, mSharedFileInfo[n].mLockFileName.c_str() );
     }
+  }
+}
 
-    if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
+void Indicator::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
+{
+  DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
+
+  // epcEvent->ref == shm id
+  // epcEvent->ref_to == shm num
+  // epcEvent->response == buffer num
+  // epcEvent->data = shm ref string + nul byte
+
+  if ( (epcEvent->data) &&
+       (epcEvent->size > 0) &&
+       (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
+  {
+    int n = epcEvent->response;
+
+    if( n >= 0 && n < SHARED_FILE_NUMBER )
     {
-      mImageWidth  = epcEvent->ref;
-      mImageHeight = epcEvent->ref_to;
+      mCurrentSharedFile = n;
 
-      mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
-      CreateNewPixmapImage();
+      mSharedFileInfo[n].mSharedFileName.clear();
+
+      mSharedFileInfo[n].mSharedFileName = static_cast< char* >( epcEvent->data );
+
+      mSharedFileInfo[n].mSharedFileID = epcEvent->ref;
+      mSharedFileInfo[n].mSharedFileNumber = epcEvent->ref_to;
+
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetSharedImageInfo: buffer num %d, shared file = %s, id = %d, num = %d\n",
+                     n, mSharedFileInfo[n].mSharedFileName.c_str(), mSharedFileInfo[n].mSharedFileID, mSharedFileInfo[n].mSharedFileNumber );
+    }
+  }
+}
+
+void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+{
+  DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
+
+  // epcEvent->ref == alpha
+  // epcEvent->ref_to == sys
+  // epcEvent->response == buffer num
+
+  int n = epcEvent->response;
+
+  if( n >= 0 && n < SHARED_FILE_NUMBER )
+  {
+    mCurrentSharedFile = n;
+
+    delete mSharedFileInfo[n].mSharedFile;
+    mSharedFileInfo[n].mSharedFile = NULL;
+
+    delete mSharedFileInfo[n].mLock;
+    mSharedFileInfo[n].mLock = NULL;
+
+    std::stringstream sharedFileID;
+    std::stringstream sharedFileNumber;
+
+    sharedFileID << mSharedFileInfo[n].mSharedFileID;
+    sharedFileNumber << mSharedFileInfo[n].mSharedFileNumber;
+
+    std::string sharedFilename = "/" + mSharedFileInfo[n].mSharedFileName + "-" + sharedFileID.str() + "." + sharedFileNumber.str();
+
+    DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "LoadSharedImage: file name = %s\n", sharedFilename.c_str() );
+
+    mSharedFileInfo[n].mSharedFile = SharedFile::New( sharedFilename.c_str(), mSharedFileInfo[n].mImageWidth * mSharedFileInfo[n].mImageWidth * 4, true );
+    if( mSharedFileInfo[n].mSharedFile != NULL )
+    {
+      mSharedFileInfo[n].mLock = new Indicator::LockFile( mSharedFileInfo[n].mLockFileName );
+      if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() )
+      {
+        DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
+      }
+
+      CreateNewImage( n );
 
       if( CheckVisibleState() )
       {
@@ -857,63 +903,54 @@ void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
   }
 }
 
-void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
 {
   DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
 
   // epcEvent->ref == w
   // epcEvent->ref_to == h
   // epcEvent->response == alpha
-  // epcEvent->data = shm ref string + nul byte
+  // epcEvent->data = pixmap id
+
   if( ( epcEvent->data ) &&
-      ( ( unsigned char * ) epcEvent->data)[ epcEvent->size - 1 ] == 0 )
+      (epcEvent->size >= (int)sizeof(PixmapId)) )
   {
-    if( mSharedFile != NULL )
-    {
-      delete mSharedFile;
-      mSharedFile = NULL;
-    }
+    ClearSharedFileInfo();
 
     if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
     {
       mImageWidth  = epcEvent->ref;
       mImageHeight = epcEvent->ref_to;
 
-      char* sharedFilename = static_cast<char*>(epcEvent->data);
+      mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
+      CreateNewPixmapImage();
 
-      mSharedFile = SharedFile::New( sharedFilename, mImageWidth * mImageWidth * 4, true );
-      if( mSharedFile != NULL )
+      if( CheckVisibleState() )
       {
-        CreateNewImage();
-        mEventActor.SetSize(mImageWidth, mImageHeight);
-
-        if( CheckVisibleState() )
-        {
-          // set default indicator type (enable the quick panel)
-          OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
-        }
-        else
-        {
-          // set default indicator type (disable the quick panel)
-          OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
-        }
-
-        SetVisible(mVisible, true);
+        // set default indicator type (enable the quick panel)
+        OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
+      }
+      else
+      {
+        // set default indicator type (disable the quick panel)
+        OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
       }
+
+      SetVisible(mVisible, true);
     }
   }
 }
 
-void Indicator::UpdateImageData()
+void Indicator::UpdateImageData( int bufferNumber )
 {
-  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s  mVisible: %s\n", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
+  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s  mVisible: %s", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
 
   if( mState == CONNECTED && mVisible )
   {
     if(mPixmap == 0)
     {
       // in case of shm indicator (not pixmap), not sure we can skip it when mIsShowing is false
-      CopyToBuffer();
+      CopyToBuffer( bufferNumber );
     }
     else
     {
@@ -925,21 +962,21 @@ void Indicator::UpdateImageData()
   }
 }
 
-bool Indicator::CopyToBuffer()
+bool Indicator::CopyToBuffer( int bufferNumber )
 {
   bool success = false;
 
-  if( mLock )
+  if( mSharedFileInfo[bufferNumber].mLock )
   {
-    Indicator::ScopedLock scopedLock(mLock);
-    if( mLock->RetrieveAndClearErrorStatus() )
+    Indicator::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock);
+    if( mSharedFileInfo[bufferNumber].mLock->RetrieveAndClearErrorStatus() )
     {
       // Do nothing here.
     }
     else if( scopedLock.IsLocked() )
     {
-      unsigned char *src = mSharedFile->GetAddress();
-      size_t size = mImageWidth * mImageHeight * 4;
+      unsigned char *src = mSharedFileInfo[bufferNumber].mSharedFile->GetAddress();
+      size_t size = mSharedFileInfo[bufferNumber].mImageWidth * mSharedFileInfo[bufferNumber].mImageHeight * 4;
 
       if( mIndicatorBuffer->UpdatePixels( src, size ) )
       {
@@ -984,7 +1021,7 @@ void Indicator::SetBackground()
 
 void Indicator::CreateNewPixmapImage()
 {
-  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
+  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mImageWidth, mImageHeight );
   Dali::PixmapImagePtr pixmapImage = Dali::PixmapImage::New( mPixmap );
 
   if( pixmapImage )
@@ -1013,24 +1050,15 @@ void Indicator::CreateNewPixmapImage()
   }
 }
 
-void Indicator::CreateNewImage()
+void Indicator::CreateNewImage( int bufferNumber )
 {
-  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
-  mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mImageWidth, mImageHeight, Pixel::BGRA8888 );
+  DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight );
+  mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight, Pixel::BGRA8888 );
   Dali::Image image = Dali::NativeImage::New( mIndicatorBuffer->GetNativeImage() );
 
-  if( CopyToBuffer() ) // Only create images if we have valid image buffer
+  if( CopyToBuffer( bufferNumber ) ) // Only create images if we have valid image buffer
   {
     mIndicatorImageActor.SetImage( image );
-    mIndicatorImageActor.SetSize( mImageWidth, mImageHeight );
-    mIndicatorActor.SetSize( mImageWidth, mImageHeight );
-    mEventActor.SetSize(mImageWidth, mImageHeight);
-
-    SetBackground();
-    if( mBackgroundActor )
-    {
-      mBackgroundActor.SetSize( mImageWidth, mImageHeight );
-    }
   }
   else
   {
@@ -1061,34 +1089,41 @@ void Indicator::DataReceived( void* event )
   switch( epcEvent->minor )
   {
     case OP_UPDATE:
+    {
       DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
-      if(mPixmap != 0 && mIsShowing)
+      if( mPixmap != 0 && mIsShowing )
       {
         mAdaptor->RequestUpdateOnce();
       }
       break;
-
+    }
     case OP_UPDATE_DONE:
-      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE\n" );
-      UpdateImageData();
+    {
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response );
+      // epcEvent->response == display buffer #
+      UpdateImageData( epcEvent->response );
       break;
-
-    case OP_LOCK_FILE:
-      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_LOCK_FILE\n" );
-      NewLockFile( epcEvent );
+    }
+    case OP_SHM_REF0:
+    {
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF0\n" );
+      SetSharedImageInfo( epcEvent );
       break;
-
-    case OP_SHM_REF:
-      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF\n" );
-      LoadSharedImage( epcEvent );
+    }
+    case OP_SHM_REF1:
+    {
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF1\n" );
+      SetLockFileInfo( epcEvent );
       break;
-
-    case OP_PIXMAP_REF:
-      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_PIXMAP_REF\n" );
-      LoadPixmapImage( epcEvent );
+    }
+    case OP_SHM_REF2:
+    {
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF2\n" );
+      LoadSharedImage( epcEvent );
       break;
-
+    }
     case OP_RESIZE:
+    {
       DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" );
 
       if( (epcEvent->data) && (epcEvent->size >= (int)sizeof(IpcDataResize)) )
@@ -1097,7 +1132,7 @@ void Indicator::DataReceived( void* event )
         Resize( newSize->w, newSize->h );
       }
       break;
-
+    }
     case OP_MSG_PARENT:
     {
       int msgDomain = epcEvent->ref;
@@ -1108,6 +1143,8 @@ void Indicator::DataReceived( void* event )
       msgData = epcEvent->data;
       msgDataSize = epcEvent->size;
 
+      DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT. msgDomain = %d\n", msgDomain );
+
       if( msgDomain == MSG_DOMAIN_CONTROL_INDICATOR )
       {
         switch( msgId )
@@ -1122,6 +1159,8 @@ void Indicator::DataReceived( void* event )
 
           case MSG_ID_INDICATOR_START_ANIMATION:
           {
+            DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: MSG_ID_INDICATOR_START_ANIMATION\n" );
+
             if (msgDataSize != (int)sizeof(IpcIndicatorDataAnimation))
             {
               DALI_LOG_ERROR("Message data is incorrect");
@@ -1208,6 +1247,21 @@ void Indicator::ConstructBackgroundMesh()
   mBackgroundActor.SetShaderEffect(shaderEffect);
 }
 
+void Indicator::ClearSharedFileInfo()
+{
+  for( int i = 0; i < SHARED_FILE_NUMBER; i++ )
+  {
+    delete mSharedFileInfo[i].mLock;
+    mSharedFileInfo[i].mLock = NULL;
+
+    delete mSharedFileInfo[i].mSharedFile;
+    mSharedFileInfo[i].mSharedFile = NULL;
+
+    mSharedFileInfo[i].mLockFileName.clear();
+    mSharedFileInfo[i].mSharedFileName.clear();
+  }
+}
+
 /**
  * duration can be this
  *
index d499cbf..d35dd7d 100644 (file)
@@ -101,7 +101,7 @@ protected:
     /**
      * Constructor. open lock file
      */
-    LockFile(const char* filename);
+    LockFile(const std::string filename);
 
     /**
      * Close lock file
@@ -305,23 +305,29 @@ private:
   void Disconnect();
 
   /**
-   * Close existing lock file and open the new lock file.
+   * Handle Resize event
+   * @param[in] width The new width
+   * @param[in] height The new height
+   */
+  void Resize( int width, int height );
+
+  /**
+   * Set the lock file info.
    * @param[in] epcEvent Current ecore event.
    */
-  void NewLockFile(Ecore_Ipc_Event_Server_Data *epcEvent);
+  void SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
 
   /**
-   * Handle Resize event
-   * @param[in] width The new width
-   * @param[in] height The new height
+   * Set the shared indicator image info
+   * @param[in] epcEvent The event containing the image data
    */
-  void Resize(int width, int height);
+  void SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
 
   /**
    * Load the shared indicator image
    * @param[in] epcEvent The event containing the image data
    */
-  void LoadSharedImage(Ecore_Ipc_Event_Server_Data *epcEvent);
+  void LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent );
 
   /**
    * Load the pixmap indicator image
@@ -331,15 +337,17 @@ private:
 
   /**
    * Inform dali that the indicator data has been updated.
+   * @param[in] bufferNumber The shared file number
    */
-  void UpdateImageData();
+  void UpdateImageData( int bufferNumber );
 
   /**
    * Lock the temporary file, Copy the shared image into IndicatorBuffer
    * and then unlock the temporary file.
    * Caller should ensure we are not writing image to gl texture.
+   * @param[in] bufferNumber The shared file number
    */
-  bool CopyToBuffer();
+  bool CopyToBuffer( int bufferNumber );
 
   /**
    * Update the background with the correct colors
@@ -348,8 +356,9 @@ private:
 
   /**
    * Create a new image for the indicator, and set up signal handling for it.
+   * @param[in] bufferNumber The shared file number
    */
-  void CreateNewImage();
+  void CreateNewImage( int bufferNumber );
 
   /**
    * Create a new pixmap image for the indicator, and set up signal handling for it.
@@ -375,7 +384,7 @@ private:
    *                     if it equal to 0, hide the indicator
    *                     if it less than 0, show always
    */
-  void ShowIndicator(float duration);
+  void ShowIndicator( float duration );
 
   /**
    * Showing timer callback
@@ -386,13 +395,13 @@ private:
    * Showing animation finished callback
    * @param[in] animation
    */
-  void OnAnimationFinished(Dali::Animation& animation);
+  void OnAnimationFinished( Dali::Animation& animation );
 
 private: // Implementation of ServerConnection::Observer
   /**
    * @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
    */
-  virtual void DataReceived(void* event);
+  virtual void DataReceived( void* event );
 
   /**
    * @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
@@ -400,13 +409,47 @@ private: // Implementation of ServerConnection::Observer
   virtual void ConnectionClosed();
 
 private:
+
   /**
    * Construct the gradient mesh
    */
   void ConstructBackgroundMesh();
 
+  /**
+   * Clear shared file info
+   */
+  void ClearSharedFileInfo();
+
 private:
 
+  struct SharedFileInfo
+  {
+    SharedFileInfo()
+      : mLock( NULL ),
+        mSharedFile( NULL ),
+        mImageWidth( 0 ),
+        mImageHeight( 0 ),
+        mLockFileName(),
+        mSharedFileName(),
+        mSharedFileID( 0 ),
+        mSharedFileNumber( 0 )
+    {
+    }
+
+    LockFile*                        mLock;              ///< File lock for the shared file
+    SharedFile*                      mSharedFile;        ///< Shared file
+
+    int                              mImageWidth;        ///< Shared image width
+    int                              mImageHeight;       ///< Shared image height
+
+    std::string                      mLockFileName;      ///< Lock file name
+    std::string                      mSharedFileName;    ///< Shared file name
+    int                              mSharedFileID;      ///< Shared file ID
+    int                              mSharedFileNumber;  ///< Shared file number
+  };
+
+  static const int SHARED_FILE_NUMBER = 2;               ///< Shared file number
+
   IndicatorBufferPtr               mIndicatorBuffer;     ///< class which handles indicator rendering
   PixmapId                         mPixmap;              ///< Pixmap including indicator content
   Dali::Image                      mImage;               ///< Image created from mIndicatorBuffer
@@ -429,8 +472,6 @@ private:
 
   Adaptor*                         mAdaptor;
   ServerConnection*                mServerConnection;
-  LockFile*                        mLock;                ///< File lock for the shared file
-  SharedFile*                      mSharedFile;          ///< Shared file
   Indicator::Observer*             mObserver;            ///< Upload observer
 
   Dali::Window::WindowOrientation  mOrientation;
@@ -444,6 +485,9 @@ private:
   Dali::Animation                  mIndicatorAnimation;  ///< Animation to show/hide indicator image
 
   bool                             mIsAnimationPlaying;  ///< Whether the animation is playing
+
+  int                              mCurrentSharedFile;   ///< Current shared file number
+  SharedFileInfo                   mSharedFileInfo[SHARED_FILE_NUMBER];    ///< Table to store shared file info
 };
 
 } // Adaptor
index db29c1e..8246cd5 100644 (file)
@@ -27,9 +27,9 @@
 
 namespace
 {
-// Copied from ecore_evas_extn.c
+// Copied from ecore_evas_extn_engine.h
 // procotol version - change this as needed
-const int MAJOR( 0x1011 );
+const int MAJOR( 0x2011 );
 }
 
 
index fd3d4cb..89ca011 100644 (file)
@@ -181,11 +181,31 @@ Application::AppSignalType& Application::ResizeSignal()
   return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
 }
 
+Application::AppControlSignalType & Application::AppControlSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
+}
+
 Application::AppSignalType& Application::LanguageChangedSignal()
 {
   return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
 }
 
+Application::AppSignalType& Application::RegionChangedSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
+}
+
+Application::AppSignalType& Application::BatteryLowSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
+}
+
+Application::AppSignalType& Application::MemoryLowSignal()
+{
+  return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
+}
+
 Application::Application(Internal::Adaptor::Application* application)
 : BaseHandle(application)
 {
index 9e135b8..09408e0 100644 (file)
@@ -93,6 +93,7 @@ class DALI_IMPORT_API Application : public BaseHandle
 public:
 
   typedef Signal< void (Application&) > AppSignalType;
+  typedef Signal< void (Application&, void *) > AppControlSignalType;
 
   /**
    * Decides whether a Dali application window is opaque or transparent.
@@ -327,10 +328,33 @@ public:  // Signals
   AppSignalType& ResizeSignal();
 
   /**
+  * This signal is emitted when another application sends a launch request to the application.
+  * When the application is launched, this signal is emitted after the main loop of the application starts up.
+  * The passed parameter describes the launch request and contains the information about why the application is launched.
+  */
+  AppControlSignalType& AppControlSignal();
+
+  /**
    * This signal is emitted when the language is changed on the device.
    */
   AppSignalType& LanguageChangedSignal();
 
+  /**
+  * This signal is emitted when the region of the device is changed.
+  */
+  AppSignalType& RegionChangedSignal();
+
+  /**
+  * This signal is emitted when the battery level of the device is low.
+  */
+  AppSignalType& BatteryLowSignal();
+
+  /**
+  * This signal is emitted when the memory level of the device is low.
+  */
+  AppSignalType& MemoryLowSignal();
+
+
 public: // Not intended for application developers
   /**
    * Internal constructor
diff --git a/adaptors/tizen/adaptor-impl-tizen.cpp b/adaptors/tizen/adaptor-impl-tizen.cpp
new file mode 100644 (file)
index 0000000..89dcdfe
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014 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 <adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#ifdef OVER_TIZEN_SDK_2_2
+#include <app.h>
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+  path = "";
+#ifdef OVER_TIZEN_SDK_2_2
+  path = app_get_data_path();
+#endif
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index 3e0609f..7ab1a0e 100644 (file)
@@ -2,6 +2,7 @@
 
 adaptor_tizen_internal_src_files = \
   $(adaptor_tizen_dir)/accessibility-manager-impl-tizen.cpp \
+  $(adaptor_tizen_dir)/adaptor-impl-tizen.cpp \
   $(adaptor_tizen_dir)/framework-tizen.cpp \
   $(adaptor_tizen_dir)/vsync-monitor-tizen.cpp \
   $(adaptor_tizen_dir)/tilt-sensor-impl-tizen.cpp \
index 5171324..5cca1cd 100644 (file)
@@ -48,7 +48,12 @@ enum
   APP_PAUSE,
   APP_RESUME,
   APP_RESET,
+  APP_CONTROL,
   APP_LANGUAGE_CHANGE,
+  APP_DEVICE_ROTATED,
+  APP_REGION_CHANGED,
+  APP_BATTERY_LOW,
+  APP_MEMORY_LOW
 };
 
 } // Unnamed namespace
@@ -68,17 +73,26 @@ struct Framework::Impl
     mEventCallback.terminate = AppTerminate;
     mEventCallback.pause = AppPause;
     mEventCallback.resume = AppResume;
-#if defined(TIZEN_SDK_2_3)
-    mEventCallback.app_control = AppControl;
-#else
+#ifndef OVER_TIZEN_SDK_2_2
     mEventCallback.service = AppService;
-#endif
+
     mEventCallback.low_memory = NULL;
     mEventCallback.low_battery = NULL;
-    mEventCallback.device_orientation = DeviceRotated;
-    mEventCallback.language_changed = AppLanguageChange;
+    mEventCallback.device_orientation = AppDeviceRotated;
+    mEventCallback.language_changed = AppLanguageChanged;
     mEventCallback.region_format_changed = NULL;
 
+#else
+    mEventCallback.app_control = AppControl;
+
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, AppBatteryLow, data);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, AppMemoryLow, data);
+    ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, AppDeviceRotated, data);
+    ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, AppLanguageChanged, data);
+    ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, AppRegionChanged, data);
+
+#endif
+
     mCallbackManager = CallbackManager::New();
   }
 
@@ -95,16 +109,21 @@ struct Framework::Impl
   // Data
 
   CallbackBase* mAbortCallBack;
-  app_event_callback_s mEventCallback;
   CallbackManager *mCallbackManager;
-  // Static methods
+
+#ifndef OVER_TIZEN_SDK_2_2
+  app_event_callback_s mEventCallback;
+#else
+  ui_app_lifecycle_callback_s mEventCallback;
+  app_event_handler_h handlers[5];
+#endif
 
   /**
    * Called by AppCore on application creation.
    */
   static bool AppCreate(void *data)
   {
-    return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
   }
 
   /**
@@ -112,7 +131,7 @@ struct Framework::Impl
    */
   static void AppTerminate(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
   }
 
   /**
@@ -120,7 +139,7 @@ struct Framework::Impl
    */
   static void AppPause(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
   }
 
   /**
@@ -128,74 +147,111 @@ struct Framework::Impl
    */
   static void AppResume(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
   }
 
+  static void ProcessBundle(Framework* framework, bundle *bundleData)
+  {
+    if(bundleData == NULL)
+    {
+      return;
+    }
+
+    // get bundle name
+    char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
+    if(bundleName != NULL)
+    {
+      framework->SetBundleName(bundleName);
+    }
+
+    // get bundle id
+    char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
+    if(bundleId != NULL)
+    {
+      framework->SetBundleId(bundleId);
+    }
+  }
+
+#ifndef OVER_TIZEN_SDK_2_2
   /**
    * Called by AppCore when the application is launched from another module (e.g. homescreen).
    * @param[in] b the bundle data which the launcher module sent
    */
-
-#if defined(TIZEN_SDK_2_3)
-  static void AppControl(app_control_h app_control, void *data)
-#else
   static void AppService(service_h service, void *data)
-#endif
   {
     Framework* framework = static_cast<Framework*>(data);
 
-    if(framework)
+    if(framework == NULL)
     {
-      bundle *bundleData = NULL;
-#if defined(TIZEN_SDK_2_3)
-      app_control_to_bundle(app_control, &bundleData);
-#else
-      service_to_bundle(service, &bundleData);
-#endif
-
-      if(bundleData)
-      {
-        // get bundle name
-        char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
-        if(bundleName != NULL)
-        {
-          framework->SetBundleName(bundleName);
-        }
-
-        // get bundle id
-        char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
-        if(bundleId != NULL)
-        {
-          framework->SetBundleId(bundleId);
-        }
-      }
-      framework->SlpAppStatusHandler(APP_RESET);
+      return;
     }
+    bundle *bundleData = NULL;
+
+    service_to_bundle(service, &bundleData);
+    ProcessBundle(framework, bundleData);
+
+    framework->AppStatusHandler(APP_RESET, NULL);
   }
 
-  /**
-   * Called by AppCore when the language changes on the device.
-   */
-  static void AppLanguageChange(void* data)
+  static void AppLanguageChanged(void* user_data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
   }
 
-  static void DeviceRotated(app_device_orientation_e orientation, void *user_data)
+  static void AppDeviceRotated(app_device_orientation_e orientation, void *user_data)
   {
-    switch(orientation)
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+  }
+
+#else
+
+  /**
+   * Called by AppCore when the application is launched from another module (e.g. homescreen).
+   * @param[in] b the bundle data which the launcher module sent
+   */
+  static void AppControl(app_control_h app_control, void *data)
+  {
+    Framework* framework = static_cast<Framework*>(data);
+    if(framework == NULL)
     {
-      case APP_DEVICE_ORIENTATION_0:
-        break;
-      case APP_DEVICE_ORIENTATION_90:
-        break;
-      case APP_DEVICE_ORIENTATION_180:
-        break;
-      case APP_DEVICE_ORIENTATION_270:
-        break;
+      return;
     }
+    bundle *bundleData = NULL;
+
+    app_control_to_bundle(app_control, &bundleData);
+    ProcessBundle(framework, bundleData);
+
+    framework->AppStatusHandler(APP_RESET, NULL);
+    framework->AppStatusHandler(APP_CONTROL, app_control);
+  }
+
+  static void AppLanguageChanged(app_event_info_h event_info, void *user_data)
+  {
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
+  }
+
+  static void AppDeviceRotated(app_event_info_h event_info, void *user_data)
+  {
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+  }
+
+  static void AppRegionChanged(app_event_info_h event_info, void *user_data)
+  {
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_REGION_CHANGED, NULL);
+  }
+
+  static void AppBatteryLow(app_event_info_h event_info, void *user_data)
+  {
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_BATTERY_LOW, NULL);
   }
 
+  static void AppMemoryLow(app_event_info_h event_info, void *user_data)
+  {
+    static_cast<Framework*>(user_data)->AppStatusHandler(APP_MEMORY_LOW, NULL);
+  }
+
+#endif
+
 };
 
 Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
@@ -228,8 +284,17 @@ void Framework::Run()
 {
   mRunning = true;
 
+#ifndef OVER_TIZEN_SDK_2_2
   app_efl_main(mArgc, mArgv, &mImpl->mEventCallback, this);
 
+#else
+  int ret = ui_app_main(*mArgc, *mArgv, &mImpl->mEventCallback, this);
+  if (ret != APP_ERROR_NONE)
+  {
+    DALI_LOG_ERROR("Framework::Run(), ui_app_main() is failed. err = %d", ret);
+  }
+#endif
+
   mRunning = false;
 }
 
@@ -281,7 +346,7 @@ void Framework::AbortCallback( )
   }
 }
 
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
 {
   switch (type)
   {
@@ -299,24 +364,58 @@ bool Framework::SlpAppStatusHandler(int type)
     }
 
     case APP_RESET:
+    {
       mObserver.OnReset();
       break;
+    }
 
     case APP_RESUME:
+    {
       mObserver.OnResume();
       break;
+    }
 
     case APP_TERMINATE:
-     mObserver.OnTerminate();
+    {
+      mObserver.OnTerminate();
       break;
+    }
 
     case APP_PAUSE:
+    {
       mObserver.OnPause();
       break;
+    }
+
+    case APP_CONTROL:
+    {
+      mObserver.OnAppControl(bundleData);
+      break;
+    }
 
     case APP_LANGUAGE_CHANGE:
+    {
       mObserver.OnLanguageChanged();
       break;
+    }
+
+    case APP_REGION_CHANGED:
+    {
+      mObserver.OnRegionChanged();
+      break;
+    }
+
+    case APP_BATTERY_LOW:
+    {
+      mObserver.OnBatteryLow();
+      break;
+    }
+
+    case APP_MEMORY_LOW:
+    {
+      mObserver.OnMemoryLow();
+      break;
+    }
 
     default:
       break;
diff --git a/adaptors/ubuntu/adaptor-impl-ubuntu.cpp b/adaptors/ubuntu/adaptor-impl-ubuntu.cpp
new file mode 100644 (file)
index 0000000..118816e
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014 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 <adaptor-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+  path = DALI_SHADERBIN_DIR;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
index d8c6357..0ff86ba 100644 (file)
@@ -2,6 +2,7 @@
 
 adaptor_ubuntu_internal_src_files = \
   $(adaptor_ubuntu_dir)/accessibility-manager-impl-ubuntu.cpp \
+  $(adaptor_ubuntu_dir)/adaptor-impl-ubuntu.cpp \
   $(adaptor_ubuntu_dir)/framework-ubuntu.cpp \
   $(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \
   $(adaptor_ubuntu_dir)/tilt-sensor-impl-ubuntu.cpp \
index 49df4b5..e3832df 100644 (file)
@@ -87,7 +87,7 @@ struct Framework::Impl
    */
   static bool AppCreate(void *data)
   {
-    return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+    return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
   }
 
   /**
@@ -95,7 +95,7 @@ struct Framework::Impl
    */
   static void AppTerminate(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
   }
 
   /**
@@ -103,7 +103,7 @@ struct Framework::Impl
    */
   static void AppPause(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
   }
 
   /**
@@ -111,7 +111,7 @@ struct Framework::Impl
    */
   static void AppResume(void *data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
   }
 
   /**
@@ -119,7 +119,7 @@ struct Framework::Impl
    */
   static void AppLanguageChange(void* data)
   {
-    static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+    static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
   }
 
 };
@@ -213,7 +213,7 @@ void Framework::AbortCallback( )
   }
 }
 
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
 {
   switch (type)
   {
index 596ecba..cac8dd0 100644 (file)
@@ -183,6 +183,20 @@ bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector
 }
 
 /**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+  mTrace.PushCall("LoadShaderBinFile", "");
+  if( mLoadFileResult.loadResult )
+  {
+    buffer = mLoadFileResult.buffer;
+  }
+
+  return mLoadFileResult.loadResult;
+}
+
+/**
  * @copydoc PlatformAbstraction::SaveFile()
  */
 bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
@@ -230,6 +244,7 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
     case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
     case SaveResourceFunc:                    return mTrace.FindMethod("SaveResource");
     case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
+    case LoadShaderBinFileFunc:               return mTrace.FindMethod("LoadShaderBinFile");
     case SaveFileFunc:                        return mTrace.FindMethod("SaveFile");
     case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
     case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
index 63df1c8..b8fddb9 100644 (file)
@@ -146,6 +146,12 @@ public:
   virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
 
   /**
+   * @copydoc PlatformAbstraction::LoadShaderBinFile()
+   */
+  virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer
+) const;
+
+  /**
    * @copydoc PlatformAbstraction::SaveFile()
    */
   virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
@@ -166,6 +172,7 @@ public: // TEST FUNCTIONS
     SaveResourceFunc,
     SaveFileFunc,
     LoadFileFunc,
+    LoadShaderBinFileFunc,
     CancelLoadFunc,
     GetResourcesFunc,
     IsLoadingFunc,
index 532cd37..b5a128c 100644 (file)
@@ -119,11 +119,15 @@ if MOBILE_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_mobile_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tizen_internal_src_files) \
                              $(static_libraries_libunibreak_src_files)
 
-endif
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files)
+endif # WAYLAND
 
+endif # MOBILE_PROFILE
 
 # LITE
 if LITE_PROFILE
@@ -142,9 +146,14 @@ if WEARABLE_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_mobile_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tizen_internal_src_files) \
                              $(static_libraries_libunibreak_src_files)
-endif
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files)
+endif # WAYLAND
+
+endif # WEARABLE
 
 
 # TV
@@ -153,8 +162,13 @@ if TV_PROFILE
 adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
                              $(adaptor_common_internal_tv_profile_src_files) \
                              $(adaptor_tizen_internal_src_files) \
-                             $(adaptor_x11_tv_internal_src_files) \
                              $(static_libraries_libunibreak_src_files)
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tv_internal_src_files)
+endif # WAYLAND
+
 endif
 
 # Feedback Plugin
@@ -189,10 +203,10 @@ libdali_adaptor_la_includes = \
                       -I../../../platform-abstractions/slp/resource-loader \
                       -I../../../platform-abstractions/portable \
                       -I../../../platform-abstractions/ \
-                      -I../../../adaptors/ \
                       -I../../../adaptors/public-api \
                       -I../../../adaptors/public-api/adaptor-framework \
                       -I../../../adaptors/common \
+                      -I../../../adaptors/ \
                       -I../../../text \
                       -I../../../text/dali/internal/libunibreak
 
@@ -215,13 +229,14 @@ endif
 daliDefaultFontCacheDir = ${dataReadOnlyDir}/glyphcache/
 daliUserFontCacheDir = ${dataReadWriteDir}/glyphcache/
 daliDefaultThemeDir  = ${dataReadWriteDir}/theme/
-daliUserShaderCacheDir = ${dataReadWriteDir}/core/shaderbin/
+daliShaderbinCacheDir = ${dataReadOnlyDir}/core/shaderbin/
 
 libdali_adaptor_la_CXXFLAGS = \
                       -DDALI_DATA_RW_DIR="\"${daliReadWriteDir}\"" \
                       -DDALI_DATA_RO_DIR="\"${daliReadOnlyDir}\"" \
                       -DDALI_DEFAULT_FONT_CACHE_DIR="\"${daliDefaultFontCacheDir}\"" \
                       -DDALI_USER_FONT_CACHE_DIR="\"${daliUserFontCacheDir}\"" \
+                      -DDALI_SHADERBIN_DIR="\"${daliShaderbinCacheDir}\"" \
                       -DDALI_DEFAULT_THEME_DIR="\"${daliDefaultThemeDir}\"" \
                       -DFONT_PRELOADED_PATH="\"${fontPreloadedPath}\"" \
                       -DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \
@@ -344,7 +359,7 @@ tizenadaptordaliheaderdir = $(devincludepath)/dali
 tizenadaptordaliheader_HEADERS = $(adaptor_dali_header_file)
 
 install-data-local:
-       $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliUserShaderCacheDir}
+       $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliShaderbinCacheDir}
 
 # Install resource log analyzer script
 bin_SCRIPTS = ../../../adaptors/scripts/dalireslog.sh
index d7eab76..1563415 100644 (file)
@@ -93,6 +93,12 @@ AC_ARG_ENABLE([debug],
               [enable_debug=$enableval],
               [enable_debug=no])
 
+AC_ARG_ENABLE(shaderbincache,
+              [AC_HELP_STRING([--enable-shaderbincache],
+                              [enables shader binary cache])],
+              [enable_shaderbincache=$enableval],
+              [enable_shaderbincache=DISABLE])
+
 if test "x$enable_debug" = "xyes"; then
   DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DDEBUG_ENABLED"
 fi
@@ -101,6 +107,10 @@ if test "x$enable_debug" = "xno" -a "x$enable_exportall" = "xno"; then
   DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
 fi
 
+if test "x$enable_shaderbincache" = "xENABLE"; then
+  DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DSHADERBIN_CACHE_ENABLED"
+fi
+
 AC_ARG_ENABLE([assimp],
               [AC_HELP_STRING([--enable-assimp],
                               [Enable assimp plugin, overriding platform defaults])],
index f3395c1..59d06cc 100644 (file)
@@ -12,6 +12,11 @@ Source0:    %{name}-%{version}.tar.gz
 %define dali_feedback_plugin 1
 %define dali_bullet_plugin 1
 %define dali_assimp_plugin 1
+%define over_tizen_2_2 1
+
+%if 0%{?over_tizen_2_2}
+%define shaderbincache_flag ENABLE
+%endif
 
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -104,7 +109,7 @@ Dynamics plugin to wrap the libBulletDynamics libraries
 %define dali_data_rw_dir         /opt/usr/share/dali/
 %define dali_data_ro_dir         /usr/share/dali/
 %define user_font_cache_dir      %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir    %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir    %{dali_data_ro_dir}/core/shaderbin/
 %define font_preloaded_path      /usr/share/fonts/
 %define font_downloaded_path     /opt/share/fonts/
 %define font_application_path    /usr/share/app_fonts/
@@ -126,8 +131,9 @@ LDFLAGS+=" -Wl,--rpath=%{_libdir} -Wl,--as-needed -Wl,--gc-sections -Wl,-Bsymbol
 CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
 %endif
 
-%if 0%{?TIZEN_SDK_2_3}
-CXXFLAGS+=" -DTIZEN_SDK_2_3"
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
 %endif
 
 libtoolize --force
@@ -140,7 +146,7 @@ FONT_DOWNLOADED_PATH="%{font_downloaded_path}" ; export FONT_DOWNLOADED_PATH
 FONT_APPLICATION_PATH="%{font_application_path}" ; export FONT_APPLICATION_PATH
 FONT_CONFIGURATION_FILE="%{font_configuration_file}" ; export FONT_CONFIGURATION_FILE
 
-%configure --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
 %if 0%{?dali_feedback_plugin}
            --enable-feedback \
 %endif
@@ -178,7 +184,6 @@ cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{
 
 %pre
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
@@ -187,7 +192,6 @@ exit 0
 %post
 /sbin/ldconfig
 chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
 exit 0
 
 %if 0%{?dali_feedback_plugin}
@@ -207,7 +211,6 @@ exit 0
 ##############################
 %preun
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
index 7197e0e..813bfc5 100644 (file)
@@ -101,7 +101,7 @@ Dynamics plugin to wrap the libBulletDynamics libraries
 %define dali_data_rw_dir         /usr/share/dali/
 %define dali_data_ro_dir         /usr/share/dali/
 %define user_font_cache_dir      %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir    %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir    %{dali_data_ro_dir}/core/shaderbin/
 %define font_preloaded_path      /usr/share/fonts/
 %define font_downloaded_path     /opt/share/fonts/
 %define font_application_path    /usr/share/app_fonts/
@@ -171,7 +171,6 @@ cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{
 
 %pre
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
@@ -180,7 +179,6 @@ exit 0
 %post
 /sbin/ldconfig
 chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
 exit 0
 
 %if 0%{?dali_feedback_plugin}
@@ -200,7 +198,6 @@ exit 0
 ##############################
 %preun
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
index 67c3d7c..463d176 100644 (file)
@@ -90,7 +90,7 @@ Feedback plugin to play haptic and audio feedback for Dali
 %define dali_data_rw_dir         /opt/usr/share/dali/
 %define dali_data_ro_dir         /usr/share/dali/
 %define user_font_cache_dir      %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir    %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir    %{dali_data_ro_dir}/core/shaderbin/
 %define font_preloaded_path      /usr/share/fonts/
 %define font_downloaded_path     /opt/share/fonts/
 %define font_application_path    /usr/share/app_fonts/
@@ -157,7 +157,6 @@ cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{
 
 %pre
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
@@ -166,7 +165,6 @@ exit 0
 %post
 /sbin/ldconfig
 chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
 exit 0
 
 %if 0%{?dali_feedback_plugin}
@@ -180,7 +178,6 @@ exit 0
 ##############################
 %preun
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
index 7c8e714..839b8d4 100644 (file)
@@ -14,6 +14,8 @@ Source0:    %{name}-%{version}.tar.gz
 %define dali_feedback_plugin 0
 %define dali_bullet_plugin 0
 %define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
 %endif
 
 %if "%{profile}" == "tv"
@@ -21,6 +23,8 @@ Source0:    %{name}-%{version}.tar.gz
 %define dali_feedback_plugin 0
 %define dali_bullet_plugin 0
 %define dali_assimp_plugin 0
+%define over_tizen_2_2 1
+%define shaderbincache_flag ENABLE
 %endif
 
 %if "%{profile}" == "wearable"
@@ -28,6 +32,8 @@ Source0:    %{name}-%{version}.tar.gz
 %define dali_feedback_plugin 0
 %define dali_bullet_plugin 0
 %define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
 %endif
 
 %if "%{profile}" == "common"
@@ -35,6 +41,8 @@ Source0:    %{name}-%{version}.tar.gz
 %define dali_feedback_plugin 0
 %define dali_bullet_plugin 0
 %define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
 %endif
 
 Requires(post): /sbin/ldconfig
@@ -137,7 +145,7 @@ Dynamics plugin to wrap the libBulletDynamics libraries
 %define dali_data_rw_dir         /usr/share/dali/
 %define dali_data_ro_dir         /usr/share/dali/
 %define user_font_cache_dir      %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir    %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir    %{dali_data_ro_dir}/core/shaderbin/
 %define font_preloaded_path      /usr/share/fonts/
 %define font_downloaded_path     /opt/share/fonts/
 %define font_application_path    /usr/share/app_fonts/
@@ -165,11 +173,16 @@ CXXFLAGS+=" -DWAYLAND"
 configure_flags="--enable-wayland"
 %endif
 
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
 cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}"
 
-%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
 %if 0%{?dali_feedback_plugin}
            --enable-feedback \
 %endif
@@ -207,7 +220,6 @@ cp -af %{_builddir}/%{name}-%{version}/LICENSE %{buildroot}/usr/share/license/%{
 
 %pre
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
@@ -216,7 +228,6 @@ exit 0
 %post
 /sbin/ldconfig
 chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
 exit 0
 
 %if 0%{?dali_feedback_plugin}
@@ -236,7 +247,6 @@ exit 0
 ##############################
 %preun
 rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
 exit 0
 
 ##############################
index a674aed..d19d0f3 100644 (file)
@@ -50,7 +50,8 @@ const unsigned int NANOSECS_TO_MICROSECS( 1000 );                          ///<
 
 SlpPlatformAbstraction::SlpPlatformAbstraction()
 : mResourceLoader(new ResourceLoader),
-  mDynamicsFactory(NULL)
+  mDynamicsFactory(NULL),
+  mDataStoragePath( "" )
 {
 }
 
@@ -119,7 +120,20 @@ void SlpPlatformAbstraction::SaveResource(const Integration::ResourceRequest& re
 {
   if (mResourceLoader)
   {
-    mResourceLoader->SaveResource(request);
+    if( request.GetType()->id == Integration::ResourceShader )
+    {
+#ifdef SHADERBIN_CACHE_ENABLED
+      std::string path = mDataStoragePath;
+      path += request.GetPath();
+
+      Integration::ResourceRequest newRequest( request.GetId(), *request.GetType(), path, request.GetResource() );
+      mResourceLoader->SaveResource(newRequest);
+#endif
+    }
+    else
+    {
+      mResourceLoader->SaveResource(request);
+    }
   }
 }
 
@@ -208,6 +222,36 @@ Integration::DynamicsFactory* SlpPlatformAbstraction::GetDynamicsFactory()
   return mDynamicsFactory;
 }
 
+bool SlpPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+  bool result = false;
+
+#ifdef SHADERBIN_CACHE_ENABLED
+  std::string path;
+
+  if( mResourceLoader )
+  {
+    path = DALI_SHADERBIN_DIR;
+    path += filename;
+    result = mResourceLoader->LoadFile( path, buffer );
+  }
+
+  if( mResourceLoader && result == false )
+  {
+    path = mDataStoragePath;
+    path += filename;
+    result = mResourceLoader->LoadFile( path, buffer );
+  }
+#endif
+
+  return result;
+}
+
+void SlpPlatformAbstraction::SetDataStoragePath( const std::string& path )
+{
+  mDataStoragePath = path;
+}
+
 }  // namespace SlpPlatform
 
 }  // namespace Dali
index 3b1cea8..b27d9a7 100644 (file)
@@ -147,9 +147,21 @@ public: // PlatformAbstraction overrides
    */
   virtual Integration::DynamicsFactory* GetDynamicsFactory();
 
+  /**
+   * @copydoc PlatformAbstraction::LoadShaderBinFile()
+   */
+  virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+
+  /**
+   * Sets path for data/resource storage.
+   * @param[in] path data/resource storage path
+   */
+  void SetDataStoragePath( const std::string& path );
+
 private:
   ResourceLoader* mResourceLoader;
   DynamicsFactory* mDynamicsFactory;
+  std::string mDataStoragePath;
 };
 
 }  // namespace SlpPlatform