Update for AppLifecycleEvent
authorJaesung Ku <jaesung.ku@samsung.com>
Wed, 10 Jul 2013 12:25:35 +0000 (21:25 +0900)
committerJaesung Ku <jaesung.ku@samsung.com>
Wed, 10 Jul 2013 12:25:35 +0000 (21:25 +0900)
Change-Id: Iae82d760cc08d463d33755a89ae67410106f54df
Signed-off-by: Jaesung Ku <jaesung.ku@samsung.com>
14 files changed:
src/app/CMakeLists.txt [changed mode: 0644->0755]
src/app/FApp_AppLifecycleEvent.cpp [new file with mode: 0755]
src/app/FApp_AppManagerImpl.cpp
src/app/FApp_AppManagerProxy.cpp
src/app/inc/FApp_AppLifecycleEvent.cpp [new file with mode: 0755]
src/app/inc/FApp_AppLifecycleEvent.h [new file with mode: 0755]
src/app/inc/FApp_AppLifecycleEventArg.h [new file with mode: 0755]
src/app/inc/FApp_AppManagerImpl.h
src/app/inc/FApp_AppManagerIpcMessage.h
src/app/inc/FApp_AppManagerProxy.h
src/app/inc/FApp_IAppLifecycleEventListener.h [new file with mode: 0755]
src/app/inc/FApp_IAppManager.h
src/app/inc/FApp_IAppManagerServiceEventListener.h [changed mode: 0644->0755]
src/app/inc/FApp_Types.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 0a04640..954d3fd
@@ -66,6 +66,7 @@ SET (${this_target}_SOURCE_FILES
        FApp_AppSettingImpl.cpp
        FApp_LongevityManager.cpp
        FApp_AppControlResponseEvent.cpp
+       FApp_AppLifecycleEvent.cpp
        )
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SINGLETON_CLEANUP -fvisibility=hidden")
diff --git a/src/app/FApp_AppLifecycleEvent.cpp b/src/app/FApp_AppLifecycleEvent.cpp
new file mode 100755 (executable)
index 0000000..9fccdc5
--- /dev/null
@@ -0,0 +1,85 @@
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file        FApp_AppLifecycleEvent.cpp\r
+ * @brief      This is the implementation for the _AppLifecycleEvent.cpp class.\r
+ */\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FApp_Types.h"\r
+#include "FApp_AppLifecycleEvent.h"\r
+#include "FApp_AppLifecycleEventArg.h"\r
+#include "FApp_IAppLifecycleEventListener.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Runtime;\r
+\r
+\r
+namespace Tizen { namespace App\r
+{\r
+\r
+_AppLifecycleEventArg::_AppLifecycleEventArg(void)\r
+{\r
+}\r
+\r
+_AppLifecycleEventArg::_AppLifecycleEventArg(const AppId& appId, _AppLifecycleEventType appLifecycleEventType)\r
+       : __appId(appId)\r
+       , __appLifecycleEventType(appLifecycleEventType)\r
+{\r
+}\r
+\r
+_AppLifecycleEventArg::~_AppLifecycleEventArg(void)\r
+{\r
+}\r
+\r
+const AppId\r
+_AppLifecycleEventArg::GetAppId(void) const\r
+{\r
+       return __appId;\r
+}\r
+\r
+_AppLifecycleEventType\r
+\r
+_AppLifecycleEventArg::GetAppLifecycleEventType(void) const\r
+{\r
+       return __appLifecycleEventType;\r
+}\r
+\r
+///////////////////////////////////////////////////////\r
+//_AppLifecycleEvent\r
+///////////////////////////////////////////////////////\r
+result\r
+_AppLifecycleEvent::Construct(void)\r
+{\r
+       return _Event::Initialize();\r
+}\r
+\r
+void\r
+_AppLifecycleEvent::FireImpl(IEventListener& listener, const IEventArg& arg)\r
+{\r
+       _IAppLifecycleEventListener* pListener = dynamic_cast<_IAppLifecycleEventListener*>(&listener);\r
+       SysTryReturnVoidResult(NID_APP, pListener != null, E_INVALID_STATE, "Invalid listener : listener(0x%x), arg(0x%x)", &listener, &arg);\r
+\r
+       const _AppLifecycleEventArg* pEventArg = dynamic_cast<const _AppLifecycleEventArg*>(&arg);\r
+       SysTryReturnVoidResult(NID_APP, pEventArg != null, E_INVALID_STATE, "Invalid arg : listener(0x%x), arg(0x%x)", &listener, &arg);\r
+\r
+       pListener->OnAppLifecycleEventReceived(pEventArg->GetAppId(), pEventArg->GetAppLifecycleEventType());\r
+}\r
+\r
+} } // Tizen::App\r
+\r
index 6b08626..d165d77 100755 (executable)
@@ -68,6 +68,9 @@
 #include "FApp_Aul.h"
 #include "FSys_SystemInfoImpl.h"
 
