From e98932e9879f4f4d53b32c72df6b5ab5376267c5 Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Fri, 27 Sep 2013 15:43:59 +0900 Subject: [PATCH] add exception handling code for OOM case Change-Id: I24bd798c8f265b029b149e6eb3cb57acce21388d Signed-off-by: jungmin76.park --- src/FShell_AppWidgetContext.cpp | 2 +- src/FShell_AppWidgetManagerService.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/FShell_AppWidgetContext.cpp b/src/FShell_AppWidgetContext.cpp index 750eb47..034348c 100644 --- a/src/FShell_AppWidgetContext.cpp +++ b/src/FShell_AppWidgetContext.cpp @@ -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); diff --git a/src/FShell_AppWidgetManagerService.cpp b/src/FShell_AppWidgetManagerService.cpp index fc812bf..6ec33b2 100644 --- a/src/FShell_AppWidgetManagerService.cpp +++ b/src/FShell_AppWidgetManagerService.cpp @@ -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; -- 2.7.4