return the size of dynamic box which is supported by platform 52/14852/1
authorkyeongwoo.lee <kyeongwoo.lee@samsung.com>
Thu, 28 Nov 2013 06:32:36 +0000 (15:32 +0900)
committerKeebong <keebong.bahn@samsung.com>
Mon, 13 Jan 2014 08:59:17 +0000 (17:59 +0900)
Change-Id: Idbba9d0f3e1fc2c139e1ea0da511547f18bacf60
Signed-off-by: kyeongwoo.lee <kyeongwoo.lee@samsung.com>
src/FShell_AppWidgetProviderInfoImpl.cpp

index 62d37fd..f206eb4 100644 (file)
@@ -124,27 +124,29 @@ _AppWidgetProviderInfoImpl::IsDefault() const
 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);
-       ifprivilegeLevel == _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;
 }