bool
_AppWidgetProviderInfoImpl::IsValidSize(const AppId& appId, int w, int h)
{
- if (IsInhouseApp(appId) == true)//TODO: remove this
- {
- return true;
- }
-
-// static const int UNIT_SIZE_BASE = 175;
- static const int UNIT_SIZE_2 = 354;// UNIT_SIZE_BASE*n + 4*(n-1)
+ static const int UNIT_SIZE_BASE = 175;
+ static const int UNIT_SIZE_2 = 354; // UNIT_SIZE_BASE * n + 4*(n-1)
+ // check privilege
int privilegeLevel = _PackageManagerUtil::GetPrivilegeLevel(appId);
- if( privilegeLevel == _API_VISIBILITY_PUBLIC || privilegeLevel == _API_VISIBILITY_PARTNER)
+ if (privilegeLevel == _API_VISIBILITY_PUBLIC || privilegeLevel == _API_VISIBILITY_PARTNER)
{
- if( h > UNIT_SIZE_2 || w > UNIT_SIZE_2)
- {
- SysLog(NID_SHELL, "%dx%d size is invalid for %d privilege", privilegeLevel);
- return false;
- }
+ if (h > UNIT_SIZE_2 || w > UNIT_SIZE_2)
+ {
+ SysLog(NID_SHELL, "%dx%d size is invalid for %d privilege", privilegeLevel);
+ return false;
+ }
}
- /*else if( size.height > UNIT_SIZE_4 || size.width > UNIT_SIZE_4)
+
+ // check base size
+ int unitWidth = w / UNIT_SIZE_BASE;
+ int recalc = UNIT_SIZE_BASE * unitWidth + 4*(unitWidth - 1);
+ if (recalc != w)
{
+ SysLog(NID_SHELL, "%dx%d size is invalid.", w, h);
return false;
- }*/
+ }
+
return true;
}