+#include "FApp_AppLifecycleEvent.h"
+#include "FApp_AppLifecycleEventArg.h"
+#include "FApp_IAppLifecycleEventListener.h"
 using namespace Tizen::App::Package;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -269,6 +272,9 @@ result
 _AppManagerImpl::Construct(void)
 {
        __appManagerEvent.Construct();
+       __appLifecycleEvent.Construct();
+       __appListForAppLifecycle.Construct(0, 0, __strHashCodeProvider, __comparer);
+       __mutex.Create();
 
        _IAppManager* pMgr = _AppManagerProxy::GetService();
        //todo : uncomment following _SysTryReturn or put assert.
@@ -1265,4 +1271,107 @@ _AppManagerImpl::ClearUserPreferenceForAppControlResolution(const AppId& appId)
        return pMgr->ClearUserPreferenceForAppControlResolution(appId);
 }
 
+result
+_AppManagerImpl::AddAppLifecycleEventListener(_IAppLifecycleEventListener& listener)
+{
+       return __appLifecycleEvent.AddListener(listener, false);
+}
+
+result
+_AppManagerImpl::RemoveAppLifecycleEventListener(_IAppLifecycleEventListener& listener)
+{
+       return __appLifecycleEvent.RemoveListener(listener);
+}
+
+result
+_AppManagerImpl::RegisterAppForAppLifecycleEvent(const AppId& appId)
+{
+       SysLog(NID_APP, "Enter");
+
+       result r = __mutex.Acquire();
+
+       bool isContained = false;
+       r = __appListForAppLifecycle.ContainsKey(appId, isContained);
+
+       int currentRefCnt = 0;
+       if(isContained)
+       {
+               r = __appListForAppLifecycle.GetValue(appId, currentRefCnt);
+               r = __appListForAppLifecycle.SetValue(appId, ++currentRefCnt);
+       }
+       else
+       {
+               r = __appListForAppLifecycle.Add(appId, currentRefCnt);
+               
+               _IAppManager* pMgr = _AppManagerProxy::GetService();
+               SysTryReturnResult(NID_APP, pMgr, E_SYSTEM, "_AppManagerProxy::GetService() is failed.");
+
+               r = pMgr->RegisterAppForAppLifecycleEvent(appId, -1);
+               SysLog(NID_APP, "The appId(%ls) is registered.", appId.GetPointer());
+       }
+       r = __mutex.Release();
+       
+       SysLog(NID_APP, "Exit");
+
+       return r;
+}
+
+result
+_AppManagerImpl::UnregisterAppForAppLifecycleEvent(const AppId& appId)
+{
+       SysLog(NID_APP, "Enter");
+
+       result r = __mutex.Acquire();
+       
+       bool isContained = false;
+       r = __appListForAppLifecycle.ContainsKey(appId, isContained);
+
+       if(isContained)
+       {
+               int currentRefCnt = 0;
+               r = __appListForAppLifecycle.GetValue(appId, currentRefCnt);
+
+               currentRefCnt--;
+
+               if (currentRefCnt < 0)
+               {
+                       r = __appListForAppLifecycle.Remove(appId);
+                       
+                       _IAppManager* pMgr = _AppManagerProxy::GetService();
+                       SysTryReturnResult(NID_APP, pMgr, E_SYSTEM, "_AppManagerProxy::GetService() is failed.");
+
+                       r = pMgr->UnregisterAppForAppLifecycleEvent(appId, -1);
+                       
+                       SysLog(NID_APP, "The appId(%ls) is unregistered.", appId.GetPointer());
+               }
+               else
+               {
+                       r = __appListForAppLifecycle.SetValue(appId, currentRefCnt);
+               }               
+       }
+       else
+       {
+               SysLog(NID_APP, "The appId(%ls) is not registered.", appId.GetPointer());
+       }
+       
+       r = __mutex.Release();
+       
+       SysLog(NID_APP, "Exit");
+
+       return r;
+
+}
+
+result
+_AppManagerImpl::OnAppLifecycleEventReceived(int clientId,const AppId& appId, _AppLifecycleEventType appLifecycleEventType)
+{
+       SysLog(NID_APP, "Enter appId(%ls), appLifecycleEventType(%d)", appId.GetPointer(), appLifecycleEventType);
+       
+       _AppLifecycleEventArg* pArg = new (std::nothrow)_AppLifecycleEventArg(appId, appLifecycleEventType);
+       SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+       
+       __appLifecycleEvent.FireAsync(*pArg);
+       return E_SUCCESS;
+}
+
 }} // Tizen::App
