add exception handling code for OOM case
authorjungmin76.park <jungmin76.park@samsung.com>
Fri, 27 Sep 2013 06:43:59 +0000 (15:43 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Fri, 27 Sep 2013 08:01:14 +0000 (17:01 +0900)
Change-Id: I24bd798c8f265b029b149e6eb3cb57acce21388d
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
src/FShell_AppWidgetContext.cpp
src/FShell_AppWidgetManagerService.cpp

index 750eb47..034348c 100644 (file)
@@ -225,7 +225,7 @@ _AppWidgetContext::OnUpdateAsync(_AppContext* pAppContext, const String& argumen
 void
 _AppWidgetContext::OnResize(int width, int height)
 {
-       SysSecureLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), GetHeight(), GetPriority());
+       SysSecureLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d->%d), height(%d->%d)", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), width, GetHeight(), height);
 
        SetWidth(width);
        SetHeight(height);
index fc812bf..6ec33b2 100644 (file)
@@ -307,16 +307,16 @@ int
 AppWidgetManagerService::OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data)
 {
        SysAssertf(arg != null && arg->pkgname != null && arg->id != null && arg->type == event_arg::EVENT_NEW, "The status of data-provider-master is invalid.");
-
        SysSecureLog(NID_SHELL, "providerId(%s) id(%s) content(%s) cluster(%s) category(%s)", arg->pkgname, arg->id, arg->info.lb_create.content, arg->info.lb_create.cluster, arg->info.lb_create.category);
 
-       const double default_priority = 1.0f;
-       result r = AppWidgetManagerService::GetInstance()->AddAppWidget(arg->info.lb_create.content, arg->pkgname, arg->id, arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
-       SysTryReturn(NID_SHELL, !IsFailed(r), -1, r, "[%s] Failed to execute AddAppWidget.", GetErrorMessage(r));
-
-       *priority = default_priority;
-       *height= arg->info.lb_create.height;
+       const int MAX_LENGTH = 0xFFFF;// FUi_Control.h
        *width = arg->info.lb_create.width;
+       *height= arg->info.lb_create.height;
+       *priority = 1.0f;// Fixed as default
+       SysAssertf(*width >= 0 && *height >= 0 && *width <= MAX_LENGTH && *height <= MAX_LENGTH, "w:%d, h:%d", *width, *height);
+
+       result r = AppWidgetManagerService::GetInstance()->AddAppWidget(arg->info.lb_create.content, arg->pkgname, arg->id, *width, *height, arg->info.lb_create.period*1000, *priority);
+       SysTryReturn(NID_SHELL, !IsFailed(r), -1, r, "[%s] Failed to execute AddAppWidget.", GetErrorMessage(r));
 
     return 0;
 }
@@ -518,7 +518,9 @@ AppWidgetManagerService::OnAppWidgetPeriodChanged(struct event_arg *arg, void* d
 int
 AppWidgetManagerService::OnAppWidgetRecreate(struct event_arg *arg, void* data)
 {
+       const int MAX_LENGTH = 0xFF;// FUi_Control.h
        SysAssertf(arg != null && arg->pkgname != null && arg->id != null && arg->type == event_arg::EVENT_RENEW, "The status of data-provider-master is invalid.");
+       SysAssertf(arg->info.lb_recreate.width >= 0 && arg->info.lb_recreate.height >= 0 && arg->info.lb_recreate.width <= MAX_LENGTH && arg->info.lb_recreate.height <= MAX_LENGTH, "w:%d, h:%d", arg->info.lb_recreate.width, arg->info.lb_recreate.height);
 
        SysSecureLog(NID_SHELL, "providerId(%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);
 
@@ -526,7 +528,7 @@ AppWidgetManagerService::OnAppWidgetRecreate(struct event_arg *arg, void* data)
        SysTryReturn(NID_SHELL, pAppWidgetManagerService != null, -EBUSY, E_SYSTEM, "Failed to get the instance for AppWidgetManagerService.");
 
        const double default_priority = 1.0f;
-       result r = pAppWidgetManagerService->AddAppWidget(arg->info.lb_create.content, arg->pkgname, arg->id, arg->info.lb_create.width, arg->info.lb_create.height, arg->info.lb_create.period * 1000, default_priority);
+       result r = pAppWidgetManagerService->AddAppWidget(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, !IsFailed(r), -EBUSY, r, "[%s] Failed to execute AddAppWidget.", GetErrorMessage(r));
 
        return 0;