From: jungmin76.park Date: Thu, 5 Sep 2013 01:52:59 +0000 (+0900) Subject: modify packcage updating scenario(requesting update instead deleting. X-Git-Tag: accepted/tizen/20131018.123424~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=224e0eb6ac119237f9859283fffcc518f99b2155;p=platform%2Fframework%2Fnative%2Fappwidget-service.git modify packcage updating scenario(requesting update instead deleting. Change-Id: Iefa962b82729e0f4f23304cfd4cb61810e4e7098 Signed-off-by: jungmin76.park --- diff --git a/src/FShell_AppContext.cpp b/src/FShell_AppContext.cpp index 5c5f942..5331e3e 100644 --- a/src/FShell_AppContext.cpp +++ b/src/FShell_AppContext.cpp @@ -99,13 +99,27 @@ _AppContext::~_AppContext(void) 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; } diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp index 092decf..fc812bf 100644 --- a/src/FShell_AppWidgetManagerService.cpp +++ b/src/FShell_AppWidgetManagerService.cpp @@ -52,6 +52,16 @@ using namespace Tizen::Shell::App; 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; @@ -341,6 +351,13 @@ int 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);