fix multiple timer registration for calendar app
authorYoung Ik Cho <youngik.cho@samsung.com>
Tue, 16 Jul 2013 07:40:45 +0000 (16:40 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Tue, 16 Jul 2013 07:41:20 +0000 (16:41 +0900)
Change-Id: Id39e3ebc4424c4ba75e9fb811a07ad28a8ac3f6c
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
CMakeLists.txt
src/FApp_AppManagerStub.cpp
src/FApp_ConditionHandler.cpp

index acbb84f..94b7ae1 100644 (file)
@@ -51,7 +51,6 @@ pkg_check_modules(pkgs REQUIRED
        chromium
        osp-appfw
        osp-appfw-server
-       sysman
        libwbxml2
        wifi-direct
 )
index f1d0ce7..d23a0e3 100755 (executable)
@@ -134,7 +134,7 @@ _AppManagerStub::OnAppLifecycleEventReceived(int clientId, const AppId& appId, _
 {
        SysTryReturnResult(NID_APP, __pIpcServer != null, E_INVALID_STATE, "__pIpcServer is null.");
 
-       _AppLifecycleEventType eventType;
+       _AppLifecycleEventType eventType = _APP_LIFECYCLE_EVENT_LAUNCH;
 
        if (appLifecycleEventType == 0)
        {
@@ -367,6 +367,8 @@ _AppManagerStub::OnRegisterAppForAppLifecycleEvent(const AppId& appId, result *p
        }
 */
        *pRes = __pAppManagerService->RegisterAppForAppLifecycleEvent(appId, __pIpcServer->GetClientId());
+
+       return true;
 }
 
 bool
@@ -386,6 +388,7 @@ _AppManagerStub::OnUnregisterAppForAppLifecycleEvent(const AppId& appId, result
 */
        *pRes = __pAppManagerService->UnregisterAppForAppLifecycleEvent(appId, __pIpcServer->GetClientId());
 
+       return true;
 }
 
 }}//namespace Tizen { namespace App {
index 328186f..a2a3210 100644 (file)
 #include <unistd.h>
 #include <cstdio>
 
+#include <aul.h>
+
 #include <FBaseRtLibrary.h>
 #include <FAppApp.h>
 #include <FBaseSysLog.h>
+
 #include <FBase_StringConverter.h>
 #include <FIo_DirectoryImpl.h>
 #include <FApp_AppArg.h>
@@ -72,7 +75,7 @@ _ConditionHandler::Construct()
        SysLog(NID_APP, "Enter");
 
        result r = LoadPlugin();
-    __conditionalOperations.Construct( 16, 0.75f, __strHashMapProvider, __strComparer);
+    __conditionalOperations.Construct(16, 0.75f, __strHashMapProvider, __strComparer);
 
     SysLog(NID_APP, "Exit");
     return r;
@@ -147,7 +150,7 @@ _ConditionHandler::CreateUniqueId(String& uniqueId)
 }
 
 result
-_ConditionHandler::AddCondition( _AppLaunchCondition& operation)
+_ConditionHandler::AddCondition(_AppLaunchCondition& operation)
 {
        SysTryReturnResult(NID_APP, __pPluginInstance != null, E_INVALID_STATE, "" );
 
@@ -221,7 +224,7 @@ _ConditionHandler::RemoveCondition(const PackageId& packageId, const String& app
                        SysLog(NID_APP,"Unregistered app(%ls), condition(%ls)", pOperation->GetAppId().GetPointer(), pOperation->GetConditionString().GetPointer() );
 
                        delete pOperation;
-                       if ( pCondition != null)
+                       if (pCondition != null)
                        {
                                pValues->RemoveAll();
                                delete pValues;
@@ -300,17 +303,15 @@ _ConditionHandler::OnAppLaunchConditionMet(const _AppLaunchCondition& operation,
 {
        SysLog(NID_APP, "Enter");
 
+       std::unique_ptr<_AppArg> pArg(new (std::nothrow) _AppArg);
+
        if (pExtraData != null)
        {
                SysLog(NID_APP, "pExtraData is not null");
 
-               _AppArg* pArg = new (std::nothrow) _AppArg();
-               
                result r = pArg->ConstructForAppLaunchCondition(operation.GetConditionString(), operation.__pArguments, pExtraData);
                SysTryLog(NID_APP, !IsFailed(r), "[%s] ConstructForAppLaunchCondition(%ls, .. ) fails", GetErrorMessage(r), operation.GetConditionString().GetPointer());
 
-
-
                HashMap* temp = pArg->GetArgMapN();
                if (temp != null)
                {
@@ -321,20 +322,25 @@ _ConditionHandler::OnAppLaunchConditionMet(const _AppLaunchCondition& operation,
                {
                        SysLog(NID_APP, "null");
                }
-
-           r = _AppControlManager::GetInstance()->LaunchApp(operation.GetAppId(), pArg);
-           SysTryLog(NID_APP, !IsFailed(r), "[%ls] LaunchApplication failed, app(%ls).", GetErrorMessage(r), operation.GetAppId().GetPointer());
-
-          delete pArg;
        }
        else
        {
                SysLog(NID_APP, "pExtraData is null");
 
-           result r  = _AppControlManager::GetInstance()->LaunchAppWithCondition(operation.GetAppId(), operation.GetConditionString(), operation.__pArguments );
-           SysTryLog(NID_APP, !IsFailed(r), "[%ls] LaunchApplication failed.", GetErrorMessage(r));
+               result r = pArg->ConstructForAppLaunchCondition(operation.GetConditionString(), operation.__pArguments);
+               SysTryLog(NID_APP, !IsFailed(r), "[%s] ConstructForAppLaunchCondition(%ls, .. ) fails", GetErrorMessage(r), operation.GetConditionString().GetPointer());
        }
 
+#if 1
+       std::unique_ptr<char[]> pPackage(_StringConverter::CopyToCharArrayN(operation.GetAppId()));
+
+       int ret = aul_launch_app(pPackage.get(), pArg->GetBundle());
+       SysTryLog(NID_APP, ret == AUL_R_OK, "Application launch failed : 0x%x", ret);
+#else
+       const result ret = _AppControlManager::GetInstance()->LaunchApp(operation.GetAppId(), pArg.get());
+       SysTryLog(NID_APP, !IsFailed(ret), "[%ls] LaunchApplication failed, app(%ls).", GetErrorMessage(ret), operation.GetAppId().GetPointer());
+#endif
+
        SysLog(NID_APP, "Exit");
 }