index 56e76af..05f884b 100755 (executable)
@@ -34,6 +34,7 @@
 #include "FApp_AppManagerEventArg.h"
 #include "FApp_AppManagerProxy.h"
 #include "FApp_AppManagerIpcMessage.h"
+#include "FApp_IAppLifecycleEventListener.h"
 
 namespace
 {
@@ -196,6 +197,7 @@ _AppManagerProxy::OnIpcResponseReceived(_IpcClient& client, const IPC::Message&
        IPC_BEGIN_MESSAGE_MAP(_AppManagerProxy, message)
                IPC_MESSAGE_HANDLER_EX(AppManager_OnEventReceived, &client, OnEventReceived )
                IPC_MESSAGE_HANDLER_EX(AppManager_OnTerminateApplicationRequested, &client, OnTerminateApplicationRequested )
+               IPC_MESSAGE_HANDLER_EX(AppManager_OnAppLifecycleEventReceived, &client, OnAppLifecycleEventReceived )
        IPC_END_MESSAGE_MAP()
 }
 
@@ -279,4 +281,53 @@ _AppManagerProxy::ClearUserPreferenceForAppControlResolution(const AppId& appId)
        return response;
 }
 
+result
+_AppManagerProxy::RegisterAppForAppLifecycleEvent(const AppId& appId, int clientId)
+{
+       SysLog(NID_APP, "begin.");
+       result response = E_SUCCESS;
+       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_RegisterAppForAppLifecycleEvent(appId, &response));
+       result r = __pIpcClient->SendRequest(*pMsg.get());
+       SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+
+       SysLog(NID_APP, "end.");
+       return response;
+}
+
+result
+_AppManagerProxy::UnregisterAppForAppLifecycleEvent(const AppId& appId, int clientId)
+{
+       SysLog(NID_APP, "begin.");
+       result response = E_SUCCESS;
+       std::auto_ptr<IPC::Message> pMsg (new (std::nothrow) AppManager_UnregisterAppForAppLifecycleEvent(appId, &response));
+       result r = __pIpcClient->SendRequest(*pMsg.get());
+       SysTryReturn(NID_APP, !IsFailed(r), r, r, "SendRequest is failed.");
+
+       SysLog(NID_APP, "end.");
+       return response;
+}
+
+void
+_AppManagerProxy::OnAppLifecycleEventReceived(const AppId& appId, int appLifecycleEventType)
+{
+       SysTryLog(NID_APP, __pServiceEventListener != null, "__pServiceEventListener instance must not be null.");
+
+       _AppLifecycleEventType eventType;
+
+       if (appLifecycleEventType == 0)
+       {
+               eventType = _APP_LIFECYCLE_EVENT_LAUNCH;
+       }
+       else if (appLifecycleEventType == 1)
+       {
+               eventType = _APP_LIFECYCLE_EVENT_TERMINATE;
+       }
+       else
+       {
+               SysLog(NID_APP, "Not expected appLifecycleEventType(%d)", appLifecycleEventType);
+       }
+
+       __pServiceEventListener->OnAppLifecycleEventReceived(-1, appId, eventType);
+}
+
 } } // Tizen::App
