From: jungmin76.park Date: Thu, 25 Apr 2013 03:13:05 +0000 (+0900) Subject: move size check by privilege level code to installer(ManifestGenerator) X-Git-Tag: accepted/tizen_2.1/20130425.214611~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4b9c337144a259a601f86c4802a73199e2385b3;p=platform%2Fframework%2Fnative%2Finstaller.git move size check by privilege level code to installer(ManifestGenerator) Change-Id: Ifb641cd4b05e7e1ff50b43664947a4ecbd0628ff Signed-off-by: jungmin76.park --- diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 7378e1c..e43b981 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130425.2]" +#define OSP_INSTALLER_VERSION "version=[20130425.3]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Manager/SignatureManager.cpp b/src/Manager/SignatureManager.cpp index 03bc248..2e5a4a4 100755 --- a/src/Manager/SignatureManager.cpp +++ b/src/Manager/SignatureManager.cpp @@ -344,14 +344,13 @@ SignatureManager::GetApiVisibility(RootCertificateType certType) int SignatureManager::GetPrivilegeLevel(int apiVisibility) { - int privilegeLevel = 0; if (apiVisibility == _API_VISIBILITY_PARTNER_MANUFACTURER || apiVisibility == _API_VISIBILITY_PARTNER_OPERATOR) { - privilegeLevel = PRIVILEGE_LEVEL_PLATFORM; + return PRIVILEGE_LEVEL_PLATFORM; } else if (apiVisibility == _API_VISIBILITY_PARTNER) { - privilegeLevel = PRIVILEGE_LEVEL_PARTNER; + return PRIVILEGE_LEVEL_PARTNER; } return PRIVILEGE_LEVEL_PUBLIC; diff --git a/src/XmlHandler/ManifestGenerator.cpp b/src/XmlHandler/ManifestGenerator.cpp index 0c5f3b8..932648a 100755 --- a/src/XmlHandler/ManifestGenerator.cpp +++ b/src/XmlHandler/ManifestGenerator.cpp @@ -316,6 +316,28 @@ ManifestGenerator::WriteLiveboxes(AppData* pAppData) const } bool +ManifestGenerator::IsValidLiveboxSize(const String& size) const +{ + if (size == "1x1" + || size == "2x1" + || size == "2x2") + { + return true; + } + else if (size == "4x1" + || size == "4x2" + || size == "4x3" + || size == "4x4") + { + if (__pContext->__privilegeLevel == PRIVILEGE_LEVEL_PLATFORM) + { + return true; + } + } + return false; +} + +bool ManifestGenerator::WriteLiveboxSizeValue(IMap* pList, const String& element, const String& previewDir) const { TryReturn(pList, false, "pList is null."); @@ -326,6 +348,11 @@ ManifestGenerator::WriteLiveboxSizeValue(IMap* pList, const String& element, con while (pMapEnum->MoveNext() == E_SUCCESS) { String* pSize = static_cast (pMapEnum->GetKey()); + if( pSize && IsValidLiveboxSize(*pSize) == false) + { + AppLog("The size %ls is ignored, because it's invalid for privilege level(%d) of the app.", pSize->GetPointer(), __pContext->__privilegeLevel); + continue; + } String* pPriviewImage = static_cast (pMapEnum->GetValue()); __pWriter->StartElement(element); diff --git a/src/XmlHandler/ManifestGenerator.h b/src/XmlHandler/ManifestGenerator.h index 2635197..3bac4fd 100755 --- a/src/XmlHandler/ManifestGenerator.h +++ b/src/XmlHandler/ManifestGenerator.h @@ -66,6 +66,8 @@ private: bool GetIconPath(const Tizen::Base::String& icon, Tizen::Base::String& iconPath) const; + bool IsValidLiveboxSize(const Tizen::Base::String& size) const; + private: InstallationContext* __pContext; XmlWriter* __pWriter; diff --git a/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp b/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp index 8deedcc..0a4c3ff 100755 --- a/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp +++ b/src/XmlHandler/Parser/ManifestLiveboxesParser.cpp @@ -211,30 +211,8 @@ ManifestLiveboxesParser::OnLiveboxEndElement(void) } bool -ManifestLiveboxesParser::IsValidSize(const char *pCharacters) -{ - if (strcasecmp(pCharacters, "1x1") == 0 - || strcasecmp(pCharacters, "2x1") == 0 - || strcasecmp(pCharacters, "2x2") == 0 - || strcasecmp(pCharacters, "4x1") == 0 - || strcasecmp(pCharacters, "4x2") == 0 - || strcasecmp(pCharacters, "4x3") == 0 - || strcasecmp(pCharacters, "4x4") == 0 ) - { - return true; - } - return false; -} - -bool ManifestLiveboxesParser::OnSizeValue(const char *pCharacters) { - if( IsValidSize(pCharacters) == false) - { - AppLog(" %s <-- The size isn't supported by native c++ app widget, so ignored.", pCharacters); - return true; - } - ManifestHandler* pHandler = GetHandler(); TryReturn(pHandler, false, "pHandler is null"); diff --git a/src/XmlHandler/Parser/ManifestLiveboxesParser.h b/src/XmlHandler/Parser/ManifestLiveboxesParser.h index 7bb00f9..91bbb28 100755 --- a/src/XmlHandler/Parser/ManifestLiveboxesParser.h +++ b/src/XmlHandler/Parser/ManifestLiveboxesParser.h @@ -58,7 +58,6 @@ private: bool OnDisplayNameValue(const char *pCharacters); bool OnConfigurationAppControlAppIdValue(const char* pCharacters); - static bool IsValidSize(const char *pCharacters); private: AppData* __pAppData; diff --git a/src/XmlHandler/Parser/ManifestParser.cpp b/src/XmlHandler/Parser/ManifestParser.cpp index aeb7f01..58cda50 100755 --- a/src/XmlHandler/Parser/ManifestParser.cpp +++ b/src/XmlHandler/Parser/ManifestParser.cpp @@ -47,7 +47,7 @@ ManifestParser::Construct(ManifestHandler* pManifestHandler) } ManifestHandler* -ManifestParser::GetHandler(void) +ManifestParser::GetHandler(void) const { return __pManifestHandler; } diff --git a/src/XmlHandler/Parser/ManifestParser.h b/src/XmlHandler/Parser/ManifestParser.h index 0b4c053..1da12c3 100755 --- a/src/XmlHandler/Parser/ManifestParser.h +++ b/src/XmlHandler/Parser/ManifestParser.h @@ -44,7 +44,7 @@ public: virtual ~ManifestParser(void); bool Construct(ManifestHandler* pManifestHandler); - ManifestHandler* GetHandler(void); + ManifestHandler* GetHandler(void) const; virtual bool OnStartElement(const char *pName); virtual bool OnEndElement(const char *pName);