fix to retry, when LaunchPkg is failed tizen_2.1 submit/tizen_2.1/20130515.031636
authorjungmin76.park <jungmin76.park@samsung.com>
Tue, 14 May 2013 08:35:27 +0000 (17:35 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Tue, 14 May 2013 08:35:27 +0000 (17:35 +0900)
Change-Id: Ic78854a03ed67ca484fb3c5d795ab775a7fccd61
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
src/FShell_AppWidgetContextBase.cpp
src/FShell_AppWidgetManagerService.cpp

index f7fdcc1..df7a9ba 100644 (file)
@@ -24,6 +24,7 @@
 #include <provider.h>
 #include <FBaseColHashMap.h>
 #include <FBaseSysLog.h>
+#include <FBaseRt.h>
 #include <FBase_StringConverter.h>
 #include <FApp_AppMessageImpl.h>
 #include <FApp_AppArg.h>
@@ -303,8 +304,30 @@ _AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& oper
        std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
        std::unique_ptr<char[]> 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;
 }
index 4b7109e..e17f202 100644 (file)
@@ -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;
        }