added the RECREATE event implementation
authorJiban Prakash <p.jiban@samsung.com>
Wed, 29 May 2013 05:43:39 +0000 (11:13 +0530)
committerJiban Prakash <p.jiban@samsung.com>
Wed, 29 May 2013 05:44:45 +0000 (11:14 +0530)
Change-Id: I01ca6b30fac93e3cea536a3a21e3cc92b94c0ad8
Signed-off-by: Jiban Prakash <p.jiban@samsung.com>
src/FShell_AppWidgetManagerService.cpp

index 3b6e0f6..b1d54c5 100644 (file)
@@ -466,7 +466,33 @@ AppWidgetManagerService::OnAppWidgetPeriodChaned(struct event_arg *arg, void* da
 int
 AppWidgetManagerService::OnAppWidgetRecreate(struct event_arg *arg, void* data)
 {
-       SysLog(NID_SHELL, "");
+       SysTryReturn(NID_SHELL, arg != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysTryReturn(NID_SHELL, arg->pkgname != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+       SysTryReturn(NID_SHELL, arg->id != null, EINVAL, E_INVALID_ARG, "[E_INVALID_ARG]");
+
+       SysSecureLog(NID_SHELL, "packageName(%s) id(%s) content(%s) cluster(%s) category(%s)", arg->pkgname, arg->id, arg->info.lb_recreate.content, arg->info.lb_recreate.cluster, arg->info.lb_recreate.category);
+
+       double default_priority = 1.0f;
+       _AppWidgetContext* pAppWidgetContext = new (std::nothrow)_AppWidgetContext( arg->info.lb_recreate.content, arg->pkgname, arg->id,
+                       arg->info.lb_recreate.width, arg->info.lb_recreate.height, arg->info.lb_recreate.period * 1000, default_priority);
+       SysTryReturn(NID_SHELL, pAppWidgetContext, 0, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]");
+
+       int clientId = AppWidgetManagerService::GetInstance()->Find(arg->pkgname);
+       if (clientId != -1)
+       {
+               SysLog(NID_SHELL, "There is same parent application.");
+               pAppWidgetContext->SetIpcClientId(clientId);
+       }
+       else
+       {
+               SysLog(NID_SHELL, "There is no same parent application.");
+       }
+
+       AppWidgetManagerService* pAppWidgetService = AppWidgetManagerService::GetInstance();
+       pAppWidgetService->AddAppWidget(pAppWidgetContext);
+       pAppWidgetContext->OnAdded();
+
+       SysLog(NID_SHELL, "Exit. %d appWidget(s)", pAppWidgetService->__appWidgetContextList.GetCount());
        return 0;
 }