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