Update for retrying to launch application
authorJaesung Ku <jaesung.ku@samsung.com>
Wed, 7 Aug 2013 09:40:02 +0000 (18:40 +0900)
committerso.yu <so.yu@samsung.com>
Tue, 20 Aug 2013 06:49:52 +0000 (15:49 +0900)
Change-Id: I60f963a0a3eb30198c0e4193afddf32a8c4872ba
Signed-off-by: Jaesung Ku <jaesung.ku@samsung.com>
src/FApp_ConditionHandler.cpp

index a2a3210..e574bab 100644 (file)
@@ -41,6 +41,7 @@ namespace Tizen { namespace App {
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
 using namespace Tizen::Io;
 
 _ConditionHandler::_ConditionHandler(const String& fileName, const String& types)
@@ -335,7 +336,22 @@ _ConditionHandler::OnAppLaunchConditionMet(const _AppLaunchCondition& operation,
        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);
+       SysLog(NID_APP, "Application launch results: return(%d)", ret);
+
+       int retryCnt = 0;
+       while (ret < 0)
+       {
+               ret = aul_launch_app(pPackage.get(), pArg->GetBundle());
+               ++retryCnt;
+               SysLog(NID_APP, "Application launch results: return(%d), retryCnt(%d)", ret, retryCnt);
+
+               if (retryCnt > 2)
+               {
+                       break;
+               }
+
+               Thread::Sleep(100);
+       }
 #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());