result
_AppContext::AddAppWidget(const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int period, int priority)
{
- _AppWidgetContext* pAppWidgetContext = new (std::nothrow)_AppWidgetContext(this, instanceId, providerId, width, height, userInfo, period, priority);
- SysTryReturnResult(NID_SHELL, pAppWidgetContext, E_OUT_OF_MEMORY, "");
+ _AppWidgetContext* pAppWidgetContext = null;
+ bool containsKey = false;
+
+ __appWidgetContextList.ContainsKey(instanceId, containsKey);
+ if (containsKey == true)
+ {
+ SysSecureLog(NID_SHELL, "The appwidget(%ls) is already exist, so requesting to update.", instanceId.GetPointer() );
+
+ __appWidgetContextList.GetValue(instanceId, pAppWidgetContext);
+ pAppWidgetContext->OnUpdate(L"");
+ }
+ else
+ {
+ pAppWidgetContext = new (std::nothrow)_AppWidgetContext(this, instanceId, providerId, width, height, userInfo, period, priority);
+ SysTryReturnResult(NID_SHELL, pAppWidgetContext, E_OUT_OF_MEMORY, "");
- __appWidgetContextList.Add(pAppWidgetContext->GetInstanceId(), pAppWidgetContext);
- pAppWidgetContext->OnAdded();
+ __appWidgetContextList.Add(instanceId, pAppWidgetContext);
+ pAppWidgetContext->OnAdded();
- SysSecureLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->GetProviderId().GetPointer(), pAppWidgetContext->GetInstanceId().GetPointer(), __appWidgetContextList.GetCount());
+ SysSecureLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->GetProviderId().GetPointer(), pAppWidgetContext->GetInstanceId().GetPointer(), __appWidgetContextList.GetCount());
+ }
return E_SUCCESS;
}
namespace
{
+// provider.h
+enum instance_destroy_type
+{
+ INSTANCE_DESTROY_DEFAULT,
+ INSTANCE_DESTROY_PKGMGR,
+ INSTANCE_DESTROY_TERMINATE,
+ INSTANCE_DESTROY_FAULT,
+ INSTANCE_DESTROY_UNKNOWN,
+};
+
static const char APPNAME_OSP_APPWIDGET_SERVICE[] = "osp-appwidget-service";
static const int TIMER_DURATION_PING = 120000;
//extern const int UPDATE_PERIOD_MSEC_MIN;
AppWidgetManagerService::OnAppWidgetDestroy(struct event_arg *arg, void* data)
{
SysAssertf(arg != null && arg->type == event_arg::EVENT_DELETE, "The status of data-provider-master is invalid.");
+ SysLog(NID_SHELL, "lb_destroy.type (%d)", arg->info.lb_destroy.type);
+
+ if (arg->info.lb_destroy.type == INSTANCE_DESTROY_PKGMGR)
+ {
+ SysLog(NID_SHELL, "INSTANCE_DESTROY_PKGMGR type, ignored.");
+ return 0;
+ }
String appId = _AppWidgetHelper::ExtractAppId(arg->pkgname);
_AppContext* pAppContext = AppWidgetManagerService::GetInstance()->FindAppContext(appId);