From: jungmin76.park Date: Tue, 14 May 2013 08:35:27 +0000 (+0900) Subject: fix to retry, when LaunchPkg is failed X-Git-Tag: accepted/tizen/20130520.100345^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e3f8364f1ddea08c1de90a33ebf0c283467cd47;p=platform%2Fframework%2Fnative%2Fappwidget-service.git fix to retry, when LaunchPkg is failed Change-Id: Ic78854a03ed67ca484fb3c5d795ab775a7fccd61 Signed-off-by: jungmin76.park --- diff --git a/src/FShell_AppWidgetContextBase.cpp b/src/FShell_AppWidgetContextBase.cpp index f7fdcc1..df7a9ba 100644 --- a/src/FShell_AppWidgetContextBase.cpp +++ b/src/FShell_AppWidgetContextBase.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -303,8 +304,30 @@ _AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& oper std::unique_ptr pAppId(_StringConverter::CopyToCharArrayN(appId) ); std::unique_ptr pOperation(_StringConverter::CopyToCharArrayN(operation) ); - result r = Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null); - SysLog(NID_SHELL, "[%s] The result of SendRequestToApp", GetErrorMessage(r)); + + const int TRY_COUNT = 3; + const int TRY_SLEEP_TIME = 65; + + int retry = 0; + + result r = E_FAILURE; + while (true) + { + r = Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null); + if( r == E_SUCCESS) + { + SysLog(NID_SHELL, "[%s] Successed to invoke LaunchPkg()", GetErrorMessage(r)); + break; + } + + if( retry ++ >= TRY_COUNT) + { + break; + } + + SysLog(NID_SHELL, "[%s] Failed to invoke LaunchPkg(%s), %dth retry.", GetErrorMessage(r), pOperation.get(), retry); + Tizen::Base::Runtime::Thread::Sleep(TRY_SLEEP_TIME); + } return r; } diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp index 4b7109e..e17f202 100644 --- a/src/FShell_AppWidgetManagerService.cpp +++ b/src/FShell_AppWidgetManagerService.cpp @@ -244,7 +244,7 @@ AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, in *height= pAppWidgetContext->GetHeight(); *width = pAppWidgetContext->GetWidth(); - SysLog(NID_SHELL, "Exit. %d appWidget(es)", pAppWidgetService->__appWidgetContextList.GetCount()); + SysLog(NID_SHELL, "Exit. %d appWidget(s)", pAppWidgetService->__appWidgetContextList.GetCount()); return 0; } @@ -502,8 +502,6 @@ AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tiz if ( pAppWidgetContext->GetAppId() == appId && pAppWidgetContext->GetProviderName() == providerName) { - SysLog(NID_SHELL, "OK"); - ArrayList* pArray = new (std::nothrow) ArrayList(); SysTryReturnResult(NID_SHELL, pArray, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); @@ -671,7 +669,7 @@ AppWidgetManagerService::_TaskHandlerThread::OnUserEventReceivedN(RequestId reqI break; default: - SysAssertf(false, "never get here!"); + SysAssertf(false, "Never get here!"); break; }