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;
}