asynchronous terminate/raise support
authorYoung Ik Cho <youngik.cho@samsung.com>
Thu, 13 Jun 2013 11:30:56 +0000 (20:30 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Thu, 13 Jun 2013 11:30:56 +0000 (20:30 +0900)
Change-Id: I4e16fbb79b61a9a488eb0d38db56153566f5ea08
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/app/FAppApp.cpp
src/app/FAppAppManager.cpp
src/app/FApp_AppImpl.cpp
src/app/inc/FApp_AppImpl.h
src/app/inc/FApp_AppUserEvent.h
src/app/inc/FApp_AppUserEventArg.h
src/app/inc/FApp_IAppUserEventListener.h
src/app/inc/FApp_Types.h
src/appfw/CMakeLists.txt
src/server/CMakeLists.txt
src/system-server/CMakeLists.txt

index 9f3a0f5..a9b0ae2 100644 (file)
@@ -168,7 +168,7 @@ App::SendUserEvent(RequestId requestId, const IList* pArgs)
 {
        SysAssertf(__pAppImpl != null, "Getting App instance failed.");
 
-       return __pAppImpl->SendUserEvent(requestId, pArgs);
+       return __pAppImpl->SendUserEvent(requestId, pArgs, true);
 }
 
 void
index 177e2d7..63ead16 100644 (file)
@@ -318,7 +318,7 @@ AppManager::SetCheckpointEventListener(IAppCheckpointEventListener& listener)
        SysAssertf(__pAppManagerImpl != null, "Not constructed properly by platform.");
 
        Tizen::Base::Runtime::IEventListener* pListener = &listener;
-       return __pAppManagerImpl->SetEventListener(AE_CHECKPOINT, pListener);
+       return __pAppManagerImpl->SetEventListener(_APP_EVENT_CHECKPOINT, pListener);
 }
 
 void
index 73147b0..60d73ac 100644 (file)
@@ -544,7 +544,7 @@ _AppImpl::HandleLegacyAppRequest(service_s* service, int req, _AppHandler handle
        {
        case _APP_HANDLER_LAUNCH_NORMAL:
                SysLog(NID_APP, "Handling normal launch request");
-               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req));
+               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req), true);
 
                // [TODO] request handle memory cleanup confirm
                _AppControlManager::GetInstance()->RemoveResultRequest(req);
@@ -553,7 +553,7 @@ _AppImpl::HandleLegacyAppRequest(service_s* service, int req, _AppHandler handle
        case _APP_HANDLER_LAUNCH_COND:
                SysLog(NID_APP, "Handling conditional launch request");
 
-               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req));
+               OnUserEventReceivedN(AppLaunchRequestId, pArg->GetArgListN(req), true);
 
                // [TODO] request handle memory cleanup confirm
                _AppControlManager::GetInstance()->RemoveResultRequest(req);
@@ -623,9 +623,9 @@ _AppImpl::OnLanguageChanged(void* user_data)
 
 
 result
