{
int index = 0;
- if( providerId.StartsWith("com.samsung.", 0) == true)// for core dynamic box plugin
+ if (providerId.StartsWith("com.samsung.", 0) == true)// for core dynamic box plugin
{
- if( providerId.IndexOf(".", 13, index) == E_SUCCESS)//"com.samsung._"
+ if (providerId.IndexOf(".", 13, index) == E_SUCCESS)//"com.samsung._"
{
providerId.SubString(0, index, appId);
providerId.SubString(index+1, providerName);
String
_AppWidgetManagerImpl::MakeProviderName(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
{
- if( providerName.IsEmpty() )
+ if (providerName.IsEmpty())
{
return appId;// some of core appwidget
}
}
String providerId;
- providerId.Format(128, L"%ls.%ls", appId.GetPointer(), providerName.GetPointer() );// native appwidget
+ providerId.Format(128, L"%ls.%ls", appId.GetPointer(), providerName.GetPointer());// native appwidget
return providerId;
}
,__pConfigurationAppControlAppId(null)
,__pProviderId(null)
,__isDefault(false)
+ ,__privilegeLevel(0)
{
String providerId = _AppWidgetManagerImpl::MakeProviderName(appId, name);
__pProviderId = _StringConverter::CopyToCharArrayN(providerId);
SysSecureLog(NID_SHELL, "appId(%ls), name(%ls), providerId(%s)", appId.GetPointer(), name.GetPointer(), __pProviderId);
+
+ if (IsInhouseApp(appId) == false)
+ {
+ __privilegeLevel = _PackageManagerUtil::GetPrivilegeLevel(appId);
+ SysLog(NID_SHELL, "privilege level is %d", __privilegeLevel);
+ }
}
_AppWidgetProviderInfoImpl::~_AppWidgetProviderInfoImpl()
}
bool
-_AppWidgetProviderInfoImpl::IsValidSize(const AppId& appId, int w, int h)
+_AppWidgetProviderInfoImpl::IsValidSize(const AppId& appId, int w, int h, int privilegeLevel, int sizeType)
{
- static const int UNIT_SIZE_BASE = 175;
- static const int UNIT_SIZE_2 = 354; // UNIT_SIZE_BASE * n + 4*(n-1)
+ static const int MAX_SUPPORTED_SIZE_TYPE = LB_SIZE_TYPE_4x4;
+
+ // check max size
+ if (sizeType > MAX_SUPPORTED_SIZE_TYPE)
+ {
+ return false;
+ }
// check privilege
- int privilegeLevel = _PackageManagerUtil::GetPrivilegeLevel(appId);
if (privilegeLevel == _API_VISIBILITY_PUBLIC || privilegeLevel == _API_VISIBILITY_PARTNER)
{
+ static const int UNIT_SIZE_2 = 354; // UNIT_SIZE_BASE * n + 4*(n-1)
+
if (h > UNIT_SIZE_2 || w > UNIT_SIZE_2)
{
SysLog(NID_SHELL, "%dx%d size is invalid for %d privilege", privilegeLevel);
SysLog(NID_SHELL, "%dx%d size is invalid.", w, h);
return false;
}
-
- // check easy mode 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;
Tizen::Base::Collection::IList*
_AppWidgetProviderInfoImpl::GetSizeInfoListN() const
{
- static const int MAX_SUPPORTED_SIZE_TYPE = NR_OF_SIZE_LIST;
+ static const int MAX_SIZE_TYPE = NR_OF_SIZE_LIST;
- int supportedSizeCount = MAX_SUPPORTED_SIZE_TYPE;
- int widthArray[MAX_SUPPORTED_SIZE_TYPE];
- int heightArray[MAX_SUPPORTED_SIZE_TYPE];
+ int supportedSizeCount = MAX_SIZE_TYPE;
+ int widthArray[MAX_SIZE_TYPE];
+ int heightArray[MAX_SIZE_TYPE];
- livebox_service_get_supported_sizes(__pProviderId, &supportedSizeCount , widthArray, heightArray);
-
- SysTryReturn(NID_SHELL, supportedSizeCount > 0, null, E_SYSTEM, "[E_SYSTEM] There is no appwidget of provider(%s)",__pProviderId );
+ livebox_service_get_supported_sizes(__pProviderId, &supportedSizeCount, widthArray, heightArray);
+ SysTryReturn(NID_SHELL, supportedSizeCount > 0, null, E_SYSTEM, "[E_SYSTEM] There is no appwidget of provider(%s)",__pProviderId);
std::unique_ptr<ArrayList> pSizes(new (std::nothrow) ArrayList);
SysTryReturn(NID_SHELL, pSizes, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for ArrayList." );
for(int i = 0; i < supportedSizeCount; i++)
{
size.SetSize(widthArray[i], heightArray[i]);
- int sizeType = livebox_service_size_type( static_cast<int>(size.width), static_cast<int>(size.height) );
- std::unique_ptr<char[], charDeleter> pPeviewImagePath( livebox_service_preview(__pProviderId, sizeType) );
- previewImagePath = pPeviewImagePath.get();
-
- if( IsValidSize(__appId, size.width, size.height) == false )
+ int sizeType = livebox_service_size_type(static_cast<int>(size.width), static_cast<int>(size.height));
+ if (IsValidSize(__appId, size.width, size.height, __privilegeLevel, sizeType) == false)
{
+ SysLog(NID_SHELL, "%dx%d size is invalid.", size.width, size.height);
continue;
}
+ std::unique_ptr<char[], charDeleter> pPeviewImagePath(livebox_service_preview(__pProviderId, sizeType));
+ previewImagePath = pPeviewImagePath.get();
+
bool useDecoration = livebox_service_need_frame(__pProviderId, sizeType);
FloatDimension logicalSize = _CoordinateSystemUtils::InverseTransform(size);
- std::unique_ptr<AppWidgetSizeInfo> pAppWidgetSizeInfo(_AppWidgetSizeInfoImpl::CreateAppWidgetSizeInfo(logicalSize, previewImagePath, useDecoration) );
- SysTryReturn(NID_SHELL, pAppWidgetSizeInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for AppWidgetSizeInfo." );
- pSizes->Add( *pAppWidgetSizeInfo.release() );
+ std::unique_ptr<AppWidgetSizeInfo> pAppWidgetSizeInfo(_AppWidgetSizeInfoImpl::CreateAppWidgetSizeInfo(logicalSize, previewImagePath, useDecoration));
+ SysTryReturn(NID_SHELL, pAppWidgetSizeInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for AppWidgetSizeInfo.");
+ pSizes->Add(*pAppWidgetSizeInfo.release());
}
+
return pSizes.release();
}