[ACR][3/15][Modify] Modify Livebox classes to AppWidget
authorjungmin76.park <jungmin76.park@samsung.com>
Sat, 16 Mar 2013 03:59:59 +0000 (12:59 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Sat, 16 Mar 2013 03:59:59 +0000 (12:59 +0900)
Change-Id: Id0f203f42dff82e4a9e87d87b078044e6b140ac9
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
27 files changed:
CMakeLists.txt
inc/FShell_AppWidgetContext.h [new file with mode: 0644]
inc/FShell_AppWidgetContextBase.h [new file with mode: 0644]
inc/FShell_AppWidgetManagerService.h [new file with mode: 0644]
inc/FShell_AppWidgetManagerStub.h [new file with mode: 0644]
inc/FShell_AppWidgetPopupContext.h [new file with mode: 0644]
inc/FShell_LiveboxContext.h [deleted file]
inc/FShell_LiveboxContextBase.h [deleted file]
inc/FShell_LiveboxManagerService.h [deleted file]
inc/FShell_LiveboxManagerStub.h [deleted file]
inc/FShell_LiveboxPopupContext.h [deleted file]
inc/OspAppWidgetService.h [new file with mode: 0644]
inc/OspLiveboxService.h [deleted file]
src/FShell_AppWidgetContext.cpp [new file with mode: 0644]
src/FShell_AppWidgetContextBase.cpp [new file with mode: 0644]
src/FShell_AppWidgetManagerService.cpp [new file with mode: 0644]
src/FShell_AppWidgetManagerStub.cpp [new file with mode: 0644]
src/FShell_AppWidgetPopupContext.cpp [new file with mode: 0644]
src/FShell_LiveboxContext.cpp [deleted file]
src/FShell_LiveboxContextBase.cpp [deleted file]
src/FShell_LiveboxManagerService.cpp [deleted file]
src/FShell_LiveboxManagerStub.cpp [deleted file]
src/FShell_LiveboxPopupContext.cpp [deleted file]
src/OspAppWidgetService.cpp [new file with mode: 0644]
src/OspAppWidgetServiceEntry.cpp [new file with mode: 0644]
src/OspLiveboxService.cpp [deleted file]
src/OspLiveboxServiceEntry.cpp [deleted file]

index 0f5ac1b5cd29009fa852002eef735086a67ed8ed..9a3af89a1431e7d831186d20eadf80e41f6ac1ca 100644 (file)
@@ -25,13 +25,13 @@ INCLUDE_DIRECTORIES (
        )
 
 SET (${this_target}_SOURCE_FILES
-       src/OspLiveboxService.cpp
-       src/OspLiveboxServiceEntry.cpp
-       src/FShell_LiveboxContext.cpp
-       src/FShell_LiveboxContextBase.cpp
-       src/FShell_LiveboxManagerService.cpp
-       src/FShell_LiveboxManagerStub.cpp
-       src/FShell_LiveboxPopupContext.cpp
+       src/OspAppWidgetService.cpp
+       src/OspAppWidgetServiceEntry.cpp
+       src/FShell_AppWidgetContext.cpp
+       src/FShell_AppWidgetContextBase.cpp
+       src/FShell_AppWidgetManagerService.cpp
+       src/FShell_AppWidgetManagerStub.cpp
+       src/FShell_AppWidgetPopupContext.cpp
        )
 
 ## SET EXTRA COMPILER FLAGS
diff --git a/inc/FShell_AppWidgetContext.h b/inc/FShell_AppWidgetContext.h
new file mode 100644 (file)
index 0000000..a6f9ec3
--- /dev/null
@@ -0,0 +1,92 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetContext.h
+ * @brief      This is the header file for the _AppWidgetContext class.
+ *
+ * This header file contains the declarations of the _AppWidgetContext class.
+ */
+
+#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
+#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
+
+#include <provider.h>
+#include <provider_buffer.h>
+
+#include <FAppTypes.h>
+#include <FBaseRtTimer.h>
+#include <FBaseObject.h>
+#include <FBaseColArrayList.h>
+
+#include "FShell_AppWidgetContextBase.h"
+
+
+#define MAX_PACKAGENAME  512
+
+
+namespace Tizen { namespace Shell  { namespace App
+{
+class _AppWidgetPopupContext;
+
+class _AppWidgetContext
+        : public _AppWidgetContextBase
+         ,public Tizen::Base::Runtime::ITimerEventListener
+{
+public:
+       _AppWidgetContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
+                                               int width, int height, int period, int priority);
+       virtual ~_AppWidgetContext();
+       void OnAdded(void);
+       void OnUpdate(const Tizen::Base::String& argument);
+       void OnResize(int width, int height);
+       void OnRemoved();
+       void OnForeground();
+       void OnBackground();
+       virtual void OnPopupCreated(double x, double y, int width, int height);
+       virtual void OnPopupDestoyed(void);
+
+       result RequestUpdateRemote(int width, int height);
+
+       _AppWidgetPopupContext* GetAppWidgetPopup() const;
+       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
+
+       void RestartLifeDurationTimer();
+
+private:
+       result SendAddRequest(int width, int height);
+       result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument);
+       result SendResizeRequest(int width, int height);
+       result SendRemoveRequest();
+
+       result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+
+       virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+
+private:
+       _AppWidgetPopupContext* __pAppWidgetPopup;
+       Tizen::Base::Runtime::Timer __lifeDurationTimer;
+       Tizen::Base::Runtime::Timer __UpdateTimer;
+       int __UpdateMillis;
+
+};
+
+
+} } } // Tizen::Shell::App {
+
+
+#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
diff --git a/inc/FShell_AppWidgetContextBase.h b/inc/FShell_AppWidgetContextBase.h
new file mode 100644 (file)
index 0000000..a297990
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetContextBase.h
+ * @brief      This is the header file for the _AppWidgetContextBase class.
+ *
+ * This header file contains the declarations of the _AppWidgetContextBase class.
+ */
+
+#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
+#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
+
+#include <provider.h>
+
+#include <FAppTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColHashMap.h>
+
+#define APPWIDGET_PROVIDER_ID_ENABLE true
+
+typedef struct _bundle_t bundle;//TODO move code to osp-appfw
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+class _AppWidgetContextBase:
+       public Tizen::Base::Object
+{
+public:
+       _AppWidgetContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+       virtual ~_AppWidgetContextBase();
+
+       virtual void OnPopupCreated(double x, double y, int width, int height) = 0;
+       virtual void OnPopupDestoyed(void) = 0;
+
+       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
+
+       void SetClientId(int clientId);
+       bool HasValidClientId() const;
+       // for buffered appWidget
+       int GetSharedMemId(int w, int h);
+       result ReleaseSharedMem();
+
+
+protected:
+       Tizen::Base::Collection::HashMap* CreateRequestArgs(void);
+       result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+
+public:
+       target_type __type;
+       Tizen::Base::String __userInfo;
+       Tizen::Base::String __appId;
+       Tizen::Base::String __providerName;
+       Tizen::Base::String __providerId;
+       Tizen::Base::String __instanceId;
+       int __width;
+       int __height;
+       int __priority;
+
+protected:
+       bool __isForeground;// LB only?
+       int __ipcClientId;
+
+private:
+       struct livebox_buffer *__buffer_info;
+       void *__buffer;
+};
+
+class _AppWidgetRequestHelper
+{
+public:
+       static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+//     static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
+//     static result ExtractPackageIdAndExecutableName(Tizen::App::AppId inAppId, Tizen::Base::String& outPackageId, Tizen::Base::String& outExecutableName);
+};
+
+} /* namespace App */
+} /* namespace AppWidget */
+} /* namespace Samsung */
+#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
diff --git a/inc/FShell_AppWidgetManagerService.h b/inc/FShell_AppWidgetManagerService.h
new file mode 100644 (file)
index 0000000..95c1470
--- /dev/null
@@ -0,0 +1,110 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetManagerService.h
+ * @brief      This is the header file for the %AppWidgetManagerService class.
+ *
+ * This header file contains the declarations of the %AppWidgetManagerService class.
+ */
+
+#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
+#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FBaseRtTimer.h>
+#include <FBaseColArrayListT.h>
+
+#include "FShell_AppWidgetContext.h"
+#include "FShell_AppWidgetManagerStub.h"
+
+namespace Tizen { namespace Shell  { namespace App {
+
+
+class AppWidgetManagerService
+       :public Tizen::Shell::App::_AppWidgetManagerStub
+        ,public Tizen::Base::Runtime::ITimerEventListener
+{
+public:
+       static AppWidgetManagerService* GetInstance(void);
+       result AddAppWidget(_AppWidgetContext* pAppWidget);
+       result RemoveAppWidget(const char* pPackageName, const char* pId, bool free);
+
+private:
+       result Construct();
+       result InitializeMasterDaemonEventReceiver(const char* pServiceExecutableName);
+       result DeinitializeMasterDaemonEventReceiver(void);
+
+       // master daemon callbacks
+       static int AppWidgetConnected(struct event_arg *arg, void* data);
+       static int AppWidgetDisconnected(struct event_arg *arg, void* data);
+       static int OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data);
+       static int OnAppWidgetDestroy(struct event_arg *arg, void* data);
+       static int OnAppWidgetUpdate(struct event_arg *arg, void* data);
+       static int OnAppWidgetPopupCreate(struct event_arg *arg, void* data);
+       static int OnAppWidgetPopupDestroy(struct event_arg *arg, void* data);
+       static int OnLivePause(struct event_arg *arg, void* data);
+       static int OnAppWidgetResume(struct event_arg *arg, void* data);
+       static int OnAppWidgetClick(struct event_arg *arg, void* data);
+       static int OnAppWidgetResize(struct event_arg *arg, void* data);
+       static int OnAppWidgetPeriodChaned(struct event_arg *arg, void* data);
+
+       // stub implementations
+       virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
+       virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument);
+       virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
+       virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
+       virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height);
+       virtual result RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
+       virtual result RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
+       virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
+
+       // internal functions
+       AppWidgetManagerService();
+       virtual ~AppWidgetManagerService();
+
+       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
+       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
+
+       // helpers
+       result SetClientIds(const Tizen::App::AppId& appId, int clientId);
+       int UpdateAllAppWidgetesByAppId(const Tizen::Base::String& appId);
+
+       void StartPingTimer();
+       virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
+       _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
+
+
+       class _TaskHandlerThread
+                       : public Tizen::Base::Runtime::Thread
+       {
+       public:
+               virtual ~_TaskHandlerThread(void);
+               virtual void OnUserEventReceivedN(RequestId reqId, Tizen::Base::Collection::IList* pArgs);
+
+       };
+
+private:
+       Tizen::Base::Collection::ArrayListT<_AppWidgetContext*> __appWidgetContextList;
+       Tizen::Base::Runtime::Timer __pingTimer;
+       _TaskHandlerThread      __handlerThread;
+};
+
+} } } // Tizen::Shell::App {
+
+#endif // _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
diff --git a/inc/FShell_AppWidgetManagerStub.h b/inc/FShell_AppWidgetManagerStub.h
new file mode 100644 (file)
index 0000000..c8ba56f
--- /dev/null
@@ -0,0 +1,99 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetManagerStub.h
+ * @brief      This is the header file for the %_AppWidgetManagerStub class.
+ *
+ * This header file contains the declarations of the %_AppWidgetManagerStub class.
+ */
+
+#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
+#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FBaseRtIEventListener.h>
+#include <FSystem.h>
+#include <FIo.h>
+
+#include <FIo_IIpcServerEventListener.h>
+//#include <FApp_IAppManager.h>
+
+
+namespace Tizen { namespace Shell  { namespace App {
+
+/**
+ * @class              _AppWidgetManagerStub
+ * @brief              Handles IPC requests and calls real methods.
+ * @since 2.1
+ */
+class _AppWidgetManagerStub
+       : public Tizen::Base::Object
+       , public Tizen::Io::_IIpcServerEventListener
+       , virtual public Tizen::Base::Runtime::IEventListener
+{
+
+public:
+       bool SendTouchEvent(const int clientId, const Tizen::Base::String& instanceId, int eventType, double timestamp, double x, double y);
+       bool SendTouchEventForPD(const int clientId, const Tizen::Base::String& instanceId, int eventType, double timestamp, double x, double y);
+
+protected:
+       _AppWidgetManagerStub(void);
+       virtual ~_AppWidgetManagerStub(void);
+
+       // handlers
+       bool OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes);
+       bool OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes);
+       bool OnRequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int* pShmId);
+       bool OnRequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int* pShmId);
+       bool OnRequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height, result* pRes);
+       bool OnRequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId, result* pRes);
+       bool OnRequestReleaseSharedMemory(const Tizen::Base::String& instanceId, result* pRes);
+       bool OnRequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId, result* pRes);
+
+       // interface to service
+       virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) = 0;
+       virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument) = 0;
+       virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0;
+       virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0;
+       virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height) = 0;
+       virtual result RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
+       virtual result RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
+       virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
+
+       // _IIpcServerEventListener
+       virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
+       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
+       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
+       virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
+
+       result StartIpcServer(void);
+
+private:
+       _AppWidgetManagerStub(const _AppWidgetManagerStub& value);
+       _AppWidgetManagerStub& operator =(const _AppWidgetManagerStub& source);
+
+
+protected:
+       Tizen::Io::_IpcServer *__pIpcServer;
+};     //_AppWidgetManagerStub
+
+}}}
+
+#endif//_FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
diff --git a/inc/FShell_AppWidgetPopupContext.h b/inc/FShell_AppWidgetPopupContext.h
new file mode 100644 (file)
index 0000000..3539756
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetPopupContext.h
+ * @brief      This is the header file for the %_AppWidgetPopupContext class.
+ *
+ * This header file contains the declarations of the %_AppWidgetPopupContext class.
+ */
+
+#ifndef _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
+#define _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
+
+#include "FShell_AppWidgetContextBase.h"
+
+namespace Tizen { namespace Shell { namespace App
+{
+
+class _AppWidgetPopupContext
+        :public Tizen::Shell::App::_AppWidgetContextBase
+{
+public:
+       _AppWidgetPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
+       virtual ~_AppWidgetPopupContext();
+
+       // event handler
+       void OnPopupCreated(double x, double y, int width, int height);
+       void OnPopupDestoyed(void);
+
+       // request to app
+       result SendPopupCreateRequest(double x, double y, int width, int height);
+       result SendPopupDestroyRequest();
+       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
+
+       result RequestUpdateRemote();
+};
+
+
+} /* namespace App */
+} /* namespace AppWidget */
+} /* namespace Samsung */
+#endif // _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
diff --git a/inc/FShell_LiveboxContext.h b/inc/FShell_LiveboxContext.h
deleted file mode 100644 (file)
index 733c87c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxContext.h
- * @brief      This is the header file for the _LiveboxContext class.
- *
- * This header file contains the declarations of the _LiveboxContext class.
- */
-
-#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
-#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
-
-#include <provider.h>
-#include <provider_buffer.h>
-
-#include <FAppTypes.h>
-#include <FBaseRtTimer.h>
-#include <FBaseObject.h>
-#include <FBaseColArrayList.h>
-
-#include "FShell_LiveboxContextBase.h"
-
-
-#define MAX_PACKAGENAME  512
-
-
-namespace Tizen { namespace Shell  { namespace App
-{
-class _LiveboxPopupContext;
-
-class _LiveboxContext
-        : public _LiveboxContextBase
-         ,public Tizen::Base::Runtime::ITimerEventListener
-{
-public:
-       _LiveboxContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
-                                               int width, int height, int period, int priority);
-       virtual ~_LiveboxContext();
-       void OnAdded(void);
-       void OnUpdate(const Tizen::Base::String& argument);
-       void OnResize(int width, int height);
-       void OnRemoved();
-       void OnForeground();
-       void OnBackground();
-       virtual void OnPopupCreated(double x, double y, int width, int height);
-       virtual void OnPopupDestoyed(void);
-
-       result RequestUpdateRemote(int width, int height);
-
-       _LiveboxPopupContext* GetLiveboxPopup() const;
-       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
-
-       void RestartLifeDurationTimer();
-
-private:
-       result SendAddRequest(int width, int height);
-       result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument);
-       result SendResizeRequest(int width, int height);
-       result SendRemoveRequest();
-
-       result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-
-       virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
-
-private:
-       _LiveboxPopupContext* __pLiveboxPopup;
-       Tizen::Base::Runtime::Timer __lifeDurationTimer;
-       Tizen::Base::Runtime::Timer __UpdateTimer;
-       int __UpdateMillis;
-
-};
-
-
-} } } // Tizen::Shell::App {
-
-
-#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_H_
diff --git a/inc/FShell_LiveboxContextBase.h b/inc/FShell_LiveboxContextBase.h
deleted file mode 100644 (file)
index 4f124c4..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxContextBase.h
- * @brief      This is the header file for the _LiveboxContextBase class.
- *
- * This header file contains the declarations of the _LiveboxContextBase class.
- */
-
-#ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
-#define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
-
-#include <provider.h>
-
-#include <FAppTypes.h>
-#include <FBaseObject.h>
-#include <FBaseColHashMap.h>
-
-#define LIVEBOX_PROVIDER_ID_ENABLE true
-
-typedef struct _bundle_t bundle;//TODO move code to osp-appfw
-
-namespace Tizen { namespace Shell  { namespace App
-{
-
-class _LiveboxContextBase:
-       public Tizen::Base::Object
-{
-public:
-       _LiveboxContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
-       virtual ~_LiveboxContextBase();
-
-       virtual void OnPopupCreated(double x, double y, int width, int height) = 0;
-       virtual void OnPopupDestoyed(void) = 0;
-
-       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
-
-       void SetClientId(int clientId);
-       bool HasValidClientId() const;
-       // for buffered livebox
-       int GetSharedMemId(int w, int h);
-       result ReleaseSharedMem();
-
-
-protected:
-       Tizen::Base::Collection::HashMap* CreateRequestArgs(void);
-       result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-
-public:
-       target_type __type;
-       Tizen::Base::String __userInfo;
-       Tizen::Base::String __appId;
-       Tizen::Base::String __providerName;
-       Tizen::Base::String __providerId;
-       Tizen::Base::String __instanceId;
-       int __width;
-       int __height;
-       int __priority;
-
-protected:
-       bool __isForeground;// LB only?
-       int __ipcClientId;
-
-private:
-       void *__buffer;
-       struct livebox_buffer *__buffer_info;
-};
-
-class _LiveboxRequestHelper
-{
-public:
-       static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-//     static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
-//     static result ExtractPackageIdAndExecutableName(Tizen::App::AppId inAppId, Tizen::Base::String& outPackageId, Tizen::Base::String& outExecutableName);
-};
-
-} /* namespace App */
-} /* namespace Livebox */
-} /* namespace Samsung */
-#endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
diff --git a/inc/FShell_LiveboxManagerService.h b/inc/FShell_LiveboxManagerService.h
deleted file mode 100644 (file)
index f47721d..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxManagerService.h
- * @brief      This is the header file for the %LiveboxManagerService class.
- *
- * This header file contains the declarations of the %LiveboxManagerService class.
- */
-
-#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
-#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
-
-#include <FBaseObject.h>
-#include <FBaseString.h>
-#include <FBaseRtTimer.h>
-#include <FBaseColArrayListT.h>
-
-#include "FShell_LiveboxContext.h"
-#include "FShell_LiveboxManagerStub.h"
-
-namespace Tizen { namespace Shell  { namespace App {
-
-
-class LiveboxManagerService
-       :public Tizen::Shell::App::_LiveboxManagerStub
-        ,public Tizen::Base::Runtime::ITimerEventListener
-{
-public:
-       static LiveboxManagerService* GetInstance(void);
-       result AddLivebox(_LiveboxContext* pLivebox);
-       result RemoveLivebox(const char* pPackageName, const char* pId, bool free);
-
-private:
-       result Construct();
-       result InitializeMasterDaemonEventReceiver(const char* pServiceExecutableName);
-       result DeinitializeMasterDaemonEventReceiver(void);
-
-       // master daemon callbacks
-       static int LiveboxConnected(struct event_arg *arg, void* data);
-       static int LiveboxDisconnected(struct event_arg *arg, void* data);
-       static int OnLiveboxCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data);
-       static int OnLiveboxDestroy(struct event_arg *arg, void* data);
-       static int OnLiveboxUpdate(struct event_arg *arg, void* data);
-       static int OnLiveboxPopupCreate(struct event_arg *arg, void* data);
-       static int OnLiveboxPopupDestroy(struct event_arg *arg, void* data);
-       static int OnLivePause(struct event_arg *arg, void* data);
-       static int OnLiveboxResume(struct event_arg *arg, void* data);
-       static int OnLiveboxClick(struct event_arg *arg, void* data);
-       static int OnLiveboxResize(struct event_arg *arg, void* data);
-       static int OnLiveboxPeriodChaned(struct event_arg *arg, void* data);
-
-       // stub implementations
-       virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
-       virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument);
-       virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
-       virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
-       virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height);
-       virtual result RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
-       virtual result RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
-       virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
-
-       // internal functions
-       LiveboxManagerService();
-       virtual ~LiveboxManagerService();
-
-       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
-       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
-
-       // helpers
-       result SetClientIds(const Tizen::App::AppId& appId, int clientId);
-       int UpdateAllLiveboxesByAppId(const Tizen::Base::String& appId);
-
-       void StartPingTimer();
-       virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
-       _LiveboxContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
-
-
-       class _TaskHandlerThread
-                       : public Tizen::Base::Runtime::Thread
-       {
-       public:
-               virtual ~_TaskHandlerThread(void);
-               virtual void OnUserEventReceivedN(RequestId reqId, Tizen::Base::Collection::IList* pArgs);
-
-       };
-
-private:
-       Tizen::Base::Collection::ArrayListT<_LiveboxContext*> __liveboxContextList;
-       Tizen::Base::Runtime::Timer __pingTimer;
-       _TaskHandlerThread      __handlerThread;
-};
-
-} } } // Tizen::Shell::App {
-
-#endif // _FSHELL_INTERNAL_LIVEBOX_MANAGER_SERVICE_H_
diff --git a/inc/FShell_LiveboxManagerStub.h b/inc/FShell_LiveboxManagerStub.h
deleted file mode 100644 (file)
index b4d8770..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxManagerStub.h
- * @brief      This is the header file for the %_LiveboxManagerStub class.
- *
- * This header file contains the declarations of the %_LiveboxManagerStub class.
- */
-
-#ifndef _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
-#define _FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
-
-#include <FBaseObject.h>
-#include <FBaseString.h>
-#include <FBaseRtIEventListener.h>
-#include <FSystem.h>
-#include <FIo.h>
-
-#include <FIo_IIpcServerEventListener.h>
-//#include <FApp_IAppManager.h>
-
-
-namespace Tizen { namespace Shell  { namespace App {
-
-/**
- * @class              _LiveboxManagerStub
- * @brief              Handles IPC requests and calls real methods.
- * @since 2.1
- */
-class _LiveboxManagerStub
-       : public Tizen::Base::Object
-       , public Tizen::Io::_IIpcServerEventListener
-       , virtual public Tizen::Base::Runtime::IEventListener
-{
-
-public:
-       bool SendTouchEvent(const int clientId, const Tizen::Base::String& instanceId, int eventType, double timestamp, double x, double y);
-       bool SendTouchEventForPD(const int clientId, const Tizen::Base::String& instanceId, int eventType, double timestamp, double x, double y);
-
-protected:
-       _LiveboxManagerStub(void);
-       virtual ~_LiveboxManagerStub(void);
-
-       // handlers
-       bool OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes);
-       bool OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes);
-       bool OnRequestSharedMemoryId(const Tizen::Base::String& instanceId, int width, int height, int* pShmId);
-       bool OnRequestSharedMemoryIdForPD(const Tizen::Base::String& instanceId, int width, int height, int* pShmId);
-       bool OnRequestSyncSharedMemory(const Tizen::Base::String& instanceId, int width, int height, result* pRes);
-       bool OnRequestSyncSharedMemoryForPD(const Tizen::Base::String& instanceId, result* pRes);
-       bool OnRequestReleaseSharedMemory(const Tizen::Base::String& instanceId, result* pRes);
-       bool OnRequestReleaseSharedMemoryForPD(const Tizen::Base::String& instanceId, result* pRes);
-
-       // interface to service
-       virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument) = 0;
-       virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument) = 0;
-       virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0;
-       virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId) = 0;
-       virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height) = 0;
-       virtual result RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
-       virtual result RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
-       virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) = 0;
-
-       // _IIpcServerEventListener
-       virtual void OnIpcServerStarted(const Tizen::Io::_IpcServer& server);
-       virtual void OnIpcServerStopped(const Tizen::Io::_IpcServer& server);
-       virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
-       virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
-       virtual void OnIpcRequestReceived(Tizen::Io::_IpcServer& server, const IPC::Message& message);
-
-       result StartIpcServer(void);
-
-private:
-       _LiveboxManagerStub(const _LiveboxManagerStub& value);
-       _LiveboxManagerStub& operator =(const _LiveboxManagerStub& source);
-
-
-protected:
-       Tizen::Io::_IpcServer *__pIpcServer;
-};     //_LiveboxManagerStub
-
-}}}
-
-#endif//_FSHELL_INTERNAL_LIVEBOX_MANAGER_STUB_H_
diff --git a/inc/FShell_LiveboxPopupContext.h b/inc/FShell_LiveboxPopupContext.h
deleted file mode 100644 (file)
index d634977..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxPopupContext.h
- * @brief      This is the header file for the %_LiveboxPopupContext class.
- *
- * This header file contains the declarations of the %_LiveboxPopupContext class.
- */
-
-#ifndef _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
-#define _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
-
-#include "FShell_LiveboxContextBase.h"
-
-namespace Tizen { namespace Shell { namespace App
-{
-
-class _LiveboxPopupContext
-        :public Tizen::Shell::App::_LiveboxContextBase
-{
-public:
-       _LiveboxPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority);
-       virtual ~_LiveboxPopupContext();
-
-       // event handler
-       void OnPopupCreated(double x, double y, int width, int height);
-       void OnPopupDestoyed(void);
-
-       // request to app
-       result SendPopupCreateRequest(double x, double y, int width, int height);
-       result SendPopupDestroyRequest();
-       virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
-
-       result RequestUpdateRemote();
-};
-
-
-} /* namespace App */
-} /* namespace Livebox */
-} /* namespace Samsung */
-#endif // _FSHELL_INTERNAL_LIVEBOX_POPUP_CONTEXT_H_
diff --git a/inc/OspAppWidgetService.h b/inc/OspAppWidgetService.h
new file mode 100644 (file)
index 0000000..65aebb7
--- /dev/null
@@ -0,0 +1,68 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+// All rights reserved.
+//
+// This software contains confidential and proprietary information
+// of Samsung Electronics Co., Ltd.
+// The user of this software agrees not to disclose, disseminate or copy such
+// Confidential Information and shall use the software only in accordance with
+// the terms of the license agreement the user entered into with Samsung.
+//
+
+/**
+ * @file       OspAppWidgetService.h
+ * @brief      This is the header file for the OspAppWidgetService class.
+ *
+ * This header file contains the declarations of the OspAppWidgetService class.
+ */
+
+#ifndef _OSP_APPWIDGET_SERVICE_H_
+#define _OSP_APPWIDGET_SERVICE_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FSystem.h>
+
+/**
+ * [OspAppWidgetService] ServiceApp must inherit from ServiceApp class
+ * which provides basic features necessary to define an ServiceApp.
+ */
+class OspAppWidgetService
+       : public Tizen::App::ServiceApp
+{
+public:
+
+       /**
+        * [OspAppWidgetService] ServiceApp must have a factory method that creates an instance of itself.
+        */
+       static Tizen::App::ServiceApp* CreateInstance(void);
+
+public:
+
+       OspAppWidgetService();
+       ~OspAppWidgetService();
+
+public:
+
+       // Called when the ServiceApp is initializing.
+       bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
+
+       // Called when the ServiceApp initializing is finished.
+       bool OnAppInitialized(void); 
+
+       // Called when the ServiceApp is requested to terminate.
+       bool OnAppWillTerminate(void);
+
+       // Called when the ServiceApp is terminating.
+       bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
+
+       // Called when the system memory is not sufficient to run the ServiceApp any further.
+       void OnLowMemory(void);
+
+       // Called when the battery level changes.
+       void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
+
+};
+
+#endif // _$(baseName_upper)_H_
diff --git a/inc/OspLiveboxService.h b/inc/OspLiveboxService.h
deleted file mode 100644 (file)
index 6bc93eb..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-// All rights reserved.
-//
-// This software contains confidential and proprietary information
-// of Samsung Electronics Co., Ltd.
-// The user of this software agrees not to disclose, disseminate or copy such
-// Confidential Information and shall use the software only in accordance with
-// the terms of the license agreement the user entered into with Samsung.
-//
-
-/**
- * @file       OspLiveboxService.h
- * @brief      This is the header file for the OspLiveboxService class.
- *
- * This header file contains the declarations of the OspLiveboxService class.
- */
-
-#ifndef _OSP_LIVEBOX_SERVICE_H_
-#define _OSP_LIVEBOX_SERVICE_H_
-
-#include <FApp.h>
-#include <FBase.h>
-#include <FSystem.h>
-
-/**
- * [OspLiveboxService] ServiceApp must inherit from ServiceApp class
- * which provides basic features necessary to define an ServiceApp.
- */
-class OspLiveboxService
-       : public Tizen::App::ServiceApp
-{
-public:
-
-       /**
-        * [OspLiveboxService] ServiceApp must have a factory method that creates an instance of itself.
-        */
-       static Tizen::App::ServiceApp* CreateInstance(void);
-
-public:
-
-       OspLiveboxService();
-       ~OspLiveboxService();
-
-public:
-
-       // Called when the ServiceApp is initializing.
-       bool OnAppInitializing(Tizen::App::AppRegistry& appRegistry);
-
-       // Called when the ServiceApp initializing is finished.
-       bool OnAppInitialized(void); 
-
-       // Called when the ServiceApp is requested to terminate.
-       bool OnAppWillTerminate(void);
-
-       // Called when the ServiceApp is terminating.
-       bool OnAppTerminating(Tizen::App::AppRegistry& appRegistry, bool forcedTermination = false);
-
-       // Called when the system memory is not sufficient to run the ServiceApp any further.
-       void OnLowMemory(void);
-
-       // Called when the battery level changes.
-       void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
-
-};
-
-#endif // _$(baseName_upper)_H_
diff --git a/src/FShell_AppWidgetContext.cpp b/src/FShell_AppWidgetContext.cpp
new file mode 100644 (file)
index 0000000..2132179
--- /dev/null
@@ -0,0 +1,302 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetContext.cpp
+ * @brief      This is the implementation for the _AppWidgetContext class.
+ */
+
+#include <stdlib.h>
+#include <unique_ptr.h>
+
+#include "provider_buffer.h"
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+
+#include <FApp_AppControlManager.h>
+
+#include "FShell_AppWidgetManagerService.h"
+#include "FShell_AppWidgetPopupContext.h"
+#include "FShell_AppWidgetContextBase.h"
+#include "FShell_AppWidgetContext.h"
+
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+const char APPWIDGET_ON_ADD[] = "http://tizen.org/appcontrol/appwidget/add";
+const char APPWIDGET_ON_REMOVE[] = "http://tizen.org/appcontrol/appwidget/remove";
+const char APPWIDGET_ON_UPDATE[] = "http://tizen.org/appcontrol/appwidget/update";
+const char APPWIDGET_ON_RESIZE[] = "http://tizen.org/appcontrol/appwidget/resize";
+const char APPWIDGET_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidget/touch";
+
+const String ARG_KEY_WIDTH = L"_Width";
+const String ARG_KEY_HEIGHT = L"_Height";
+const String ARG_KEY_ARGUMENT = L"_Argument";
+const String ARG_KEY_EVENT_TYPE = L"_EventType";
+const String ARG_KEY_TIME_STAMP = L"_TimeStamp";
+const String ARG_KEY_X = L"_X";
+const String ARG_KEY_Y = L"_Y";
+
+const int LIVE_DURATION_MSEC= 30000;//30sec
+
+_AppWidgetContext::_AppWidgetContext(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
+:_AppWidgetContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority)
+,__pAppWidgetPopup(null), __UpdateMillis(period)
+{
+       SysLog(NID_APP, "period(%d)", period);
+
+       __lifeDurationTimer.Construct(*this);//, true);
+       __lifeDurationTimer.Start(LIVE_DURATION_MSEC);
+
+       SysLog(NID_APP, "period(%d)", __UpdateMillis);
+       if( __UpdateMillis > 0)
+       {
+               __UpdateTimer.Construct(*this);//, false);
+               __UpdateTimer.StartAsRepeatable(__UpdateMillis);
+       }
+}
+
+_AppWidgetContext::~_AppWidgetContext()
+{
+       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+       __lifeDurationTimer.Cancel();
+       __UpdateTimer.Cancel();
+
+       if (__pAppWidgetPopup)
+       {
+               SysLog(NID_APP, "Destroying dangling AppWidgetPopup instance..");
+               __pAppWidgetPopup->OnPopupDestoyed();
+               delete __pAppWidgetPopup;
+       }
+}
+
+_AppWidgetPopupContext*
+_AppWidgetContext::GetAppWidgetPopup() const
+{
+       return __pAppWidgetPopup;
+}
+
+void
+_AppWidgetContext::OnAdded(void)
+{
+       SendAddRequest(__width, __height);
+}
+
+void
+_AppWidgetContext::OnRemoved()
+{
+       SendRemoveRequest();
+}
+
+void
+_AppWidgetContext::OnUpdate(const String& argument)
+{
+       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+
+       SendUpdateRequest(__width, __height, argument);
+}
+
+void
+_AppWidgetContext::OnResize(int width, int height)
+{
+       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+
+       __width = width;
+       __height = height;
+       SendResizeRequest(__width, __height);
+}
+
+void
+_AppWidgetContext::OnForeground()
+{
+       SysLog(NID_APP, "");
+       __isForeground = true;
+
+       __UpdateTimer.Cancel();
+       __UpdateTimer.StartAsRepeatable(__UpdateMillis);
+}
+
+void
+_AppWidgetContext::OnBackground()
+{
+       SysLog(NID_APP, "");
+       __isForeground = false;
+       __UpdateTimer.Cancel();
+}
+
+void
+_AppWidgetContext::OnPopupCreated(double x, double y, int width, int height)
+{
+       __pAppWidgetPopup = new (std::nothrow) _AppWidgetPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority);
+       __pAppWidgetPopup->SetClientId(__ipcClientId);
+       __pAppWidgetPopup->OnPopupCreated(x, y, width, height);
+
+       __lifeDurationTimer.Cancel();
+}
+
+void
+_AppWidgetContext::OnPopupDestoyed(void)
+{
+       if (__pAppWidgetPopup)
+       {
+               __pAppWidgetPopup->OnPopupDestoyed();
+               delete __pAppWidgetPopup;
+               __pAppWidgetPopup = null;
+       }
+       RestartLifeDurationTimer();
+}
+
+result
+_AppWidgetContext::SendAddRequest(int width, int height)
+{
+/*     std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
+       pArgs->Construct();
+       pArgs->Add(*new String(__instanceId));
+       pArgs->Add(*new String(__providerId));
+       pArgs->Add(*new String(__info));
+       pArgs->Add(*new String(Integer::ToString(width)));
+       pArgs->Add(*new String(Integer::ToString(height)));*/
+
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
+
+       return SendRequestToApp( __appId, APPWIDGET_ON_ADD, pArgs.get());
+}
+
+result
+_AppWidgetContext::SendUpdateRequest(int width, int height, const String& argument)
+{
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
+       pArgs->Add(new String(ARG_KEY_ARGUMENT), new String(argument));
+
+       return SendRequestToApp( __appId, APPWIDGET_ON_UPDATE, pArgs.get());
+}
+
+result
+_AppWidgetContext::SendResizeRequest(int width, int height)
+{
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
+
+       return SendRequestToApp( __appId, APPWIDGET_ON_RESIZE, pArgs.get());
+}
+
+result
+_AppWidgetContext::SendRemoveRequest()
+{
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       return SendRequestToApp( __appId, APPWIDGET_ON_REMOVE, pArgs.get());
+}
+
+result
+_AppWidgetContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
+{
+       SysLog(NID_APP, "");
+       if( HasValidClientId() == false )
+       {
+               std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+               pArgs->Add(new String(ARG_KEY_EVENT_TYPE), new String(Integer::ToString(event)));
+               pArgs->Add(new String(ARG_KEY_TIME_STAMP), new String(Double::ToString(timestamp)));
+               pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
+               pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
+
+               return SendRequestToApp( __appId, APPWIDGET_ON_TOUCH, pArgs.get());
+       }
+       else
+       {
+//             SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
+               AppWidgetManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y);
+       }
+       return E_SUCCESS;
+}
+
+result
+_AppWidgetContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+{
+       result r = _AppWidgetContextBase::SendRequestToApp(appId, operation, pArgs);
+       RestartLifeDurationTimer();
+
+       return r;
+}
+
+result
+_AppWidgetContext::RequestUpdateRemote(int width, int height)
+{
+       /*if( GetAppWidgetPopup() != null)
+       {
+               SysLog(NID_APP, "AppWidgetPopup is appeared, so appWidget doesn't need to update");
+               return E_SUCCESS;
+       }*/
+       std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
+       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
+       std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__userInfo));
+
+       int ret = provider_send_updated(packageName.get(), id.get(), width, height, __priority, content_info.get(), null);
+       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
+
+       SysLog(NID_APP, "Done");
+       return E_SUCCESS;
+}
+
+void
+_AppWidgetContext::RestartLifeDurationTimer()
+{
+       __lifeDurationTimer.Cancel();
+       __lifeDurationTimer.Start(LIVE_DURATION_MSEC);
+       SysLog(NID_APP, "lifeDuration timer restarted (%d)msec", LIVE_DURATION_MSEC);
+}
+
+void
+_AppWidgetContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
+{
+       SysLog(NID_APP, "");
+
+       if( &timer == &__lifeDurationTimer)
+       {
+               SysLog(NID_APP, "lifeDuration timer is expired, so terminating appWidget app(%ls)..", __providerId.GetPointer() );
+
+               ReleaseSharedMem();
+               AppManager::GetInstance()->TerminateApplication(__appId);
+
+       }
+       else if( &timer == &__UpdateTimer)
+       {
+               SysLog(NID_APP, "update timer is expired for appWidget app(%ls)..", __providerId.GetPointer() );
+               OnUpdate(L"");
+       }
+}
+
+
+} } } // Tizen::Shell::App {
+
diff --git a/src/FShell_AppWidgetContextBase.cpp b/src/FShell_AppWidgetContextBase.cpp
new file mode 100644 (file)
index 0000000..edfe313
--- /dev/null
@@ -0,0 +1,339 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetContextBase.cpp
+ * @brief      This is the implementation for the _AppWidgetContextBase class.
+ */
+
+#include <stdlib.h>
+#include <unique_ptr.h>
+
+#include "provider_buffer.h"
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+
+#include <FApp_AppMessageImpl.h>
+#include <FApp_AppArg.h>
+#include <FApp_AppControlManager.h>
+#include <FShell_TemplateUtil.h>
+#include <FShell_AppWidgetManagerImpl.h>
+
+#include "FShell_AppWidgetContextBase.h"
+
+// provider/src/fb.c
+struct fb_info {
+        char *id;
+        int w;
+        int h;
+        int bufsz;
+        void *buffer;
+
+        int handle;
+};
+
+// provider/inc/provider_buffer_internal.h
+struct livebox_buffer {
+       enum {
+               BUFFER_CREATED = 0x00beef00,
+               BUFFER_DESTROYED = 0x00dead00,
+       } state;
+
+       enum target_type type;
+
+       union {
+               int fd; /* File handle(descriptor) */
+               int id; /* SHM handle(id) */
+       } handle;
+
+       char *pkgname;
+       char *id;
+       int width;
+       int height;
+       int pixel_size;
+
+       struct fb_info *fb;
+
+       int (*handler)(struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void *data);
+       void *data;
+};
+
+static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
+               double timestamp, double x, double y, void* data);
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+const String APPWIDGET_ON_ADD(L"AppWidget='event=add'");
+const String APPWIDGET_ON_REMOVE(L"AppWidget='event=remove'");
+const String APPWIDGET_ON_UPDATE(L"AppWidget='event=update'");
+const String APPWIDGET_ON_RESIZE(L"AppWidget='event=resize'");
+const String APPWIDGET_ON_TOUCH(L"AppWidget='event=touch'");
+const String APPWIDGET_POPUP_ON_CREATE(L"AppWidgetPopup='event=create'");
+const String APPWIDGET_POPUP_ON_DESTROY(L"AppWidgetPopup='event=destroy'");
+const String APPWIDGET_POPUP_ON_TOUCH(L"AppWidgetPopup='event=touch'");
+
+const String ARG_KEY_INSTANCE_ID = L"_InstanceId";
+const String ARG_KEY_PROVIDER_NAME = L"_ProviderName";
+const String ARG_KEY_USER_INFO = L"_UserInfo";
+
+
+_AppWidgetContextBase::_AppWidgetContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
+       :__type(type)
+       ,__userInfo(userInfo)
+       ,__providerId(providerId)
+       ,__instanceId(instanceId)
+       ,__width(width)
+       ,__height(height)
+       ,__priority(priority)
+       ,__isForeground(true)
+       ,__ipcClientId(-1)
+       ,__buffer_info(null)
+       ,__buffer(null)
+{
+       _AppWidgetManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName);
+
+       SysLog(NID_APP, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+}
+
+_AppWidgetContextBase::~_AppWidgetContextBase()
+{
+       SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+}
+
+
+void
+_AppWidgetContextBase::SetClientId(int clientId)
+{
+       __ipcClientId = clientId;
+}
+
+bool
+_AppWidgetContextBase::HasValidClientId() const
+{
+       SysLog(NID_APP, "%d", __ipcClientId);
+       return (__ipcClientId > -1);
+}
+
+int
+_AppWidgetContextBase::GetSharedMemId(int w, int h)
+{
+       SysLog(NID_APP, "Enter");
+
+       if( __buffer_info == null)
+       {
+               std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
+               std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
+
+               __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), AppWidgetHandleBufferEventCallback, this);
+               SysTryReturnResult(NID_APP, __buffer_info , -1, "[E_SYSTEM] failed to provider_buffer_acquire");
+               SysLog(NID_APP, "provider_buffer_acquire successed");
+
+               __buffer = provider_buffer_ref(__buffer_info);
+               SysTryReturnResult(NID_APP, __buffer , -1, "[E_SYSTEM] failed to provider_buffer_ref");
+               SysLog(NID_APP, "provider_buffer_ref successed");
+       }
+
+    int bufferId = __buffer_info->fb->handle;
+
+    SysLog(NID_APP, "(%d) Exit", bufferId);
+    return bufferId;
+}
+
+result
+_AppWidgetContextBase::ReleaseSharedMem()
+{
+       SysLog(NID_APP, "Enter");
+
+    int ret;
+
+    if( __buffer)
+    {
+       ret = provider_buffer_unref(__buffer);
+       __buffer = null;
+       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_unref");
+       SysLog(NID_APP, "provider_buffer_unref successed");
+    }
+
+    if( __buffer_info)
+    {
+               ret = provider_buffer_release(__buffer_info);
+               __buffer_info = null;
+               SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_release");
+               SysLog(NID_APP, "provider_buffer_release successed");
+    }
+
+    SysLog(NID_APP, "Exit.");
+
+    return E_SUCCESS;
+}
+
+Tizen::Base::Collection::HashMap*
+_AppWidgetContextBase::CreateRequestArgs(void)
+{
+       HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
+       pArgs->Construct();
+       pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
+       pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
+       pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
+
+       return pArgs;
+}
+
+result
+_AppWidgetContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+{
+       if( __isForeground == false)
+       {
+               SysLog(NID_APP, "appWidget isn't foreground, so, message skip");
+               return E_SUCCESS;
+       }
+
+       return _AppWidgetRequestHelper::SendRequestToApp(appId, operation, pArgs);
+}
+
+result
+_AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
+{
+       SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() );
+
+       _AppMessageImpl msg;
+       msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"livebox");
+       Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs);
+
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
+       std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
+
+       return Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
+}
+
+/*result
+_AppWidgetRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName)
+{
+       const int APP_ID_LEN = 10;
+
+       if (appId.GetLength() > APP_ID_LEN)
+       {
+               result r = appId.SubString(APP_ID_LEN + 1, appId.GetLength() - (APP_ID_LEN + 1), outExecutableName);
+               SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer());
+
+               r = appId.SubString(0, APP_ID_LEN, outPackageId);
+               SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer());
+
+               return E_SUCCESS;
+       }
+       return E_SYSTEM;
+}*/
+
+/*
+// helper for bundle
+result
+_AppWidgetRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList)
+{
+       bundle* pb = b;
+       SysTryReturnResult(NID_APP, pb != NULL, E_INVALID_ARG, "Empty bundle.");
+
+       if (pList == null || pList->GetCount() == 0)
+       {
+               SysLog(NID_APP, "No element added for bundle.");
+               return E_SUCCESS;
+       }
+
+       int i = 0;
+       const int count = pList->GetCount();
+
+       const char** pSa = new (std::nothrow) const char*[count];
+       SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with cound %d.", count);
+
+       for (i = 0; i < count; i++)
+       {
+               pSa[i] = null;
+
+               const String* pStr = static_cast<const String*>(pList->GetAt(i));
+               if (pStr)
+               {
+                       pSa[i] = _StringConverter::CopyToCharArrayN(*pStr);
+               }
+       }
+
+       result r = E_SUCCESS;
+
+       int ret = bundle_add_str_array(pb, key, pSa, count);
+       SysTryReturnResult(NID_APP, ret >= 0, E_SYSTEM, "Bundle add failre with %d.", strerror(errno));
+
+//CATCH:
+       for (i = 0; i < count; i++)
+       {
+               delete[] pSa[i];
+       }
+
+       delete[] pSa;
+
+       return r;
+}
+*/
+
+} } } // Tizen::Shell::App {
+
+
+////////////////////////////////////////////
+// callback
+////////////////////////////////////////////
+static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
+               double timestamp, double x, double y, void* data)
+{
+    SysLog(NID_APP, "timestamp(%f), x(%f), y(%f)", timestamp, x, y);
+
+    Tizen::Shell::App::_AppWidgetContextBase *pAppWidgetBase = static_cast<Tizen::Shell::App::_AppWidgetContextBase*>(data);
+    SysTryReturn(NID_APP, pAppWidgetBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pAppWidgetBase is null");
+
+//    const char *pkgname = provider_buffer_pkgname(info);
+//    const char *id = provider_buffer_id(info);
+//    enum target_type type = provider_buffer_type(info);
+
+    if( event ==  BUFFER_EVENT_ENTER)
+    {
+       SysLog(NID_APP, "BUFFER_EVENT_ENTER");
+    }
+    else if(   event ==  BUFFER_EVENT_LEAVE)
+    {
+       SysLog(NID_APP, "BUFFER_EVENT_LEAVE");
+    }
+    else if(   event ==  BUFFER_EVENT_DOWN)
+       {
+               SysLog(NID_APP, "BUFFER_EVENT_DOWN");
+       }
+    else if(   event ==  BUFFER_EVENT_MOVE)
+    {
+               SysLog(NID_APP, "BUFFER_EVENT_MOVE");
+       }
+    else if(   event ==  BUFFER_EVENT_UP)
+       {
+               SysLog(NID_APP, "BUFFER_EVENT_UP");
+       }
+
+    pAppWidgetBase->SendTouchEvent(event, timestamp, x, y);
+
+    return 0;
+}
diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp
new file mode 100644 (file)
index 0000000..e49842f
--- /dev/null
@@ -0,0 +1,647 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetManagerService.cpp
+ * @brief      This is the implementation for the AppWidgetManagerService class.
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <unique_ptr.h>
+#include <provider.h>
+#include <aul.h>
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FApp.h>
+#include <FApp_AppManagerImpl.h>
+#include <FIo_IpcServer.h>
+#include <FBase_StringConverter.h>
+
+#include "FShell_AppWidgetContext.h"
+#include "FShell_AppWidgetPopupContext.h"
+#include "FShell_AppWidgetManagerStub.h"
+
+#include "FShell_AppWidgetManagerService.h"
+
+namespace Tizen { namespace Shell  { namespace App {
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Io;
+using namespace Tizen::System;
+using namespace Tizen::Shell::App;
+
+
+namespace
+{
+static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
+}
+
+AppWidgetManagerService::AppWidgetManagerService()
+{
+}
+
+AppWidgetManagerService::~AppWidgetManagerService()
+{
+       __pingTimer.Cancel();
+       DeinitializeMasterDaemonEventReceiver();
+}
+
+AppWidgetManagerService*
+AppWidgetManagerService::GetInstance(void)
+{
+       static AppWidgetManagerService* pSelf = null;
+       if( pSelf == null)
+       {
+               pSelf = new AppWidgetManagerService();
+               SysTryReturn(NID_APP, pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+               result r = pSelf->Construct();
+               SysAssertf(!IsFailed(r), "Failed to construct AppWidgetManagerService");
+               SysLog(NID_APP, "AppWidgetManagerService is created.");
+       }
+       return pSelf;
+}
+
+result
+AppWidgetManagerService::Construct()
+{
+//     _AppManagerImpl::GetInstance()->AddEventListener(*this);
+
+       _AppWidgetManagerStub::StartIpcServer();
+
+       result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
+       SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
+
+       r = __handlerThread.Start();
+       SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
+
+       return InitializeMasterDaemonEventReceiver("osp-livebox-service");
+}
+
+int
+AppWidgetManagerService::AppWidgetConnected(struct event_arg *arg, void* data)
+{
+    int ret;
+    ret = provider_send_hello();
+    if (ret == 0)
+    {
+       SysLog(NID_APP, "success to be connected with master daemon");
+       AppWidgetManagerService::GetInstance()->StartPingTimer();
+
+    }
+    else
+    {
+       SysLog(NID_APP, "failed to provider_send_hello()");
+    }
+    return ret;
+}
+
+int
+AppWidgetManagerService::AppWidgetDisconnected(struct event_arg *arg, void* data)
+{
+       SysLog(NID_APP, "success to be disconnected with master daemon");
+//     aul_terminate_pid(getpid());
+    return 0;
+}
+
+void
+AppWidgetManagerService::StartPingTimer()
+{
+       __pingTimer.Construct(*this);//, true);
+       __pingTimer.StartAsRepeatable(120000);
+}
+
+void
+AppWidgetManagerService::OnTimerExpired(Timer& timer)
+{
+       SysLog(NID_APP, "provider_send_ping");
+       provider_send_ping();
+}
+
+_AppWidgetContext*
+AppWidgetManagerService::Find(const String& appId, const String& instanceId) const
+{
+       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+//             SysLog(NID_APP, "%ls", pAppWidgetContext->__instanceId.GetPointer());
+
+               if ( pAppWidgetContext->__instanceId == instanceId )
+               {
+//                     SysAssert(pAppWidgetContext->__appId == appId)
+                       return pAppWidgetContext;
+               }
+       }
+       return null;
+}
+
+result
+AppWidgetManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId)
+{
+       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+               SysLog(NID_APP, "%ls", pAppWidgetContext->__instanceId.GetPointer());
+               SysLog(NID_APP, "%ls, %ls", pAppWidgetContext->__providerId.GetPointer(), appId.GetPointer());
+
+               if ( pAppWidgetContext->__appId == appId )
+               {
+                       pAppWidgetContext->SetClientId(clientId);
+                       SysLog(NID_APP, "client is registered.(%d)", clientId);
+                       if( clientId == -1)
+                       {
+                               pAppWidgetContext->ReleaseSharedMem();
+                               if(pAppWidgetContext->GetAppWidgetPopup())
+                               {
+                                       pAppWidgetContext->OnPopupDestoyed();
+                               }
+                       }
+               }
+       }
+       return E_SUCCESS;
+}
+
+void
+AppWidgetManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+       //SysLog(NID_APP, "(clientId:%d)\n", clientId);
+       String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
+       SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
+//     this->SetClientIds(fullAppId, clientId);//Todo
+
+}
+
+void
+AppWidgetManagerService::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
+{
+       String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
+       SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
+       this->SetClientIds(fullAppId, -1);
+}
+
+result
+AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext)
+{
+       SysLog(NID_APP, "%ls, %ls, count(%d)", pAppWidgetContext->__providerId.GetPointer(), pAppWidgetContext->__instanceId.GetPointer(), __appWidgetContextList.GetCount());
+
+       return __appWidgetContextList.Add(pAppWidgetContext);
+}
+
+result
+AppWidgetManagerService::RemoveAppWidget(const char* pPackageName, const char* pId, bool free)
+{
+       SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __appWidgetContextList.GetCount());
+
+       SysTryReturn(NID_APP, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysLog(NID_APP, "%s, %s", pPackageName, pId);
+
+       _AppWidgetContext* pAppWidgetContext = Find(pPackageName, pId);
+       SysTryReturn(NID_APP, pAppWidgetContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
+
+       result r = __appWidgetContextList.Remove(pAppWidgetContext);
+
+       if( __appWidgetContextList.GetCount() == 0 )
+       {
+               SysLog(NID_APP, "No running native appWidget app remains, terminating osp appWidget service...");
+               Tizen::App::App::GetInstance()->Terminate();
+       }
+
+       return r;
+}
+
+
+///////////////////////////////////////////////////////
+// MasterDaemonEventReceiver implementation
+///////////////////////////////////////////////////////
+int
+AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
+{
+       SysTryReturn(NID_APP, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysTryReturn(NID_APP, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysTryReturn(NID_APP, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysTryReturn(NID_APP, arg->type == event_arg::EVENT_NEW, -EPERM, E_SUCCESS, "invalid argument from master");
+
+       SysLog(NID_APP, "packageName(%s) id(%s) content(%s) cluster(%s) category(%s)", arg->pkgname, arg->id, arg->info.lb_create.content, arg->info.lb_create.cluster, arg->info.lb_create.category);
+       SysTryReturn (NID_APP, AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist");
+
+       double default_priority = 1.0f;
+       _AppWidgetContext* pAppWidgetContext = new (std::nothrow)_AppWidgetContext( arg->info.lb_create.content, arg->pkgname, arg->id,
+                       arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
+       SysTryReturn(NID_APP, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+       AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance();
+       pAppWidgetService->AddAppWidget(pAppWidgetContext);
+       pAppWidgetContext->OnAdded();
+
+       *priority = pAppWidgetContext->__priority;
+       *height= pAppWidgetContext->__height;
+       *width = pAppWidgetContext->__width;
+
+       SysLog(NID_APP, "Exit. %d appWidget(es)", pAppWidgetService->__appWidgetContextList.GetCount());
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetUpdate(struct event_arg *arg, void* data)
+{
+       if( arg->id == null || strlen(arg->id) < 1)
+       {
+               SysLog(NID_APP, "updating alls");
+               AppWidgetManagerService::GetInstance()->UpdateAllAppWidgetesByAppId(arg->pkgname);
+       }
+       else
+       {
+               _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+               SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+               pAppWidgetContext->OnUpdate(L"");
+       }
+
+       return 0;
+}
+
+int
+AppWidgetManagerService::UpdateAllAppWidgetesByAppId(const String& providerId)
+{
+       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+               if ( pAppWidgetContext->__providerId == providerId )
+               {
+                       pAppWidgetContext->OnUpdate(L"");
+               }
+       }
+       return E_SUCCESS;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetDestroy(struct event_arg *arg, void* data)
+{
+       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_DELETE, -EPERM, E_SUCCESS, "invalid argument from master");
+       SysLog(NID_APP, "Enter");
+
+       AppWidgetManagerService* pAppWidgetManagerService = AppWidgetManagerService::GetInstance();
+
+       _AppWidgetContext* pAppWidgetContext = pAppWidgetManagerService->Find(arg->pkgname, arg->id);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+    pAppWidgetContext->OnRemoved();
+    pAppWidgetManagerService->RemoveAppWidget( arg->pkgname, arg->id, true);
+    delete pAppWidgetContext;
+
+    SysLog(NID_APP, "Exit");
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetPopupCreate(struct event_arg *arg, void* data)
+{
+       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master");
+       SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
+
+       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+       /*if( pAppWidgetContext->GetAppWidgetPopup() )
+       {
+               pAppWidgetContext->OnPopupDestoyed();
+       }*/
+       pAppWidgetContext->OnPopupCreated(arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
+
+    return 0;
+}
+
+ int
+ AppWidgetManagerService::OnAppWidgetPopupDestroy(struct event_arg *arg, void* data)
+{
+       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master");
+       SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+       pAppWidgetContext->OnPopupDestoyed();
+
+    return 0;
+}
+
+ int
+ AppWidgetManagerService::OnLivePause(struct event_arg *arg, void* data)
+{
+        SysTryReturn(NID_APP, arg, 0, E_SUCCESS, "arg is null!");
+
+        _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+        SysTryReturnResult(NID_APP, pAppWidgetContext , 0, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+        SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+        pAppWidgetContext->OnBackground();
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetResume(struct event_arg *arg, void* data)
+{
+       SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
+
+       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+       SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
+       pAppWidgetContext->OnForeground();
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetClick(struct event_arg *arg, void* data)
+{
+       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_CLICKED, -EPERM, E_SUCCESS, "invalid argument from master");
+       SysTryReturn(NID_APP, arg != null, -EPERM, E_SUCCESS, "arg is null!");
+       SysLog(NID_APP, "packageName(%s), id(%s), clicked.event(%s), clicked.x(%d), clicked.y(%d)", arg->pkgname, arg->id, arg->info.clicked.event, arg->info.clicked.x, arg->info.clicked.y);
+
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetResize(struct event_arg *arg, void* data)
+{
+       SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
+       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_RESIZE, -EPERM, E_SUCCESS, "invalid argument from master");
+
+       SysLog(NID_APP, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
+
+       _AppWidgetContext* pAppWidgetContext = AppWidgetManagerService::GetInstance()->Find(arg->pkgname, arg->id);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
+
+       pAppWidgetContext->OnResize(arg->info.resize.w, arg->info.resize.h);
+
+    return 0;
+}
+
+int
+AppWidgetManagerService::OnAppWidgetPeriodChaned(struct event_arg *arg, void* data)
+{
+       SysTryReturn(NID_APP, arg != null, 0, E_SUCCESS, "arg is null!");
+       SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
+    return 0;
+}
+
+result
+AppWidgetManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceExecutableName)
+{
+       SysTryReturnResult(NID_APP, pServiceExecutableName != null, E_INVALID_ARG, "");
+       SysLog(NID_APP, "Enter.");
+
+       __appWidgetContextList.Construct();
+
+       /*!
+        * \note
+        * Only for the buffer type
+        */
+    struct event_handler cbs;
+    memset(&cbs, 0, sizeof(event_handler));
+
+    cbs.connected = AppWidgetConnected,
+    cbs.disconnected = AppWidgetDisconnected,
+    cbs.pause = OnLivePause,
+    cbs.resume = OnAppWidgetResume,
+//    cbs.lb_pause = OnLivePause,
+//    cbs.lb_resume = OnAppWidgetResume,
+    cbs.lb_create = OnAppWidgetCreate,
+    cbs.lb_destroy = OnAppWidgetDestroy,
+    cbs.update_content = OnAppWidgetUpdate,
+    cbs.pd_create = OnAppWidgetPopupCreate,
+    cbs.pd_destroy = OnAppWidgetPopupDestroy,
+    cbs.clicked = OnAppWidgetClick,
+    cbs.resize = OnAppWidgetResize,
+    cbs.set_period = OnAppWidgetPeriodChaned;
+    //cbs.lb_recreate = OnAppWidgetRecreate,/* Recover from the fault of slave */
+    //cbs.content_event = OnAppWidgetContentEvent,
+    //cbs.change_group = OnAppWidgetGroupChanged;
+
+    int ret = provider_init(null, pServiceExecutableName, &cbs, this);
+    SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "provider_init failed.");
+
+    SysLog(NID_APP, "Exit.");
+    return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::DeinitializeMasterDaemonEventReceiver()
+{
+       SysLog(NID_APP, "Enter.");
+    provider_fini();
+    SysLog(NID_APP, "Exit.");
+    return E_SUCCESS;
+}
+
+///////////////////////////////////////////////////////
+// stub implmentation
+///////////////////////////////////////////////////////
+
+result
+AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
+{
+       SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
+
+       bool found = false;
+       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+               if ( pAppWidgetContext->__appId == appId && pAppWidgetContext->__providerName == providerName)
+               {
+                       SysLog(NID_APP, "OK");
+
+                       ArrayList* pArray = new (std::nothrow) ArrayList();
+                       SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+                       pArray->Construct();
+                       pArray->Add(pAppWidgetContext);
+                       pArray->Add(new String(argument));
+
+                       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
+
+                       found = true;
+               }
+       }
+       SysLog(NID_APP, "Exit.");
+       return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
+
+}
+
+result
+AppWidgetManagerService::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
+{
+       SysLog(NID_APP, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
+
+       for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+       {
+               _AppWidgetContext* pAppWidgetContext = null;
+               __appWidgetContextList.GetAt(i, pAppWidgetContext);
+
+               if ( pAppWidgetContext->__instanceId == instanceId)
+               {
+                       SysLog(NID_APP, "OK");
+
+                       ArrayList* pArray = new (std::nothrow) ArrayList();
+                       SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+                       pArray->Construct();
+                       pArray->Add(pAppWidgetContext);
+                       pArray->Add(new String(argument));
+
+                       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
+                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
+
+                       return E_SUCCESS;
+               }
+       }
+       SysLog(NID_APP, "Exit.");
+       return E_OBJ_NOT_FOUND;
+}
+
+result
+AppWidgetManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       if(pAppWidgetContext->HasValidClientId() == false)
+       {
+               String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
+               this->SetClientIds(fullAppId, __pIpcServer->GetClientId());
+       }
+
+       shmId = pAppWidgetContext->GetSharedMemId(width, height);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+    return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
+{
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       _AppWidgetPopupContext* pPd = pAppWidgetContext->GetAppWidgetPopup();
+       SysTryReturnResult(NID_APP, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       if(pPd->HasValidClientId() == false)
+       {
+               String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
+               pPd->SetClientId(__pIpcServer->GetClientId());
+       }
+
+       shmId = pPd->GetSharedMemId(width, height);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+    return E_SUCCESS;
+}
+
+result
+AppWidgetManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height)
+{
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       return pAppWidgetContext->RequestUpdateRemote(width, height);
+}
+
+result
+AppWidgetManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+       SysTryReturnResult(NID_APP, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       return pAppWidgetContext->GetAppWidgetPopup()->RequestUpdateRemote();
+}
+
+result
+AppWidgetManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+       std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
+       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
+
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+       return pAppWidgetContext->ReleaseSharedMem();
+}
+
+result
+AppWidgetManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
+{
+       std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
+       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
+
+       _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
+       SysTryReturnResult(NID_APP, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+       SysTryReturnResult(NID_APP, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
+
+//     return pAppWidgetContext->GetAppWidgetPopup()->ReleaseSharedMem();
+       return E_SUCCESS;
+}
+
+AppWidgetManagerService::_TaskHandlerThread::~_TaskHandlerThread(void)
+{
+
+}
+
+void
+AppWidgetManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, IList* pArgs)
+{
+       SysTryReturnVoidResult(NID_APP, pArgs != null, E_INVALID_STATE, "pArgs is null!.");
+
+       SysLog(NID_APP, "Enter.");
+
+       switch (reqId)
+       {
+       case LOCAL_EVENT_REQUEST_UPDATE:
+       {
+               _AppWidgetContext* pAppWidgetContext = dynamic_cast<_AppWidgetContext*>( pArgs->GetAt(0) );
+               SysTryReturnVoidResult(NID_APP, pAppWidgetContext != null, E_INVALID_STATE, "_AppWidget is null!.");
+
+               String* pArgument = dynamic_cast<String*>( pArgs->GetAt(1) );
+               SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!.");
+
+               pAppWidgetContext->OnUpdate(*pArgument);
+
+               delete pArgument;
+               pArgs->RemoveAll();
+               delete pArgs;
+       }
+               break;
+
+       default:
+               SysAssertf(false, "never get here!");
+               break;
+       }
+       SysLog(NID_APP, "Exit.");
+}
+
+} } } //namespace Tizen { namespace Shell  { namespace App {
diff --git a/src/FShell_AppWidgetManagerStub.cpp b/src/FShell_AppWidgetManagerStub.cpp
new file mode 100644 (file)
index 0000000..61344ce
--- /dev/null
@@ -0,0 +1,231 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetManagerStub.cpp
+ * @brief      This is the implementation for the _AppWidgetManagerStub class.
+ */
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FIo_IpcServer.h>
+#include <FShell_AppWidgetManagerIpcMessage.h>
+
+#include "FShell_AppWidgetManagerStub.h"
+
+
+namespace Tizen { namespace Shell  { namespace App {
+
+namespace
+{
+const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.appwidgetmanager";
+const int INVALID_CLIENT_ID = -1;
+};
+
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Text;
+using namespace Tizen::Security;
+
+
+_AppWidgetManagerStub::_AppWidgetManagerStub(void)
+:__pIpcServer(null)
+{
+       SysLog(NID_APP, "Enter\n");
+
+       SysLog(NID_APP, "Exit\n");
+}
+
+_AppWidgetManagerStub::~_AppWidgetManagerStub(void)
+{
+       SysLog(NID_APP, "Enter\n");
+
+       if ( __pIpcServer != null)
+       {
+               __pIpcServer->Stop();
+               delete __pIpcServer;
+       }
+
+       SysLog(NID_APP, "Exit\n");
+}
+
+result
+_AppWidgetManagerStub::StartIpcServer(void)
+{
+       SysLog(NID_APP, "Enter.");
+       __pIpcServer = new (std::nothrow) _IpcServer();
+       SysTryReturn(NID_APP, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
+
+       result r = __pIpcServer->Construct( IPC_SERVER_NAME, *this, false);
+       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
+       SysLog(NID_APP, "Exit.");
+
+       return E_SUCCESS;
+
+CATCH:
+       delete __pIpcServer;
+       __pIpcServer = null;
+       return r;
+}
+
+
+/////////////////////////////////////////////
+// handlers
+/////////////////////////////////////////////
+
+
+
+bool
+_AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
+{
+       SysLog(NID_APP, "");
+       *pRes = RequestUpdate(appId, providerName, argument);
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
+{
+       SysLog(NID_APP, "");
+       *pRes = RequestUpdateInstance(instanceId, argument);
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
+{
+       SysLog(NID_APP, "(instanceId:%d)xxx", instanceId.GetPointer());
+
+       RequestSharedMemoryId(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
+{
+       SysLog(NID_APP, "(instanceId:%d)", instanceId.GetPointer());
+
+       RequestSharedMemoryIdForPD(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
+{
+       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
+
+       *pRes = RequestSyncSharedMemory(__pIpcServer->GetClientAppId(), instanceId, w, h);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
+{
+       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
+
+       *pRes = RequestSyncSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
+{
+       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
+
+       *pRes = RequestReleaseSharedMemory(__pIpcServer->GetClientAppId(), instanceId);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
+{
+       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
+
+       *pRes = RequestReleaseSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
+
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
+{
+       SysLog(NID_APP,"");
+       result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
+       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
+       return true;
+}
+
+bool
+_AppWidgetManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
+{
+       SysLog(NID_APP,"");
+       result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
+       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
+
+       return true;
+}
+
+
+void
+_AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
+{
+       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
+
+       IPC_BEGIN_MESSAGE_MAP(_AppWidgetManagerStub, message)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdate, &server, OnRequestUpdate)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
+               IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
+       IPC_END_MESSAGE_MAP()
+}
+
+void
+_AppWidgetManagerStub::OnIpcServerStarted(const _IpcServer& server)
+{
+       SysLog(NID_APP, "\n");
+}
+
+void
+_AppWidgetManagerStub::OnIpcServerStopped(const _IpcServer& server)
+{
+       SysLog(NID_APP, "\n");
+}
+
+void
+_AppWidgetManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+       SysLog(NID_APP, "(clientId:%d)\n", clientId);
+
+}
+
+void
+_AppWidgetManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
+{
+       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
+}
+
+
+}}}//namespace Tizen { namespace Shell  { namespace App {
diff --git a/src/FShell_AppWidgetPopupContext.cpp b/src/FShell_AppWidgetPopupContext.cpp
new file mode 100644 (file)
index 0000000..064ef12
--- /dev/null
@@ -0,0 +1,141 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       FShell_AppWidgetPopupContext.cpp
+ * @brief      This is the implementation for the _AppWidgetPopupContext class.
+ */
+
+#include <stdlib.h>
+#include <unique_ptr.h>
+
+#include "provider_buffer.h"
+
+#include <FBase.h>
+#include <FBaseSysLog.h>
+#include <FBase_StringConverter.h>
+
+#include <FApp_AppControlManager.h>
+
+#include "FShell_AppWidgetManagerService.h"
+#include "FShell_AppWidgetPopupContext.h"
+
+namespace Tizen { namespace Shell  { namespace App
+{
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+const char APPWIDGET_POPUP_ON_CREATE[] = "http://tizen.org/appcontrol/appwidgetpopup/create";
+const char APPWIDGET_POPUP_ON_DESTROY[] = "http://tizen.org/appcontrol/appwidgetpopup/destroy";
+const char APPWIDGET_POPUP_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidgetpopup/touch";
+
+const String ARG_KEY_X = L"_X";
+const String ARG_KEY_Y = L"_Y";
+const String ARG_KEY_WIDTH = L"_Width";
+const String ARG_KEY_HEIGHT = L"_Height";
+
+
+_AppWidgetPopupContext::_AppWidgetPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
+:_AppWidgetContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
+{
+       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
+}
+
+_AppWidgetPopupContext::~_AppWidgetPopupContext()
+{
+       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
+       ReleaseSharedMem();
+}
+
+
+void
+_AppWidgetPopupContext::OnPopupCreated(double x, double y, int width, int height)
+{
+       SysLog(NID_APP, "width(%d), height(%d)", width, height);
+       SendPopupCreateRequest(x, y, width, height);
+}
+
+void
+_AppWidgetPopupContext::OnPopupDestoyed()
+{
+       SysLog(NID_APP, "");
+       SendPopupDestroyRequest();
+}
+
+result
+_AppWidgetPopupContext::SendPopupCreateRequest(double x, double y, int width, int height)
+{
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
+       pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
+       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
+       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
+
+       return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_CREATE, pArgs.get());
+}
+
+result
+_AppWidgetPopupContext::SendPopupDestroyRequest()
+{
+       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
+
+       return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_DESTROY, pArgs.get());
+}
+
+result
+_AppWidgetPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
+{
+       SysLog(NID_APP, "");
+       /*if( HasValidClientId() == false )
+       {
+               std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
+               pArgs->Construct();
+               pArgs->Add(*new String(__instanceId));
+               pArgs->Add(*new String(__info));
+               pArgs->Add(*new String(Integer::ToString(event)));
+               pArgs->Add(*new String(Double::ToString(timestamp)));
+               pArgs->Add(*new String(Double::ToString(x)));
+               pArgs->Add(*new String(Double::ToString(y)));
+
+               return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_TOUCH, pArgs.get());
+       }
+       else*/
+       {
+//             SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
+               AppWidgetManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
+       }
+       return E_SUCCESS;
+}
+
+result
+_AppWidgetPopupContext::RequestUpdateRemote()
+{
+       std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
+       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
+
+       int ret = provider_send_desc_updated(packageName.get(), id.get(), null);
+       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
+
+       SysLog(NID_APP, "Done");
+       return E_SUCCESS;
+}
+
+} } } // Tizen::Shell::App {
+
diff --git a/src/FShell_LiveboxContext.cpp b/src/FShell_LiveboxContext.cpp
deleted file mode 100644 (file)
index 9f2dd14..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxContext.cpp
- * @brief      This is the implementation for the _LiveboxContext class.
- */
-
-#include <stdlib.h>
-#include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FBase_StringConverter.h>
-
-#include <FApp_AppControlManager.h>
-
-#include "FShell_LiveboxManagerService.h"
-#include "FShell_LiveboxPopupContext.h"
-#include "FShell_LiveboxContextBase.h"
-#include "FShell_LiveboxContext.h"
-
-
-namespace Tizen { namespace Shell  { namespace App
-{
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-
-
-
-const String LIVEBOX_ON_ADD(L"Livebox='event=add'");
-const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'");
-const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'");
-const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'");
-const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'");
-
-const String ARG_KEY_WIDTH = L"_Width";
-const String ARG_KEY_HEIGHT = L"_Height";
-const String ARG_KEY_ARGUMENT = L"_Argument";
-const String ARG_KEY_EVENT_TYPE = L"_EventType";
-const String ARG_KEY_TIME_STAMP = L"_TimeStamp";
-const String ARG_KEY_X = L"_X";
-const String ARG_KEY_Y = L"_Y";
-
-const int LIVE_DURATION_MSEC= 30000;//30sec
-
-_LiveboxContext::_LiveboxContext(const String& info, const String& providerId, const String& instanceId, int width, int height, int period, int priority)
-:_LiveboxContextBase(TYPE_LB, info, providerId, instanceId, width, height, priority)
-,__pLiveboxPopup(null), __UpdateMillis(period)
-{
-       SysLog(NID_APP, "period(%d)", period);
-
-       __lifeDurationTimer.Construct(*this);//, true);
-       __lifeDurationTimer.Start(LIVE_DURATION_MSEC);
-
-       SysLog(NID_APP, "period(%d)", __UpdateMillis);
-       if( __UpdateMillis > 0)
-       {
-               __UpdateTimer.Construct(*this);//, false);
-               __UpdateTimer.StartAsRepeatable(__UpdateMillis);
-       }
-}
-
-_LiveboxContext::~_LiveboxContext()
-{
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-       __lifeDurationTimer.Cancel();
-       __UpdateTimer.Cancel();
-
-       if (__pLiveboxPopup)
-       {
-               SysLog(NID_APP, "Destroying dangling LiveboxPopup instance..");
-               __pLiveboxPopup->OnPopupDestoyed();
-               delete __pLiveboxPopup;
-       }
-}
-
-_LiveboxPopupContext*
-_LiveboxContext::GetLiveboxPopup() const
-{
-       return __pLiveboxPopup;
-}
-
-void
-_LiveboxContext::OnAdded(void)
-{
-       SendAddRequest(__width, __height);
-}
-
-void
-_LiveboxContext::OnRemoved()
-{
-       SendRemoveRequest();
-}
-
-void
-_LiveboxContext::OnUpdate(const String& argument)
-{
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-
-       SendUpdateRequest(__width, __height, argument);
-}
-
-void
-_LiveboxContext::OnResize(int width, int height)
-{
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-
-       __width = width;
-       __height = height;
-       SendResizeRequest(__width, __height);
-}
-
-void
-_LiveboxContext::OnForeground()
-{
-       SysLog(NID_APP, "");
-       __isForeground = true;
-
-       __UpdateTimer.Cancel();
-       __UpdateTimer.StartAsRepeatable(__UpdateMillis);
-}
-
-void
-_LiveboxContext::OnBackground()
-{
-       SysLog(NID_APP, "");
-       __isForeground = false;
-       __UpdateTimer.Cancel();
-}
-
-void
-_LiveboxContext::OnPopupCreated(double x, double y, int width, int height)
-{
-       __pLiveboxPopup = new (std::nothrow) _LiveboxPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority);
-       __pLiveboxPopup->SetClientId(__ipcClientId);
-       __pLiveboxPopup->OnPopupCreated(x, y, width, height);
-
-       __lifeDurationTimer.Cancel();
-}
-
-void
-_LiveboxContext::OnPopupDestoyed(void)
-{
-       if (__pLiveboxPopup)
-       {
-               __pLiveboxPopup->OnPopupDestoyed();
-               delete __pLiveboxPopup;
-               __pLiveboxPopup = null;
-       }
-       RestartLifeDurationTimer();
-}
-
-result
-_LiveboxContext::SendAddRequest(int width, int height)
-{
-/*     std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
-       pArgs->Construct();
-       pArgs->Add(*new String(__instanceId));
-       pArgs->Add(*new String(__providerId));
-       pArgs->Add(*new String(__info));
-       pArgs->Add(*new String(Integer::ToString(width)));
-       pArgs->Add(*new String(Integer::ToString(height)));*/
-
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
-       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
-
-       return SendRequestToApp( __appId, LIVEBOX_ON_ADD, pArgs.get());
-}
-
-result
-_LiveboxContext::SendUpdateRequest(int width, int height, const String& argument)
-{
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
-       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
-       pArgs->Add(new String(ARG_KEY_ARGUMENT), new String(argument));
-
-       return SendRequestToApp( __appId, LIVEBOX_ON_UPDATE, pArgs.get());
-}
-
-result
-_LiveboxContext::SendResizeRequest(int width, int height)
-{
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
-       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
-
-       return SendRequestToApp( __appId, LIVEBOX_ON_RESIZE, pArgs.get());
-}
-
-result
-_LiveboxContext::SendRemoveRequest()
-{
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       return SendRequestToApp( __appId, LIVEBOX_ON_REMOVE, pArgs.get());
-}
-
-result
-_LiveboxContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
-{
-       SysLog(NID_APP, "");
-       if( HasValidClientId() == false )
-       {
-               std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-               pArgs->Add(new String(ARG_KEY_EVENT_TYPE), new String(Integer::ToString(event)));
-               pArgs->Add(new String(ARG_KEY_TIME_STAMP), new String(Double::ToString(timestamp)));
-               pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
-               pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
-
-               return SendRequestToApp( __appId, LIVEBOX_ON_TOUCH, pArgs.get());
-       }
-       else
-       {
-//             SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
-               LiveboxManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, event, timestamp, x, y);
-       }
-       return E_SUCCESS;
-}
-
-result
-_LiveboxContext::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
-{
-       result r = _LiveboxContextBase::SendRequestToApp(appId, operation, pArgs);
-       RestartLifeDurationTimer();
-
-       return r;
-}
-
-result
-_LiveboxContext::RequestUpdateRemote(int width, int height)
-{
-       /*if( GetLiveboxPopup() != null)
-       {
-               SysLog(NID_APP, "LiveboxPopup is appeared, so livebox doesn't need to update");
-               return E_SUCCESS;
-       }*/
-       std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
-       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
-       std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__userInfo));
-
-       int ret = provider_send_updated(packageName.get(), id.get(), width, height, __priority, content_info.get(), null);
-       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
-
-       SysLog(NID_APP, "Done");
-       return E_SUCCESS;
-}
-
-void
-_LiveboxContext::RestartLifeDurationTimer()
-{
-       __lifeDurationTimer.Cancel();
-       __lifeDurationTimer.Start(LIVE_DURATION_MSEC);
-       SysLog(NID_APP, "lifeDuration timer restarted (%d)msec", LIVE_DURATION_MSEC);
-}
-
-void
-_LiveboxContext::OnTimerExpired(Tizen::Base::Runtime::Timer& timer)
-{
-       SysLog(NID_APP, "");
-
-       if( &timer == &__lifeDurationTimer)
-       {
-               SysLog(NID_APP, "lifeDuration timer is expired, so terminating livebox app(%ls)..", __providerId.GetPointer() );
-
-               ReleaseSharedMem();
-               AppManager::GetInstance()->TerminateApplication(__appId);
-
-       }
-       else if( &timer == &__UpdateTimer)
-       {
-               SysLog(NID_APP, "update timer is expired for livebox app(%ls)..", __providerId.GetPointer() );
-               OnUpdate(L"");
-       }
-}
-
-
-} } } // Tizen::Shell::App {
-
diff --git a/src/FShell_LiveboxContextBase.cpp b/src/FShell_LiveboxContextBase.cpp
deleted file mode 100644 (file)
index dd19d59..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxContextBase.cpp
- * @brief      This is the implementation for the _LiveboxContextBase class.
- */
-
-#include <stdlib.h>
-#include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FBase_StringConverter.h>
-
-#include <FApp_AppMessageImpl.h>
-#include <FApp_AppArg.h>
-#include <FApp_AppControlManager.h>
-#include <FShell_TemplateUtil.h>
-#include <FShell_LiveboxManagerImpl.h>
-
-#include "FShell_LiveboxContextBase.h"
-
-// provider/src/fb.c
-struct fb_info {
-        char *id;
-        int w;
-        int h;
-        int bufsz;
-        void *buffer;
-
-        int handle;
-};
-
-// provider/inc/provider_buffer_internal.h
-struct livebox_buffer {
-       enum {
-               BUFFER_CREATED = 0x00beef00,
-               BUFFER_DESTROYED = 0x00dead00,
-       } state;
-
-       enum target_type type;
-
-       union {
-               int fd; /* File handle(descriptor) */
-               int id; /* SHM handle(id) */
-       } handle;
-
-       char *pkgname;
-       char *id;
-       int width;
-       int height;
-       int pixel_size;
-
-       struct fb_info *fb;
-
-       int (*handler)(struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void *data);
-       void *data;
-};
-
-static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
-               double timestamp, double x, double y, void* data);
-
-namespace Tizen { namespace Shell  { namespace App
-{
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-
-
-const String LIVEBOX_ON_ADD(L"Livebox='event=add'");
-const String LIVEBOX_ON_REMOVE(L"Livebox='event=remove'");
-const String LIVEBOX_ON_UPDATE(L"Livebox='event=update'");
-const String LIVEBOX_ON_RESIZE(L"Livebox='event=resize'");
-const String LIVEBOX_ON_TOUCH(L"Livebox='event=touch'");
-const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'");
-const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
-const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
-
-const String ARG_KEY_INSTANCE_ID = L"_InstanceId";
-const String ARG_KEY_PROVIDER_NAME = L"_ProviderName";
-const String ARG_KEY_USER_INFO = L"_UserInfo";
-
-
-_LiveboxContextBase::_LiveboxContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
-       :__type(type)
-       ,__userInfo(userInfo)
-       ,__providerId(providerId)
-       ,__instanceId(instanceId)
-       ,__width(width)
-       ,__height(height)
-       ,__priority(priority)
-       ,__isForeground(true)
-       ,__ipcClientId(-1)
-       ,__buffer_info(null)
-       ,__buffer(null)  // __pEcoreEvas(null), __pEvas(null), __current(0)
-{
-       _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, __appId, __providerName);
-
-       SysLog(NID_APP, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-}
-
-_LiveboxContextBase::~_LiveboxContextBase()
-{
-       SysLog(NID_APP, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
-}
-
-
-void
-_LiveboxContextBase::SetClientId(int clientId)
-{
-       __ipcClientId = clientId;
-}
-
-bool
-_LiveboxContextBase::HasValidClientId() const
-{
-       SysLog(NID_APP, "%d", __ipcClientId);
-       return (__ipcClientId > -1);
-}
-
-int
-_LiveboxContextBase::GetSharedMemId(int w, int h)
-{
-       SysLog(NID_APP, "Enter");
-
-       if( __buffer_info == null)
-       {
-               std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
-               std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
-
-               __buffer_info = provider_buffer_acquire(__type, packageName.get(), id.get(), w, h, sizeof(int), LiveboxHandleBufferEventCallback, this);
-               SysTryReturnResult(NID_APP, __buffer_info , -1, "[E_SYSTEM] failed to provider_buffer_acquire");
-               SysLog(NID_APP, "provider_buffer_acquire successed");
-
-               __buffer = provider_buffer_ref(__buffer_info);
-               SysTryReturnResult(NID_APP, __buffer , -1, "[E_SYSTEM] failed to provider_buffer_ref");
-               SysLog(NID_APP, "provider_buffer_ref successed");
-       }
-
-    int bufferId = __buffer_info->fb->handle;
-
-    SysLog(NID_APP, "(%d) Exit", bufferId);
-    return bufferId;
-}
-
-result
-_LiveboxContextBase::ReleaseSharedMem()
-{
-       SysLog(NID_APP, "Enter");
-
-    int ret;
-
-    if( __buffer)
-    {
-       ret = provider_buffer_unref(__buffer);
-       __buffer = null;
-       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_unref");
-       SysLog(NID_APP, "provider_buffer_unref successed");
-    }
-
-    if( __buffer_info)
-    {
-               ret = provider_buffer_release(__buffer_info);
-               __buffer_info = null;
-               SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_buffer_release");
-               SysLog(NID_APP, "provider_buffer_release successed");
-    }
-
-    SysLog(NID_APP, "Exit.");
-
-    return E_SUCCESS;
-}
-
-Tizen::Base::Collection::HashMap*
-_LiveboxContextBase::CreateRequestArgs(void)
-{
-       HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
-       pArgs->Construct();
-       pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
-       pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
-       pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
-
-       return pArgs;
-}
-
-result
-_LiveboxContextBase::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
-{
-       if( __isForeground == false)
-       {
-               SysLog(NID_APP, "livebox isn't foreground, so, message skip");
-               return E_SUCCESS;
-       }
-
-       return _LiveboxRequestHelper::SendRequestToApp(appId, operation, pArgs);
-}
-
-result
-_LiveboxRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
-{
-       SysLog(NID_APP, "appId(%ls), operation(%ls), arg count(%d)", appId.GetPointer(), operation.GetPointer(), pArgs->GetCount() );
-
-       _AppMessageImpl msg;
-       msg.AddData(OSP_K_APPCONTROL_INTERNAL_OPERATION, L"livebox");
-       Tizen::App::_AppArg::AddStrMap(msg.GetBundle(), pArgs);
-
-       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
-       std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
-
-       return Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
-}
-
-/*result
-_LiveboxRequestHelper::ExtractPackageIdAndExecutableName(AppId appId, AppId& outPackageId, String& outExecutableName)
-{
-       const int APP_ID_LEN = 10;
-
-       if (appId.GetLength() > APP_ID_LEN)
-       {
-               result r = appId.SubString(APP_ID_LEN + 1, appId.GetLength() - (APP_ID_LEN + 1), outExecutableName);
-               SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer());
-
-               r = appId.SubString(0, APP_ID_LEN, outPackageId);
-               SysTryReturnResult(NID_APP, !IsFailed(r), E_INVALID_ARG, "invalid AppId(%ls)", appId.GetPointer());
-
-               return E_SUCCESS;
-       }
-       return E_SYSTEM;
-}*/
-
-/*
-// helper for bundle
-result
-_LiveboxRequestHelper::AddStrArrayToBundle(bundle* b, const char* key, const IList* pList)
-{
-       bundle* pb = b;
-       SysTryReturnResult(NID_APP, pb != NULL, E_INVALID_ARG, "Empty bundle.");
-
-       if (pList == null || pList->GetCount() == 0)
-       {
-               SysLog(NID_APP, "No element added for bundle.");
-               return E_SUCCESS;
-       }
-
-       int i = 0;
-       const int count = pList->GetCount();
-
-       const char** pSa = new (std::nothrow) const char*[count];
-       SysTryReturnResult(NID_APP, pSa != null, E_OUT_OF_MEMORY, "Memory allocation failure with cound %d.", count);
-
-       for (i = 0; i < count; i++)
-       {
-               pSa[i] = null;
-
-               const String* pStr = static_cast<const String*>(pList->GetAt(i));
-               if (pStr)
-               {
-                       pSa[i] = _StringConverter::CopyToCharArrayN(*pStr);
-               }
-       }
-
-       result r = E_SUCCESS;
-
-       int ret = bundle_add_str_array(pb, key, pSa, count);
-       SysTryReturnResult(NID_APP, ret >= 0, E_SYSTEM, "Bundle add failre with %d.", strerror(errno));
-
-//CATCH:
-       for (i = 0; i < count; i++)
-       {
-               delete[] pSa[i];
-       }
-
-       delete[] pSa;
-
-       return r;
-}
-*/
-
-} } } // Tizen::Shell::App {
-
-
-////////////////////////////////////////////
-// callback
-////////////////////////////////////////////
-static int LiveboxHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
-               double timestamp, double x, double y, void* data)
-{
-    SysLog(NID_APP, "timestamp(%f), x(%f), y(%f)", timestamp, x, y);
-
-    Tizen::Shell::App::_LiveboxContextBase *pLiveboxBase = static_cast<Tizen::Shell::App::_LiveboxContextBase*>(data);
-    SysTryReturn(NID_APP, pLiveboxBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pLiveboxBase is null");
-
-//    const char *pkgname = provider_buffer_pkgname(info);
-//    const char *id = provider_buffer_id(info);
-//    enum target_type type = provider_buffer_type(info);
-
-    if( event ==  BUFFER_EVENT_ENTER)
-    {
-       SysLog(NID_APP, "BUFFER_EVENT_ENTER");
-    }
-    else if(   event ==  BUFFER_EVENT_LEAVE)
-    {
-       SysLog(NID_APP, "BUFFER_EVENT_LEAVE");
-    }
-    else if(   event ==  BUFFER_EVENT_DOWN)
-       {
-               SysLog(NID_APP, "BUFFER_EVENT_DOWN");
-       }
-    else if(   event ==  BUFFER_EVENT_MOVE)
-    {
-               SysLog(NID_APP, "BUFFER_EVENT_MOVE");
-       }
-    else if(   event ==  BUFFER_EVENT_UP)
-       {
-               SysLog(NID_APP, "BUFFER_EVENT_UP");
-       }
-
-    pLiveboxBase->SendTouchEvent(event, timestamp, x, y);
-
-    return 0;
-}
diff --git a/src/FShell_LiveboxManagerService.cpp b/src/FShell_LiveboxManagerService.cpp
deleted file mode 100644 (file)
index 8210080..0000000
+++ /dev/null
@@ -1,647 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxManagerService.cpp
- * @brief      This is the implementation for the LiveboxManagerService class.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <unique_ptr.h>
-#include <provider.h>
-#include <aul.h>
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FApp.h>
-#include <FApp_AppManagerImpl.h>
-#include <FIo_IpcServer.h>
-#include <FBase_StringConverter.h>
-
-#include "FShell_LiveboxContext.h"
-#include "FShell_LiveboxPopupContext.h"
-#include "FShell_LiveboxManagerStub.h"
-
-#include "FShell_LiveboxManagerService.h"
-
-namespace Tizen { namespace Shell  { namespace App {
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Runtime;
-using namespace Tizen::Io;
-using namespace Tizen::System;
-using namespace Tizen::Shell::App;
-
-
-namespace
-{
-static const RequestId LOCAL_EVENT_REQUEST_UPDATE = 0;
-}
-
-LiveboxManagerService::LiveboxManagerService()
-{
-}
-
-LiveboxManagerService::~LiveboxManagerService()
-{
-       __pingTimer.Cancel();
-       DeinitializeMasterDaemonEventReceiver();
-}
-
-LiveboxManagerService*
-LiveboxManagerService::GetInstance(void)
-{
-       static LiveboxManagerService* pSelf = null;
-       if( pSelf == null)
-       {
-               pSelf = new LiveboxManagerService();
-               SysTryReturn(NID_APP, pSelf != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
-               result r = pSelf->Construct();
-               SysAssertf(!IsFailed(r), "Failed to construct LiveboxManagerService");
-               SysLog(NID_APP, "LiveboxManagerService is created.");
-       }
-       return pSelf;
-}
-
-result
-LiveboxManagerService::Construct()
-{
-//     _AppManagerImpl::GetInstance()->AddEventListener(*this);
-
-       _LiveboxManagerStub::StartIpcServer();
-
-       result r = __handlerThread.Construct(THREAD_TYPE_EVENT_DRIVEN);
-       SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread creation failure.", GetErrorMessage(r));
-
-       r = __handlerThread.Start();
-       SysTryReturn(NID_APP, IsFailed(r) == false, false, r, "[%s] Event thread Start failure.", GetErrorMessage(r));
-
-       return InitializeMasterDaemonEventReceiver("osp-livebox-service");
-}
-
-int
-LiveboxManagerService::LiveboxConnected(struct event_arg *arg, void* data)
-{
-    int ret;
-    ret = provider_send_hello();
-    if (ret == 0)
-    {
-       SysLog(NID_APP, "success to be connected with master daemon");
-       LiveboxManagerService::GetInstance()->StartPingTimer();
-
-    }
-    else
-    {
-       SysLog(NID_APP, "failed to provider_send_hello()");
-    }
-    return ret;
-}
-
-int
-LiveboxManagerService::LiveboxDisconnected(struct event_arg *arg, void* data)
-{
-       SysLog(NID_APP, "success to be disconnected with master daemon");
-//     aul_terminate_pid(getpid());
-    return 0;
-}
-
-void
-LiveboxManagerService::StartPingTimer()
-{
-       __pingTimer.Construct(*this);//, true);
-       __pingTimer.StartAsRepeatable(120000);
-}
-
-void
-LiveboxManagerService::OnTimerExpired(Timer& timer)
-{
-       SysLog(NID_APP, "provider_send_ping");
-       provider_send_ping();
-}
-
-_LiveboxContext*
-LiveboxManagerService::Find(const String& appId, const String& instanceId) const
-{
-       for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
-       {
-               _LiveboxContext* pLiveboxContext = null;
-               __liveboxContextList.GetAt(i, pLiveboxContext);
-//             SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer());
-
-               if ( pLiveboxContext->__instanceId == instanceId )
-               {
-//                     SysAssert(pLiveboxContext->__appId == appId)
-                       return pLiveboxContext;
-               }
-       }
-       return null;
-}
-
-result
-LiveboxManagerService::SetClientIds(const Tizen::App::AppId& appId, int clientId)
-{
-       for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
-       {
-               _LiveboxContext* pLiveboxContext = null;
-               __liveboxContextList.GetAt(i, pLiveboxContext);
-               SysLog(NID_APP, "%ls", pLiveboxContext->__instanceId.GetPointer());
-               SysLog(NID_APP, "%ls, %ls", pLiveboxContext->__providerId.GetPointer(), appId.GetPointer());
-
-               if ( pLiveboxContext->__appId == appId )
-               {
-                       pLiveboxContext->SetClientId(clientId);
-                       SysLog(NID_APP, "client is registered.(%d)", clientId);
-                       if( clientId == -1)
-                       {
-                               pLiveboxContext->ReleaseSharedMem();
-                               if(pLiveboxContext->GetLiveboxPopup())
-                               {
-                                       pLiveboxContext->OnPopupDestoyed();
-                               }
-                       }
-               }
-       }
-       return E_SUCCESS;
-}
-
-void
-LiveboxManagerService::OnIpcClientConnected(const _IpcServer& server, int clientId)
-{
-       //SysLog(NID_APP, "(clientId:%d)\n", clientId);
-       String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
-       SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
-//     this->SetClientIds(fullAppId, clientId);//Todo
-
-}
-
-void
-LiveboxManagerService::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
-{
-       String fullAppId = server.GetClientAppId() + "." + server.GetClientAppExecutableName();
-       SysLog(NID_APP, "(%ls)\n", fullAppId.GetPointer());
-       this->SetClientIds(fullAppId, -1);
-}
-
-result
-LiveboxManagerService::AddLivebox(_LiveboxContext* pLiveboxContext)
-{
-       SysLog(NID_APP, "%ls, %ls, count(%d)", pLiveboxContext->__providerId.GetPointer(), pLiveboxContext->__instanceId.GetPointer(), __liveboxContextList.GetCount());
-
-       return __liveboxContextList.Add(pLiveboxContext);
-}
-
-result
-LiveboxManagerService::RemoveLivebox(const char* pPackageName, const char* pId, bool free)
-{
-       SysLog(NID_APP, "%s, %s, count(%d)", pPackageName, pId, __liveboxContextList.GetCount());
-
-       SysTryReturn(NID_APP, ( pPackageName != null && pId != null), null, E_INVALID_ARG, "[E_INVALID_ARG]");
-       SysLog(NID_APP, "%s, %s", pPackageName, pId);
-
-       _LiveboxContext* pLiveboxContext = Find(pPackageName, pId);
-       SysTryReturn(NID_APP, pLiveboxContext, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND]");
-
-       result r = __liveboxContextList.Remove(pLiveboxContext);
-
-       if( __liveboxContextList.GetCount() == 0 )
-       {
-               SysLog(NID_APP, "No running native livebox app remains, terminating osp livebox service...");
-               Tizen::App::App::GetInstance()->Terminate();
-       }
-
-       return r;
-}
-
-
-///////////////////////////////////////////////////////
-// MasterDaemonEventReceiver implementation
-///////////////////////////////////////////////////////
-int
-LiveboxManagerService::OnLiveboxCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
-{
-       SysTryReturn(NID_APP, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
-       SysTryReturn(NID_APP, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
-       SysTryReturn(NID_APP, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
-       SysTryReturn(NID_APP, arg->type == event_arg::EVENT_NEW, -EPERM, E_SUCCESS, "invalid argument from master");
-
-       SysLog(NID_APP, "packageName(%s) id(%s) content(%s) cluster(%s) category(%s)", arg->pkgname, arg->id, arg->info.lb_create.content, arg->info.lb_create.cluster, arg->info.lb_create.category);
-       SysTryReturn (NID_APP, LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id) == null, -EBUSY, E_SUCCESS,"already exist");
-
-       double default_priority = 1.0f;
-       _LiveboxContext* pLiveboxContext = new (std::nothrow)_LiveboxContext( arg->info.lb_create.content, arg->pkgname, arg->id,
-                       arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
-       SysTryReturn(NID_APP, pLiveboxContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
-       LiveboxManagerService* pLiveboxService = LiveboxManagerService::GetInstance();
-       pLiveboxService->AddLivebox(pLiveboxContext);
-       pLiveboxContext->OnAdded();
-
-       *priority = pLiveboxContext->__priority;
-       *height= pLiveboxContext->__height;
-       *width = pLiveboxContext->__width;
-
-       SysLog(NID_APP, "Exit. %d livebox(es)", pLiveboxService->__liveboxContextList.GetCount());
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxUpdate(struct event_arg *arg, void* data)
-{
-       if( arg->id == null || strlen(arg->id) < 1)
-       {
-               SysLog(NID_APP, "updating alls");
-               LiveboxManagerService::GetInstance()->UpdateAllLiveboxesByAppId(arg->pkgname);
-       }
-       else
-       {
-               _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-               SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-               pLiveboxContext->OnUpdate(L"");
-       }
-
-       return 0;
-}
-
-int
-LiveboxManagerService::UpdateAllLiveboxesByAppId(const String& providerId)
-{
-       for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
-       {
-               _LiveboxContext* pLiveboxContext = null;
-               __liveboxContextList.GetAt(i, pLiveboxContext);
-
-               if ( pLiveboxContext->__providerId == providerId )
-               {
-                       pLiveboxContext->OnUpdate(L"");
-               }
-       }
-       return E_SUCCESS;
-}
-
-int
-LiveboxManagerService::OnLiveboxDestroy(struct event_arg *arg, void* data)
-{
-       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_DELETE, -EPERM, E_SUCCESS, "invalid argument from master");
-       SysLog(NID_APP, "Enter");
-
-       LiveboxManagerService* pLiveboxManagerService = LiveboxManagerService::GetInstance();
-
-       _LiveboxContext* pLiveboxContext = pLiveboxManagerService->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-    pLiveboxContext->OnRemoved();
-    pLiveboxManagerService->RemoveLivebox( arg->pkgname, arg->id, true);
-    delete pLiveboxContext;
-
-    SysLog(NID_APP, "Exit");
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxPopupCreate(struct event_arg *arg, void* data)
-{
-       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_CREATE, -EPERM, E_SUCCESS, "invalid argument from master");
-       SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
-
-       _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-       /*if( pLiveboxContext->GetLiveboxPopup() )
-       {
-               pLiveboxContext->OnPopupDestoyed();
-       }*/
-       pLiveboxContext->OnPopupCreated(arg->info.pd_create.x, arg->info.pd_create.y, arg->info.pd_create.w, arg->info.pd_create.h);
-
-    return 0;
-}
-
- int
- LiveboxManagerService::OnLiveboxPopupDestroy(struct event_arg *arg, void* data)
-{
-       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_PD_DESTROY, -EPERM, E_SUCCESS, "invalid argument from master");
-       SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
-       _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-       pLiveboxContext->OnPopupDestoyed();
-
-    return 0;
-}
-
- int
- LiveboxManagerService::OnLivePause(struct event_arg *arg, void* data)
-{
-        SysTryReturn(NID_APP, arg, 0, E_SUCCESS, "arg is null!");
-
-        _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-        SysTryReturnResult(NID_APP, pLiveboxContext , 0, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-        SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
-        pLiveboxContext->OnBackground();
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxResume(struct event_arg *arg, void* data)
-{
-       SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
-
-       _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-       SysLog(NID_APP, "packageName(%s), id(%s)", arg->pkgname, arg->id);
-       pLiveboxContext->OnForeground();
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxClick(struct event_arg *arg, void* data)
-{
-       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_CLICKED, -EPERM, E_SUCCESS, "invalid argument from master");
-       SysTryReturn(NID_APP, arg != null, -EPERM, E_SUCCESS, "arg is null!");
-       SysLog(NID_APP, "packageName(%s), id(%s), clicked.event(%s), clicked.x(%d), clicked.y(%d)", arg->pkgname, arg->id, arg->info.clicked.event, arg->info.clicked.x, arg->info.clicked.y);
-
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxResize(struct event_arg *arg, void* data)
-{
-       SysTryReturn(NID_APP, arg || arg->id || arg->pkgname, 0, E_SUCCESS, "arg is null!");
-       SysTryReturn (NID_APP, arg->type == event_arg::EVENT_RESIZE, -EPERM, E_SUCCESS, "invalid argument from master");
-
-       SysLog(NID_APP, "packageName(%s), id(%s), resize.w(%d), resize.h(%d)", arg->pkgname, arg->id, arg->info.resize.w, arg->info.resize.h);
-
-       _LiveboxContext* pLiveboxContext = LiveboxManagerService::GetInstance()->Find(arg->pkgname, arg->id);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for appId(%s), instanceId(%s)", arg->pkgname, arg->id);
-
-       pLiveboxContext->OnResize(arg->info.resize.w, arg->info.resize.h);
-
-    return 0;
-}
-
-int
-LiveboxManagerService::OnLiveboxPeriodChaned(struct event_arg *arg, void* data)
-{
-       SysTryReturn(NID_APP, arg != null, 0, E_SUCCESS, "arg is null!");
-       SysLog(NID_APP, "packageName(%s), id(%s), width(%d), height(%d), priority(%d)", arg->pkgname, arg->id);
-    return 0;
-}
-
-result
-LiveboxManagerService::InitializeMasterDaemonEventReceiver(const char *pServiceExecutableName)
-{
-       SysTryReturnResult(NID_APP, pServiceExecutableName != null, E_INVALID_ARG, "");
-       SysLog(NID_APP, "Enter.");
-
-       __liveboxContextList.Construct();
-
-       /*!
-        * \note
-        * Only for the buffer type
-        */
-    struct event_handler cbs;
-    memset(&cbs, 0, sizeof(event_handler));
-
-    cbs.connected = LiveboxConnected,
-    cbs.disconnected = LiveboxDisconnected,
-    cbs.pause = OnLivePause,
-    cbs.resume = OnLiveboxResume,
-//    cbs.lb_pause = OnLivePause,
-//    cbs.lb_resume = OnLiveboxResume,
-    cbs.lb_create = OnLiveboxCreate,
-    cbs.lb_destroy = OnLiveboxDestroy,
-    cbs.update_content = OnLiveboxUpdate,
-    cbs.pd_create = OnLiveboxPopupCreate,
-    cbs.pd_destroy = OnLiveboxPopupDestroy,
-    cbs.clicked = OnLiveboxClick,
-    cbs.resize = OnLiveboxResize,
-    cbs.set_period = OnLiveboxPeriodChaned;
-    //cbs.lb_recreate = OnLiveboxRecreate,/* Recover from the fault of slave */
-    //cbs.content_event = OnLiveboxContentEvent,
-    //cbs.change_group = OnLiveboxGroupChanged;
-
-    int ret = provider_init(null, pServiceExecutableName, &cbs, this);
-    SysTryReturnResult(NID_APP, ret == 0, E_SYSTEM, "provider_init failed.");
-
-    SysLog(NID_APP, "Exit.");
-    return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::DeinitializeMasterDaemonEventReceiver()
-{
-       SysLog(NID_APP, "Enter.");
-    provider_fini();
-    SysLog(NID_APP, "Exit.");
-    return E_SUCCESS;
-}
-
-///////////////////////////////////////////////////////
-// stub implmentation
-///////////////////////////////////////////////////////
-
-result
-LiveboxManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
-{
-       SysLog(NID_APP, "%ls, %ls", appId.GetPointer(), providerName.GetPointer() );
-
-       bool found = false;
-       for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
-       {
-               _LiveboxContext* pLiveboxContext = null;
-               __liveboxContextList.GetAt(i, pLiveboxContext);
-
-               if ( pLiveboxContext->__appId == appId && pLiveboxContext->__providerName == providerName)
-               {
-                       SysLog(NID_APP, "OK");
-
-                       ArrayList* pArray = new (std::nothrow) ArrayList();
-                       SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
-                       pArray->Construct();
-                       pArray->Add(pLiveboxContext);
-                       pArray->Add(new String(argument));
-
-                       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
-
-                       found = true;
-               }
-       }
-       SysLog(NID_APP, "Exit.");
-       return (found) ? E_SUCCESS : E_OBJ_NOT_FOUND;
-
-}
-
-result
-LiveboxManagerService::RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument)
-{
-       SysLog(NID_APP, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
-
-       for( int i = 0; i < __liveboxContextList.GetCount(); i++ )
-       {
-               _LiveboxContext* pLiveboxContext = null;
-               __liveboxContextList.GetAt(i, pLiveboxContext);
-
-               if ( pLiveboxContext->__instanceId == instanceId)
-               {
-                       SysLog(NID_APP, "OK");
-
-                       ArrayList* pArray = new (std::nothrow) ArrayList();
-                       SysTryReturnResult(NID_APP, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
-
-                       pArray->Construct();
-                       pArray->Add(pLiveboxContext);
-                       pArray->Add(new String(argument));
-
-                       result r = __handlerThread.SendUserEvent(LOCAL_EVENT_REQUEST_UPDATE, pArray);
-                       SysTryLog(NID_APP, !IsFailed(r), "[%s] Propagated.", GetErrorMessage(r));
-
-                       return E_SUCCESS;
-               }
-       }
-       SysLog(NID_APP, "Exit.");
-       return E_OBJ_NOT_FOUND;
-}
-
-result
-LiveboxManagerService::RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
-{
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       if(pLiveboxContext->HasValidClientId() == false)
-       {
-               String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
-               this->SetClientIds(fullAppId, __pIpcServer->GetClientId());
-       }
-
-       shmId = pLiveboxContext->GetSharedMemId(width, height);
-       SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-    return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height, int& shmId)
-{
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       _LiveboxPopupContext* pPd = pLiveboxContext->GetLiveboxPopup();
-       SysTryReturnResult(NID_APP, pPd , E_SYSTEM, "[E_SYSTEM] pPd is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       if(pPd->HasValidClientId() == false)
-       {
-               String fullAppId = __pIpcServer->GetClientAppId() + "." + __pIpcServer->GetClientAppExecutableName();
-               pPd->SetClientId(__pIpcServer->GetClientId());
-       }
-
-       shmId = pPd->GetSharedMemId(width, height);
-       SysTryReturnResult(NID_APP, pLiveboxContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-    return E_SUCCESS;
-}
-
-result
-LiveboxManagerService::RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height)
-{
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       return pLiveboxContext->RequestUpdateRemote(width, height);
-}
-
-result
-LiveboxManagerService::RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-       SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       return pLiveboxContext->GetLiveboxPopup()->RequestUpdateRemote();
-}
-
-result
-LiveboxManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
-       std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
-       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-       return pLiveboxContext->ReleaseSharedMem();
-}
-
-result
-LiveboxManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
-{
-       std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
-       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-
-       _LiveboxContext* pLiveboxContext = this->Find(appId, instanceId);
-       SysTryReturnResult(NID_APP, pLiveboxContext , E_SYSTEM, "[E_SYSTEM] pLiveboxContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-       SysTryReturnResult(NID_APP, pLiveboxContext->GetLiveboxPopup(), E_SYSTEM, "[E_SYSTEM] GetLiveboxPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-
-//     return pLiveboxContext->GetLiveboxPopup()->ReleaseSharedMem();
-       return E_SUCCESS;
-}
-
-LiveboxManagerService::_TaskHandlerThread::~_TaskHandlerThread(void)
-{
-
-}
-
-void
-LiveboxManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqId, IList* pArgs)
-{
-       SysTryReturnVoidResult(NID_APP, pArgs != null, E_INVALID_STATE, "pArgs is null!.");
-
-       SysLog(NID_APP, "Enter.");
-
-       switch (reqId)
-       {
-       case LOCAL_EVENT_REQUEST_UPDATE:
-       {
-               _LiveboxContext* pLiveboxContext = dynamic_cast<_LiveboxContext*>( pArgs->GetAt(0) );
-               SysTryReturnVoidResult(NID_APP, pLiveboxContext != null, E_INVALID_STATE, "_Livebox is null!.");
-
-               String* pArgument = dynamic_cast<String*>( pArgs->GetAt(1) );
-               SysTryReturnVoidResult(NID_APP, pArgument != null, E_INVALID_STATE, "pArgument is null!.");
-
-               pLiveboxContext->OnUpdate(*pArgument);
-
-               delete pArgument;
-               pArgs->RemoveAll();
-               delete pArgs;
-       }
-               break;
-
-       default:
-               SysAssertf(false, "never get here!");
-               break;
-       }
-       SysLog(NID_APP, "Exit.");
-}
-
-} } } //namespace Tizen { namespace Shell  { namespace App {
diff --git a/src/FShell_LiveboxManagerStub.cpp b/src/FShell_LiveboxManagerStub.cpp
deleted file mode 100644 (file)
index 1b14470..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxManagerStub.cpp
- * @brief      This is the implementation for the _LiveboxManagerStub class.
- */
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FIo_IpcServer.h>
-#include <FShell_LiveboxManagerIpcMessage.h>
-
-#include "FShell_LiveboxManagerStub.h"
-
-
-namespace Tizen { namespace Shell  { namespace App {
-
-namespace
-{
-const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.liveboxmanager";
-const int INVALID_CLIENT_ID = -1;
-};
-
-using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Text;
-using namespace Tizen::Security;
-
-
-_LiveboxManagerStub::_LiveboxManagerStub(void)
-:__pIpcServer(null)
-{
-       SysLog(NID_APP, "Enter\n");
-
-       SysLog(NID_APP, "Exit\n");
-}
-
-_LiveboxManagerStub::~_LiveboxManagerStub(void)
-{
-       SysLog(NID_APP, "Enter\n");
-
-       if ( __pIpcServer != null)
-       {
-               __pIpcServer->Stop();
-               delete __pIpcServer;
-       }
-
-       SysLog(NID_APP, "Exit\n");
-}
-
-result
-_LiveboxManagerStub::StartIpcServer(void)
-{
-       SysLog(NID_APP, "Enter.");
-       __pIpcServer = new (std::nothrow) _IpcServer();
-       SysTryReturn(NID_APP, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
-
-       result r = __pIpcServer->Construct( IPC_SERVER_NAME, *this, false);
-       SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
-       SysLog(NID_APP, "Exit.");
-
-       return E_SUCCESS;
-
-CATCH:
-       delete __pIpcServer;
-       __pIpcServer = null;
-       return r;
-}
-
-
-/////////////////////////////////////////////
-// handlers
-/////////////////////////////////////////////
-
-
-
-bool
-_LiveboxManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
-{
-       SysLog(NID_APP, "");
-       *pRes = RequestUpdate(appId, providerName, argument);
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
-{
-       SysLog(NID_APP, "");
-       *pRes = RequestUpdateInstance(instanceId, argument);
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
-{
-       SysLog(NID_APP, "(instanceId:%d)xxx", instanceId.GetPointer());
-
-       RequestSharedMemoryId(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
-{
-       SysLog(NID_APP, "(instanceId:%d)", instanceId.GetPointer());
-
-       RequestSharedMemoryIdForPD(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
-{
-       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
-
-       *pRes = RequestSyncSharedMemory(__pIpcServer->GetClientAppId(), instanceId, w, h);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
-{
-       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
-
-       *pRes = RequestSyncSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
-{
-       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
-
-       *pRes = RequestReleaseSharedMemory(__pIpcServer->GetClientAppId(), instanceId);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
-{
-       SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
-
-       *pRes = RequestReleaseSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
-
-       return true;
-}
-
-bool
-_LiveboxManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
-{
-       SysLog(NID_APP,"");
-       result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
-       return true;
-}
-
-bool
-_LiveboxManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
-{
-       SysLog(NID_APP,"");
-       result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
-
-       return true;
-}
-
-
-void
-_LiveboxManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
-{
-       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
-
-       IPC_BEGIN_MESSAGE_MAP(_LiveboxManagerStub, message)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestUpdate, &server, OnRequestUpdate)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
-               IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
-       IPC_END_MESSAGE_MAP()
-}
-
-void
-_LiveboxManagerStub::OnIpcServerStarted(const _IpcServer& server)
-{
-       SysLog(NID_APP, "\n");
-}
-
-void
-_LiveboxManagerStub::OnIpcServerStopped(const _IpcServer& server)
-{
-       SysLog(NID_APP, "\n");
-}
-
-void
-_LiveboxManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
-{
-       SysLog(NID_APP, "(clientId:%d)\n", clientId);
-
-}
-
-void
-_LiveboxManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
-{
-       SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
-}
-
-
-}}}//namespace Tizen { namespace Shell  { namespace App {
diff --git a/src/FShell_LiveboxPopupContext.cpp b/src/FShell_LiveboxPopupContext.cpp
deleted file mode 100644 (file)
index c96acab..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       FShell_LiveboxPopupContext.cpp
- * @brief      This is the implementation for the _LiveboxPopupContext class.
- */
-
-#include <stdlib.h>
-#include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FBase_StringConverter.h>
-
-#include <FApp_AppControlManager.h>
-
-#include "FShell_LiveboxManagerService.h"
-#include "FShell_LiveboxPopupContext.h"
-
-namespace Tizen { namespace Shell  { namespace App
-{
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-
-
-const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'");
-const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
-const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
-
-const String ARG_KEY_X = L"_X";
-const String ARG_KEY_Y = L"_Y";
-const String ARG_KEY_WIDTH = L"_Width";
-const String ARG_KEY_HEIGHT = L"_Height";
-
-
-_LiveboxPopupContext::_LiveboxPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
-:_LiveboxContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
-{
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
-}
-
-_LiveboxPopupContext::~_LiveboxPopupContext()
-{
-       SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
-       ReleaseSharedMem();
-}
-
-
-void
-_LiveboxPopupContext::OnPopupCreated(double x, double y, int width, int height)
-{
-       SysLog(NID_APP, "width(%d), height(%d)", width, height);
-       SendPopupCreateRequest(x, y, width, height);
-}
-
-void
-_LiveboxPopupContext::OnPopupDestoyed()
-{
-       SysLog(NID_APP, "");
-       SendPopupDestroyRequest();
-}
-
-result
-_LiveboxPopupContext::SendPopupCreateRequest(double x, double y, int width, int height)
-{
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
-       pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
-       pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
-       pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
-
-       return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_CREATE, pArgs.get());
-}
-
-result
-_LiveboxPopupContext::SendPopupDestroyRequest()
-{
-       std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
-
-       return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get());
-}
-
-result
-_LiveboxPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
-{
-       SysLog(NID_APP, "");
-       /*if( HasValidClientId() == false )
-       {
-               std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
-               pArgs->Construct();
-               pArgs->Add(*new String(__instanceId));
-               pArgs->Add(*new String(__info));
-               pArgs->Add(*new String(Integer::ToString(event)));
-               pArgs->Add(*new String(Double::ToString(timestamp)));
-               pArgs->Add(*new String(Double::ToString(x)));
-               pArgs->Add(*new String(Double::ToString(y)));
-
-               return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_TOUCH, pArgs.get());
-       }
-       else*/
-       {
-//             SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
-               LiveboxManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
-       }
-       return E_SUCCESS;
-}
-
-result
-_LiveboxPopupContext::RequestUpdateRemote()
-{
-       std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
-       std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
-
-       int ret = provider_send_desc_updated(packageName.get(), id.get(), null);
-       SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
-
-       SysLog(NID_APP, "Done");
-       return E_SUCCESS;
-}
-
-} } } // Tizen::Shell::App {
-
diff --git a/src/OspAppWidgetService.cpp b/src/OspAppWidgetService.cpp
new file mode 100644 (file)
index 0000000..5dcf6e9
--- /dev/null
@@ -0,0 +1,84 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       OspAppWidgetService.cpp
+ * @brief      This is the implementation for the OspAppWidgetService class.
+ */
+
+#include "FShell_AppWidgetManagerService.h"
+#include "OspAppWidgetService.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+using namespace Tizen::Shell::App;
+
+
+OspAppWidgetService::OspAppWidgetService()
+{
+}
+
+OspAppWidgetService::~OspAppWidgetService()
+{
+}
+
+ServiceApp*
+OspAppWidgetService::CreateInstance(void)
+{
+       // Create the instance through the constructor.
+       return new (std::nothrow) OspAppWidgetService();
+}
+
+bool
+OspAppWidgetService::OnAppInitializing(AppRegistry& appRegistry)
+{
+       AppLog("Enter.");
+
+       AppWidgetManagerService* pSvc = AppWidgetManagerService::GetInstance();
+       AppAssertf( pSvc != null, "AppWidgetManagerService::GetInstance() failed.");
+
+       return true;
+}
+
+bool
+OspAppWidgetService::OnAppInitialized(void)
+{
+       return true;
+}
+
+bool
+OspAppWidgetService::OnAppWillTerminate(void)
+{
+       return true;
+}
+
+bool
+OspAppWidgetService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
+{
+       return true;
+}
+
+void
+OspAppWidgetService::OnLowMemory(void)
+{
+}
+
+void
+OspAppWidgetService::OnBatteryLevelChanged(BatteryLevel batteryLevel)
+{
+}
diff --git a/src/OspAppWidgetServiceEntry.cpp b/src/OspAppWidgetServiceEntry.cpp
new file mode 100644 (file)
index 0000000..08111b0
--- /dev/null
@@ -0,0 +1,79 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 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.
+//
+
+/**
+ * @file       OspAppWidgetService.cpp
+ * @brief      This file contains the Tizen application entry point.
+ */
+
+#include "OspAppWidgetService.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+_EXPORT_ int OspMain(int argc, char *pArgv[]);
+#ifdef _PROFILE
+extern void start_profile (void);
+extern void end_profile (void);
+#else
+#define start_profile()
+#define end_profile()
+#endif
+
+
+/**
+ * The entry function of Tizen C++ application called by the operating system.
+ */
+int
+OspMain(int argc, char *pArgv[])
+{
+       result r = E_SUCCESS;
+
+       AppLog("Application started.");
+       ArrayList* pArgs = new (std::nothrow) ArrayList();
+       pArgs->Construct();
+       for (int i = 0; i < argc; i++)
+               pArgs->Add(*(new String(pArgv[i])));
+
+       start_profile();
+       r = Tizen::App::ServiceApp::Execute(OspAppWidgetService::CreateInstance, pArgs);
+       if (IsFailed(r))
+       {
+               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
+       }
+       end_profile();
+
+       AppLog("arg count %d", pArgs->GetCount());
+
+       for(int i =0 ; i < pArgs->GetCount(); i++)
+       {
+               AppLog("%ls", dynamic_cast<Tizen::Base::String*>(pArgs->GetAt(i)));
+       }
+       pArgs->RemoveAll(true);
+       delete pArgs;
+       AppLog("Application finished.");
+
+       return static_cast<int>(r);
+}
+#ifdef __cplusplus
+}
+#endif // __cplusplus
diff --git a/src/OspLiveboxService.cpp b/src/OspLiveboxService.cpp
deleted file mode 100644 (file)
index d3e71f7..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       OspLiveboxService.cpp
- * @brief      This is the implementation for the OspLiveboxService class.
- */
-
-#include "FShell_LiveboxManagerService.h"
-#include "OspLiveboxService.h"
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::System;
-using namespace Tizen::Shell::App;
-
-
-OspLiveboxService::OspLiveboxService()
-{
-}
-
-OspLiveboxService::~OspLiveboxService()
-{
-}
-
-ServiceApp*
-OspLiveboxService::CreateInstance(void)
-{
-       // Create the instance through the constructor.
-       return new (std::nothrow) OspLiveboxService();
-}
-
-bool
-OspLiveboxService::OnAppInitializing(AppRegistry& appRegistry)
-{
-       AppLog("Enter.");
-
-       LiveboxManagerService* pSvc = LiveboxManagerService::GetInstance();
-       AppAssertf( pSvc != null, "LiveboxManagerService::GetInstance() failed.");
-
-       return true;
-}
-
-bool
-OspLiveboxService::OnAppInitialized(void)
-{
-       return true;
-}
-
-bool
-OspLiveboxService::OnAppWillTerminate(void)
-{
-       return true;
-}
-
-bool
-OspLiveboxService::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
-{
-       return true;
-}
-
-void
-OspLiveboxService::OnLowMemory(void)
-{
-}
-
-void
-OspLiveboxService::OnBatteryLevelChanged(BatteryLevel batteryLevel)
-{
-}
diff --git a/src/OspLiveboxServiceEntry.cpp b/src/OspLiveboxServiceEntry.cpp
deleted file mode 100644 (file)
index 18e2cca..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012 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.
-//
-
-/**
- * @file       OspLiveboxService.cpp
- * @brief      This file contains the Tizen application entry point.
- */
-
-#include "OspLiveboxService.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
-
-_EXPORT_ int OspMain(int argc, char *pArgv[]);
-#ifdef _PROFILE
-extern void start_profile (void);
-extern void end_profile (void);
-#else
-#define start_profile()
-#define end_profile()
-#endif
-
-
-/**
- * The entry function of Tizen C++ application called by the operating system.
- */
-int
-OspMain(int argc, char *pArgv[])
-{
-       result r = E_SUCCESS;
-
-       AppLog("Application started.");
-       ArrayList* pArgs = new (std::nothrow) ArrayList();
-       pArgs->Construct();
-       for (int i = 0; i < argc; i++)
-               pArgs->Add(*(new String(pArgv[i])));
-
-       start_profile();
-       r = Tizen::App::ServiceApp::Execute(OspLiveboxService::CreateInstance, pArgs);
-       if (IsFailed(r))
-       {
-               AppLogException("Application execution failed-[%s].", GetErrorMessage(r));
-       }
-       end_profile();
-
-       AppLog("arg count %d", pArgs->GetCount());
-
-       for(int i =0 ; i < pArgs->GetCount(); i++)
-       {
-               AppLog("%ls", dynamic_cast<Tizen::Base::String*>(pArgs->GetAt(i)));
-       }
-       pArgs->RemoveAll(true);
-       delete pArgs;
-       AppLog("Application finished.");
-
-       return static_cast<int>(r);
-}
-#ifdef __cplusplus
-}
-#endif // __cplusplus