diff --git a/src/app/inc/FApp_AppLifecycleEvent.cpp b/src/app/inc/FApp_AppLifecycleEvent.cpp
new file mode 100755 (executable)
index 0000000..175adbc
--- /dev/null
@@ -0,0 +1,84 @@
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file        FApp_AppLifecycleEvent.cpp\r
+ * @brief      This is the implementation for the _AppLifecycleEvent.cpp class.\r
+ */\r
+\r
+#include <FBaseSysLog.h>\r
+\r
+#include "FApp_Types.h"\r
+#include "FApp_AppLifecycleEvent.h"\r
+#include "FApp_AppLifecycleEventArg.h"\r
+#include "FApp_IAppLifecycleEventListener.h"\r
+\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Runtime;\r
+\r
+\r
+namespace Tizen { namespace App\r
+{\r
+\r
+_AppLifecycleEventArg::_AppLifecycleEventArg(void)\r
+{\r
+}\r
+\r
+_AppLifecycleEventArg::_AppLifecycleEventArg(const AppId& appId, _AppLifecycleEventType appLifecycleEventType)\r
+       : __appId(appId)\r
+       , __appLifecycleEventType(appLifecycleEventType)\r
+{\r
+}\r
+\r
+_AppLifecycleEventArg::~_AppLifecycleEventArg(void)\r
+{\r
+}\r
+\r
+const AppId\r
+_AppLifecycleEventArg::GetAppId(void) const\r
+{\r
+       return __appId;\r
+}\r
+\r
+_AppLifecycleEventType\r
+_AppLifecycleEventArg::GetAppLifecycleEventType(void) const\r
+{\r
+       return __appLifecycleEventType;\r
+}\r
+\r
+///////////////////////////////////////////////////////\r
+//_AppLifecycleEvent\r
+///////////////////////////////////////////////////////\r
+result\r
+_AppLifecycleEvent::Construct(void)\r
+{\r
+       return _Event::Initialize();\r
+}\r
+\r
+void\r
+_AppLifecycleEvent::FireImpl(IEventListener& listener, const IEventArg& arg)\r
+{\r
+       _IAppLifecycleEventListener* pListener = dynamic_cast<_IAppLifecycleEventListener*>(&listener);\r
+       SysTryReturnVoidResult(NID_APP, pListener != null, E_INVALID_STATE, "Invalid listener : listener(0x%x), arg(0x%x)", &listener, &arg);\r
+\r
+       const _AppLifecycleEventArg* pEventArg = dynamic_cast<const _AppLifecycleEventArg*>(&arg);\r
+       SysTryReturnVoidResult(NID_APP, pEventArg != null, E_INVALID_STATE, "Invalid arg : listener(0x%x), arg(0x%x)", &listener, &arg);\r
+\r
+       pListener->OnAppLifecycleEventReceived(pEventArg->GetAppId(), pEventArg->GetAppLifecycleEventType());\r
+}\r
+\r
+} } // Tizen::App\r
+\r
diff --git a/src/app/inc/FApp_AppLifecycleEvent.h b/src/app/inc/FApp_AppLifecycleEvent.h
new file mode 100755 (executable)
index 0000000..e63d5cc
--- /dev/null
@@ -0,0 +1,50 @@
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FApp_AppLifecycleEvent.h\r
+ * @brief      This is the header file of _AppLifecycleEvent\r
+ */\r
+\r
+#ifndef _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_H_\r
+#define _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_H_\r
+\r
+#include <FOspConfig.h>\r
+#include <FBaseRt_Event.h>\r
+\r
+namespace Tizen { namespace App\r
+{\r
+\r
+/**\r
+* @class       _AppLifecycleEvent\r
+* @brief               This class contains application lifecycle event\r
+* @since 2.2\r
+*/\r
+class _AppLifecycleEvent\r
+       : public Tizen::Base::Runtime::_Event\r
+{\r
+public:\r
+       result Construct(void);\r
+\r
+protected:\r
+       void FireImpl(Tizen::Base::Runtime::IEventListener& lstener, const Tizen::Base::Runtime::IEventArg& arg);\r
+\r
+};     //_AppLifecycleEvent\r
+\r
+} } // Tizen::App\r
+\r
+#endif // _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_H_\r
+\r
diff --git a/src/app/inc/FApp_AppLifecycleEventArg.h b/src/app/inc/FApp_AppLifecycleEventArg.h
new file mode 100755 (executable)
index 0000000..b5655f0
--- /dev/null
@@ -0,0 +1,62 @@
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FApp_AppLifecycleEventArg.h\r
+ * @brief      This is the header file of _AppLifecycleEventArg class.\r
+ */\r
+\r
+#ifndef _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_ARG_H_\r
+#define _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_ARG_H_\r
+\r
+#include <FBaseObject.h>\r
+#include <FAppTypes.h>\r
+#include <FApp_Types.h>\r
+#include <FBaseRtIEventArg.h>\r
+\r
+#include "FApp_AppManagerEvent.h"\r
+\r
+namespace Tizen { namespace App\r
+{\r
+\r
+/**\r
+ * @class              _AppLifecycleEventArg\r
+ * @brief\r
+ * @since 2.2\r
+ *\r
+ */\r
+class _OSP_EXPORT_ _AppLifecycleEventArg\r
+       : public Tizen::Base::Object\r
+       , public Tizen::Base::Runtime::IEventArg\r
+{\r
+public:\r
+       _AppLifecycleEventArg(void);\r
+       _AppLifecycleEventArg(const AppId& appId, _AppLifecycleEventType appType);\r
+       virtual ~_AppLifecycleEventArg(void);\r
+\r
+       const AppId GetAppId(void) const;\r
+       _AppLifecycleEventType GetAppLifecycleEventType(void) const;\r
+\r
+private:\r
+       AppId __appId;\r
+       _AppLifecycleEventType __appLifecycleEventType;\r
+\r
+};     //_AppLifecycleEventArg\r
+\r
+} } // Tizen::App\r
+\r
+#endif // _FAPP_INTERNAL_APP_LIFECYCLE_EVENT_ARG_H_\r
+\r
index ef49d07..fefdcda 100755 (executable)
 #include <FBaseRtIEventListener.h>
 #include <FAppAppManager.h>
 #include <FBaseSysLog.h>
