move size check by privilege level code to installer(ManifestGenerator)
authorjungmin76.park <jungmin76.park@samsung.com>
Thu, 25 Apr 2013 03:13:05 +0000 (12:13 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Thu, 25 Apr 2013 03:46:04 +0000 (12:46 +0900)
Change-Id: Ifb641cd4b05e7e1ff50b43664947a4ecbd0628ff
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
inc/InstallerDefs.h
src/Manager/SignatureManager.cpp
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestGenerator.h
src/XmlHandler/Parser/ManifestLiveboxesParser.cpp
src/XmlHandler/Parser/ManifestLiveboxesParser.h
src/XmlHandler/Parser/ManifestParser.cpp
src/XmlHandler/Parser/ManifestParser.h

index 7378e1c..e43b981 100755 (executable)
@@ -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"
index 03bc248..2e5a4a4 100755 (executable)
@@ -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;
index 0c5f3b8..932648a 100755 (executable)
@@ -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<String*> (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<String*> (pMapEnum->GetValue());
 
                __pWriter->StartElement(element);
index 2635197..3bac4fd 100755 (executable)
@@ -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;
index 8deedcc..0a4c3ff 100755 (executable)
@@ -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("  <Size>%s</Size> <-- The size isn't supported by native c++ app widget, so ignored.", pCharacters);
-               return true;
-       }
-
        ManifestHandler* pHandler = GetHandler();
        TryReturn(pHandler, false, "pHandler is null");
 
index 7bb00f9..91bbb28 100755 (executable)
@@ -58,7 +58,6 @@ private:
        bool OnDisplayNameValue(const char *pCharacters);
        bool OnConfigurationAppControlAppIdValue(const char* pCharacters);
 
-       static bool IsValidSize(const char *pCharacters);
 
 private:
        AppData* __pAppData;
index aeb7f01..58cda50 100755 (executable)
@@ -47,7 +47,7 @@ ManifestParser::Construct(ManifestHandler* pManifestHandler)
 }
 
 ManifestHandler*
-ManifestParser::GetHandler(void)
+ManifestParser::GetHandler(void) const
 {
        return __pManifestHandler;
 }
index 0b4c053..1da12c3 100755 (executable)
@@ -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);