-_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs)
+_AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs, bool isPublic)
 {
-       _AppUserEventArg* pArg = new (std::nothrow) _AppUserEventArg(requestId, pArgs);
+       _AppUserEventArg* pArg = new (std::nothrow) _AppUserEventArg(requestId, pArgs, isPublic);
        SysTryReturnResult(NID_APP, pArg != null, E_OUT_OF_MEMORY, "User event creation failure for %d.", requestId);
 
        result r = __appUserEvent.FireAsync(*pArg);
@@ -635,11 +635,31 @@ _AppImpl::SendUserEvent(RequestId requestId, const IList* pArgs)
 
 
 void
-_AppImpl::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
+_AppImpl::OnUserEventReceivedN(RequestId requestId, IList* pArgs, bool isPublic)
 {
        SysTryReturnVoidResult(NID_APP, __pApp != null, E_INVALID_STATE, "[E_INVALID_STATE] Getting internal instance failed.");
 
-       __pApp->OnUserEventReceivedN(requestId, pArgs);
+       if (isPublic)
+       {
+               __pApp->OnUserEventReceivedN(requestId, pArgs);
+       }
+       else
+       {
+               switch (requestId)
+               {
+               case _APP_EVENT_TERMINATE:
+                       SysLog(NID_APP, "App terminate is requested.");
+                       Terminate();
+                       break;
+               case _APP_EVENT_RAISE:
+                       SysLog(NID_APP, "App raise is requested.");
+                       RaiseWindow();
+                       break;
+               default:
+                       SysLog(NID_APP, "Unknown event : 0x%x.", requestId);
+                       break;
+               }
+       }
 }
 
 
@@ -1289,11 +1309,11 @@ _AppImpl::SetListener(_AppEvent appEvent, IEventListener* pListener)
 {
        switch (appEvent)
        {
-       case AE_CHECKPOINT:
+       case _APP_EVENT_CHECKPOINT:
                SysTryReturnResult(NID_APP, __pCheckpointEventListener == null, E_OBJ_ALREADY_EXIST, "Checkpoint listener is already set.");
 
                // fall through
-       case AE_CLEAR_LISTENER:
+       case _APP_EVENT_CLEAR_LISTENER:
                __pCheckpointEventListener = dynamic_cast <IAppCheckpointEventListener*>(pListener);
                break;
 
index 7f26878..fad9cf3 100644 (file)
@@ -308,7 +308,7 @@ private:
        * @param[in]    pArgs       A pointer to an argument list of type String
        * @exception    E_SUCCESS   The method is successful.
        */
-       result SendUserEvent(RequestId requestId, const Tizen::Base::Collection::IList* pArgs);
+       result SendUserEvent(RequestId requestId, const Tizen::Base::Collection::IList* pArgs, bool isPublic);
 
        /**
        * Called asynchronously when the user event is sent by the SendUserEvent() method. @n
@@ -317,7 +317,7 @@ private:
        * @param[in]    requestId   The user defined event ID
        * @param[in]    pArgs       A pointer to an argument list of type String
        */
-       virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
+       virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs, bool isPublic);
 
        /**
         * Called asynchronously when AppControl provider event is received.
index 3e78856..d10ff5d 100644 (file)
@@ -57,7 +57,7 @@ protected:
                SysTryReturnVoidResult(NID_APP, pAppUserEventArg != null && pAppUserEventListener != null, E_INVALID_ARG,
                                "[E_INVALID_ARG] Listener or argument is null.");
 
-               pAppUserEventListener->OnUserEventReceivedN(pAppUserEventArg->GetRequestId(), pAppUserEventArg->GetArgs());
+               pAppUserEventListener->OnUserEventReceivedN(pAppUserEventArg->GetRequestId(), pAppUserEventArg->GetArgs(), pAppUserEventArg->IsPublic());
        }
 };
 
index f9dee2d..4004763 100644 (file)
@@ -36,9 +36,10 @@ class _AppUserEventArg
        , public Tizen::Base::Runtime::IEventArg
 {
 public:
-       _AppUserEventArg(RequestId reqId, const Tizen::Base::Collection::IList* pArgs)
+       _AppUserEventArg(RequestId reqId, const Tizen::Base::Collection::IList* pArgs, bool isPublic)
                : __reqId(reqId)
                , __pArgs(pArgs)
+               , __isPublic(isPublic)
        {
        }
 
@@ -48,9 +49,15 @@ public:
        {
                return __reqId;
        }
+
        Tizen::Base::Collection::IList* GetArgs(void) const
        {
-               return const_cast<Tizen::Base::Collection::IList*>( __pArgs );
+               return const_cast<Tizen::Base::Collection::IList*>(__pArgs);
+       }
+
+       bool IsPublic(void) const
+       {
+               return __isPublic;
        }
 
 private:
@@ -59,8 +66,9 @@ private:
        _AppUserEventArg& operator =(const _AppUserEventArg& source);
 
 private:
-       RequestId __reqId;
+       const RequestId __reqId;
        const Tizen::Base::Collection::IList* __pArgs;
+       const bool __isPublic;
 };
 
 
index b15eef9..0771fac 100644 (file)
@@ -38,7 +38,7 @@ class _IAppUserEventListener
 public:
        virtual ~_IAppUserEventListener(void) {}
 
-       virtual void OnUserEventReceivedN(RequestId reqId, Tizen::Base::Collection::IList* pArgs) = 0;
+       virtual void OnUserEventReceivedN(RequestId reqId, Tizen::Base::Collection::IList* pArgs, bool isPublic) = 0;
 };
 
 
index 16c5b4d..b7e9d8a 100644 (file)
@@ -55,13 +55,10 @@ enum _AppType
 
 enum _AppEvent
 {
-       AE_BATTERY = 0x01,
-       AE_LOW_MEMORY,
-       AE_LEGACY_APPCONTROL,
-       AE_LAUNCH_REQUEST,
-       AE_CHECKPOINT,
-       AE_DELETE_FRAME,
-       AE_CLEAR_LISTENER,
+       _APP_EVENT_CHECKPOINT = 0,
+       _APP_EVENT_CLEAR_LISTENER,
+       _APP_EVENT_TERMINATE,
+       _APP_EVENT_RAISE,
 };
 
 /**
index f67a319..95d5479 100644 (file)
@@ -71,6 +71,7 @@ ADD_CUSTOM_COMMAND(TARGET ${this_target}
 SET(PC_NAME ${this_target})
 SET(PC_REQUIRED ${pc_requires})
 SET(PC_LDFLAGS -l${this_target})
+SET(VERSION ${FULLVER})
 
 # pkgconfig file
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)
index 9ad13bb..ec94998 100644 (file)
@@ -53,6 +53,7 @@ ADD_CUSTOM_COMMAND(TARGET ${this_target}
 SET(PC_NAME ${this_target})
 SET(PC_REQUIRED ${pc_requires})
 SET(PC_LDFLAGS -l${this_target})
+SET(VERSION ${FULLVER})
 
 # pkgconfig file
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)
index 6a7a59d..f87305a 100644 (file)
@@ -43,6 +43,7 @@ ADD_CUSTOM_COMMAND(TARGET ${this_target}
 SET(PC_NAME ${this_target})
 SET(PC_REQUIRED ${pc_requires})
 SET(PC_LDFLAGS -l${this_target})
+SET(VERSION ${FULLVER})
 
 # pkgconfig file
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/${this_target}.pc.in ${CMAKE_SOURCE_DIR}/${this_target}.pc @ONLY)