+#include <FBaseStringHashCodeProvider.h>
+#include <FBaseComparerT.h>
 
 #include "FApp_Types.h"
 #include "FApp_AppManagerEvent.h"
 #include "FApp_IAppManagerServiceEventListener.h"
+#include "FApp_AppLifecycleEvent.h"
 
 namespace Tizen { namespace Base
 {
@@ -61,6 +64,7 @@ class _ConditionManagerProxy;
 class _IAppManagerEventListener;
 class _IAppEventListener;
 class _AppManagerEventArg;
+class _IAppLifecycleEventListener;
 
 
 class _AppLifecycleManager
@@ -360,6 +364,8 @@ public:
 
        virtual result OnTerminateApplicationRequested(int clientId);
 
+       virtual result OnAppLifecycleEventReceived(int clientId, const AppId& appId, _AppLifecycleEventType appLifecycleEventType);
+
        static void SetAppManagerService(_IAppManager* pAppManager );
 
        _OSP_LOCAL_ Tizen::Base::Runtime::_LibraryImpl& GetUiLibraryImpl(void);
@@ -382,6 +388,14 @@ public:
 
        result ClearUserPreferenceForAppControlResolution(const AppId& appId);
 
+       result AddAppLifecycleEventListener(_IAppLifecycleEventListener& listener);
+
+       result RemoveAppLifecycleEventListener(_IAppLifecycleEventListener& listener);
+
+       result RegisterAppForAppLifecycleEvent(const AppId& appId);
+
+       result UnregisterAppForAppLifecycleEvent(const AppId& appId);
+
 private:
        _OSP_LOCAL_ _AppManagerImpl(void);
 
@@ -411,6 +425,11 @@ private:
        _AppLifecycleManager __lifeManager;
        _AppManagerEvent __appManagerEvent;
        Tizen::Base::Collection::LinkedListT<IActiveAppEventListener*> __activeAppEventListenerList;
+       Tizen::App::_AppLifecycleEvent __appLifecycleEvent;
+       Tizen::Base::Collection::HashMapT<Tizen::Base::String, int> __appListForAppLifecycle;
+       Tizen::Base::ComparerT<Tizen::Base::String>     __comparer;
+       Tizen::Base::StringHashCodeProvider     __strHashCodeProvider;
+       Tizen::Base::Runtime::Mutex __mutex;
 
        friend class AppManager;
        friend class _AppControlImpl;
index fa0ac1a..de90495 100755 (executable)
@@ -43,3 +43,6 @@ IPC_MESSAGE_CONTROL1(AppManager_OnEventReceived, Tizen::App::_AppManagerEventArg
 IPC_MESSAGE_CONTROL1(AppManager_AddEventListener, int)
 IPC_MESSAGE_CONTROL1(AppManager_RemoveEventListener, int)
 IPC_MESSAGE_CONTROL0(AppManager_OnTerminateApplicationRequested)
+IPC_MESSAGE_CONTROL2(AppManager_OnAppLifecycleEventReceived, Tizen::App::AppId, int)
+IPC_SYNC_MESSAGE_CONTROL1_1(AppManager_RegisterAppForAppLifecycleEvent, Tizen::App::AppId, result)
+IPC_SYNC_MESSAGE_CONTROL1_1(AppManager_UnregisterAppForAppLifecycleEvent, Tizen::App::AppId, result)
index 6408dbc..1cccff8 100755 (executable)
@@ -40,6 +40,9 @@ class _IAppManagerEventListener;
 class _IAppManagerServiceEventListener;
 class _AppManagerEventArg;
 
+class _IAppLifecycleEventListener;
+
+
 class _OSP_EXPORT_ _AppManagerProxy
        : public _IAppManager
        , public Tizen::Io::_IIpcClientEventListener
@@ -71,6 +74,10 @@ public:
        
        virtual result ClearUserPreferenceForAppControlResolution(const AppId& appId);
 
+       virtual result RegisterAppForAppLifecycleEvent(const AppId& appId, int clientId);
+       
+       virtual result UnregisterAppForAppLifecycleEvent(const AppId& appId, int clientId);
+
        static _IAppManager* GetService(void);
 
        static void SetService(_IAppManager* pAppManager);
@@ -88,6 +95,7 @@ private:
 
        bool OnEventReceived(const Tizen::App::_AppManagerEventArg& arg);
        void OnTerminateApplicationRequested(void);
+       void OnAppLifecycleEventReceived(const AppId& appId, int appLifecycleEventType);
 
 private:
        static _IAppManager* __pSelf;
diff --git a/src/app/inc/FApp_IAppLifecycleEventListener.h b/src/app/inc/FApp_IAppLifecycleEventListener.h
new file mode 100755 (executable)
index 0000000..36706f9
--- /dev/null
@@ -0,0 +1,56 @@
+//\r
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
+//\r
+// Licensed under the Apache License, Version 2.0 (the License);\r
+// you may not use this file except in compliance with the License.\r
+// You may obtain a copy of the License at\r
+//\r
+//     http://www.apache.org/licenses/LICENSE-2.0\r
+//\r
+// Unless required by applicable law or agreed to in writing, software\r
+// distributed under the License is distributed on an "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+// See the License for the specific language governing permissions and\r
+// limitations under the License.\r
+//\r
+\r
+/**\r
+ * @file       FApp_IAppLifecycleEventListener.h\r
+ * @brief      This is the header file for _IAppLifecycleEventListener class.\r
+ */\r
+\r
+#ifndef _FAPP_INTERNAL_IAPP_LIFECYCLE_EVENT_LISTENER_H_\r
+#define _FAPP_INTERNAL_IAPP_LIFECYCLE_EVENT_LISTENER_H_\r
+\r
+#include <FApp_Types.h>\r
+#include <FBaseRtIEventListener.h>\r
+\r
+namespace Tizen { namespace App {\r
+\r
+/**\r
+* @interface _IAppLifecycleEventListener\r
+* @brief This is a tagging interface that all event listeners must implement.\r
+*\r
+* The event listener can listen when the specific event, such as launch and terminate is fired.\r
+*\r
+*/\r
+class _IAppLifecycleEventListener\r
+       : virtual public Tizen::Base::Runtime::IEventListener\r
+{\r
+public:\r
+       /**\r
+        * This is the destructor for this class.\r
+        */\r
+       virtual ~_IAppLifecycleEventListener() {}\r
+\r
+       /**\r
+        * This method will be called when the application's lifecycle event gets triggerred.\r
+        */\r
+       virtual void OnAppLifecycleEventReceived(const AppId& appId, Tizen::App::_AppLifecycleEventType type) = 0;\r
+\r
+}; // _IAppLifecycleEventListener\r
+\r
+}} //Tizen::App\r
+\r
+#endif // _FAPP_INTERNAL_IAPP_LIFECYCLE_EVENT_LISTENER_H_\r
+\r
index 5108c76..a8e1bda 100755 (executable)
@@ -52,6 +52,10 @@ public:
 
        virtual bool IsUserPreferredAppForAppControlResolution(const AppId& appId) = 0;
        virtual result ClearUserPreferenceForAppControlResolution(const AppId& appId) = 0;
+
+       virtual result RegisterAppForAppLifecycleEvent(const AppId& appId, int clientId) = 0;
+       virtual result UnregisterAppForAppLifecycleEvent(const AppId& appId, int clientId) = 0;
+
 };
 
 }} // Tizen::App
old mode 100644 (file)
new mode 100755 (executable)
index c9daf69..22c1c0e
@@ -45,6 +45,8 @@ class _IAppManagerServiceEventListener
 public:
        virtual result OnServiceEventReceived(int clientId, const _AppManagerEventArg& arg) = 0;
        virtual result OnTerminateApplicationRequested(int clientId) = 0;
+       virtual result OnAppLifecycleEventReceived(int clientId, const AppId& appId, _AppLifecycleEventType appLifecycleEventType) = 0;
+
 }; // _IAppManagerServiceEventListener
 
 } } // Tizen::App
old mode 100644 (file)
new mode 100755 (executable)
index b7e9d8a..1ea292e
@@ -61,6 +61,12 @@ enum _AppEvent
        _APP_EVENT_RAISE,
 };
 
+enum _AppLifecycleEventType
+{
+       _APP_LIFECYCLE_EVENT_LAUNCH = 0,
+       _APP_LIFECYCLE_EVENT_TERMINATE,
+};
+
 /**
  * @enum       _ApphandlerType
  * Defines the application provider type