Metadata for splash
authorDongeup Ham <dongeup.ham@samsung.com>
Wed, 22 May 2013 07:46:32 +0000 (16:46 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Wed, 22 May 2013 07:46:32 +0000 (16:46 +0900)
Change-Id: I78115d5a7e692fcc4599aaed92beeae5e192a8da
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestGenerator.h
src/XmlHandler/XmlWriter.cpp

index 2705b49..ab35e68 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130521.1]"
+#define OSP_INSTALLER_VERSION "version=[20130522.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
 #define TIZEN_CATEGORY_MENUSCREEN                              "http://tizen.org/category/menuscreen"
 #define TIZEN_CATEGORY_ANTIVIRUS                               "http://tizen.org/category/antivirus"
 
+// custom metadata
 #define METADATA_FONT                                                  L"http://developer.samsung.com/tizen/metadata/font"
+#define METADATA_SPLASH                                                        L"http://developer.samsung.com/tizen/metadata/splash"
+#define METADATA_SPLASH_INDICATOR_DISPLAY              L"http://developer.samsung.com/tizen/metadata/splash/indicatordisplay"
+#define METADATA_SPLASH_PORTRAIT                               L"http://developer.samsung.com/tizen/metadata/splash/portrait"
+#define METADATA_SPLASH_LANDSCAPE                              L"http://developer.samsung.com/tizen/metadata/splash/landscape"
 
 #define DIR_APPLICATIONS_TMP                                   "/opt/usr/apps/tmp"
 
index e947aa3..8669169 100755 (executable)
@@ -443,6 +443,69 @@ ManifestGenerator::WriteAppControl(AppData* pAppData) const
 }
 
 bool
+ManifestGenerator::GetSplashAttributes(int index, String& indicatorDisplay, String& portraitValue, String& landscapeValue)
+{
+       AppLog("GetSplashAttributes");
+
+       bool isSplashDetected = false;
+
+       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "pAppDataList is null");
+
+       AppData* pAppData = null;
+       pAppDataList->GetAt(index, pAppData);
+       TryReturn(pAppData, false, "pAppData is null");
+
+       HashMap* pMetadataMap = pAppData->__pMetadataMap;
+       TryReturn(pMetadataMap, false, "pMetadataMap is null");
+
+       std::unique_ptr< IMapEnumerator > pEnum(pMetadataMap->GetMapEnumeratorN());
+       TryReturn(pEnum, false, "GetMapEnumeratorN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               String* pKey = static_cast< String* > (pEnum->GetKey());
+               TryReturn(pEnum, false, "GetKey() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+               AppLog("key=[%ls] is detected.", pKey->GetPointer());
+
+               if (pKey->Equals(METADATA_SPLASH, false) == true)
+               {
+                       isSplashDetected = true;
+               }
+               else if (pKey->Equals(METADATA_SPLASH_INDICATOR_DISPLAY, false) == true)
+               {
+                       String* pValue = static_cast< String* > (pEnum->GetValue());
+                       if (pValue && (pValue->Equals("false", false) == true))
+                       {
+                               AppLog("value=[%ls] is detected.", pValue->GetPointer());
+                               indicatorDisplay = L"false";
+                       }
+               }
+               else if (pKey->Equals(METADATA_SPLASH_PORTRAIT, false) == true)
+               {
+                       String* pValue = static_cast< String* > (pEnum->GetValue());
+                       if (pValue)
+                       {
+                               AppLog("value=[%ls] is detected.", pValue->GetPointer());
+                               portraitValue = __pContext->__rootPath + L"/" + *pValue;
+                       }
+               }
+               else if (pKey->Equals(METADATA_SPLASH_LANDSCAPE, false) == true)
+               {
+                       String* pValue = static_cast< String* > (pEnum->GetValue());
+                       if (pValue)
+                       {
+                               AppLog("value=[%ls] is detected.", pValue->GetPointer());
+                               landscapeValue = __pContext->__rootPath + L"/" + *pValue;;
+                       }
+               }
+       }
+
+       return isSplashDetected;
+}
+
+bool
 ManifestGenerator::WriteCategory(int index) const
 {
        IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
@@ -589,6 +652,16 @@ ManifestGenerator::WriteApp(int index, AppData* pAppData)
        __pWriter->WriteAttribute("hw-acceleration", glFrame);
        __pWriter->WriteAttribute("mainapp", mainapp);
 
+       String indicatorDisplay;
+       String portraitValue;
+       String landscapeValue;
+       if (GetSplashAttributes(index, indicatorDisplay, portraitValue, landscapeValue) == true)
+       {
+               __pWriter->WriteAttribute("indicatordisplay", indicatorDisplay);
+               __pWriter->WriteAttribute("portrait-effectimage", portraitValue);
+               __pWriter->WriteAttribute("landscape-effectimage", landscapeValue);
+       }
+
        if (pAppData->__pLaunchConditionList->GetCount() > 0)
        {
                __pWriter->WriteAttribute("launchcondition", "true");
index 89c5f9f..f395b91 100755 (executable)
@@ -59,6 +59,9 @@ private:
        bool WriteApp(int index, AppData* pAppData);
        bool WriteSubModeApp(int index, AppData* pAppData);
        bool WriteAppControl(int index, bool subMode = false);
+       bool GetSplashAttributes(int index, Tizen::Base::String& indicatorDisplay, Tizen::Base::String& portraitValue,
+                       Tizen::Base::String& landscapeValue);
+
        bool WriteAccounts(int index);
        bool WriteNotifications(int index);
        bool WriteFont(int index);
index 85a49c7..000b795 100755 (executable)
@@ -146,19 +146,19 @@ XmlWriter::StartElement(const Tizen::Base::String& name)
 }
 
 bool
-XmlWriter::WriteAttribute(const Tizen::Base::String& name, const Tizen::Base::String& content)
+XmlWriter::WriteAttribute(const Tizen::Base::String& name, const Tizen::Base::String& value)
 {
        ByteBuffer* pNameBuf = null;
-       ByteBuffer* pContentBuf = null;
+       ByteBuffer* pValueBuf = null;
        int err = 0;
        bool res = true;
 
        pNameBuf = StringUtil::StringToUtf8N(name);
-       pContentBuf = StringUtil::StringToUtf8N(content);
+       pValueBuf = StringUtil::StringToUtf8N(value);
 
-       if (pNameBuf && pContentBuf)
+       if (pNameBuf && pValueBuf)
        {
-               err = xmlTextWriterWriteAttribute(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer(), (xmlChar *)pContentBuf->GetPointer());
+               err = xmlTextWriterWriteAttribute(__pXmlWriter, (xmlChar *)pNameBuf->GetPointer(), (xmlChar *)pValueBuf->GetPointer());
                if (err != 0)
                {
                        res = false;
@@ -166,7 +166,7 @@ XmlWriter::WriteAttribute(const Tizen::Base::String& name, const Tizen::Base::St
        }
 
        delete pNameBuf;
-       delete pContentBuf;
+       delete pValueBuf;
        return res;
 }