Update livebox parser.
authorDongeup Ham <dongeup.ham@samsung.com>
Fri, 28 Dec 2012 08:19:06 +0000 (17:19 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Fri, 28 Dec 2012 08:19:06 +0000 (17:19 +0900)
Change-Id: I95464352d7d283ea681f8a1d9e9e1b6619e86bcf
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/Context/InstallationContext.h
src/Manager/ConfigurationManager.cpp
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestHandler.cpp
src/XmlHandler/ManifestHandler.h

index 586d983..c644b83 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/27]_RC[2]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/28]_RC[1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
 #define PERM_EXECUTE                                                   (S_IXUSR | S_IXGRP | S_IXOTH)
 #define PERM_WRITE                                                             (S_IWUSR | S_IWGRP | S_IWOTH)
 
+#define TIZEN_PRIVILEGE_WEB_SERVICE                            "http://tizen.org/privilege/web.service"
+#define TIZEN_CATEGORY_IME                                             "http://tizen.org/category/ime"
+#define TIZEN_CATEGORY_HOMESCREEN                              "http://tizen.org/category/homescreen"
+#define TIZEN_CATEGORY_LOCKSCREEN                              "http://tizen.org/category/lockscreen"
+#define TIZEN_CATEGORY_MENUSCREEN                              "http://tizen.org/category/menuscreen"
+
 static const int BLOCK_SIZE = 4096;
 
 #define OSP_INSTALLER  "osp-installer"
index c9d0ce9..24ba7cc 100755 (executable)
@@ -259,6 +259,9 @@ public:
        result AddSize(const Tizen::Base::String& size);
        Tizen::Base::Collection::ArrayList* GetSizeList(void) const;
 
+       Tizen::Base::String __main;
+       Tizen::Base::String __configurationAppControlAppId;
+
 private:
        LiveboxInfo(const LiveboxInfo& value);
        LiveboxInfo& operator =(const LiveboxInfo& source);
index 95f08c1..fffaa91 100755 (executable)
@@ -80,7 +80,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
        versionInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), VERSION_INFO_FILE);
        CreateInfoFile(versionInfoFile, &apiVersion);
 
-       String webServicePrivilege("http://tizen.org/privilege/web.service");
+       String webServicePrivilege(TIZEN_PRIVILEGE_WEB_SERVICE);
        if (FindPrivilege(pContext, webServicePrivilege) == true)
        {
                AppLogTag(OSP_INSTALLER, "WEB_SERVICE privilege is detected. rootPath=[%ls]", rootPath.GetPointer());
index 6b20a46..a1b2f71 100755 (executable)
@@ -260,25 +260,43 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
                IMap* pLiveboxNameList = pLiveboxInfo->GetNameList();
                ArrayList* pSizeList = pLiveboxInfo->GetSizeList();
                String popupEnabled = pLiveboxInfo->GetPopupEnabled();
+               String primary = pLiveboxInfo->__main;
 
                __pWriter->StartElement("livebox");
 
                __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName() + "." + pLiveboxInfo->GetName() );
                __pWriter->WriteAttribute("period", period);
                __pWriter->WriteAttribute("pinup", "false");
-               __pWriter->WriteAttribute("primary", "true");
+
+               if (primary.IsEmpty() == false)
+               {
+                       primary.ToLowerCase();
+                       __pWriter->WriteAttribute("primary", primary);
+               }
+
                __pWriter->WriteAttribute("auto_launch", "false");
                __pWriter->WriteAttribute("abi", "osp");
 
                WriteLanguageValue(pLiveboxNameList, label);
 
-               if (pLiveboxInfo->GetIcon().IsEmpty() == false)
+//             if (pLiveboxInfo->GetIcon().IsEmpty() == false)
+//             {
+//                     String liveboxIcon;
+//                     liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pLiveboxInfo->GetIcon().GetPointer());
+//
+//                     __pWriter->StartElement("icon");
+//                     __pWriter->WriteString(liveboxIcon);
+//                     __pWriter->EndElement();
+//             }
+
+               String menuIcon = pAppInfoImpl->GetMainmenuIcon();
+               if (menuIcon.IsEmpty() == false)
                {
-                       String liveboxIcon;
-                       liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pLiveboxInfo->GetIcon().GetPointer());
+                       String menuIconPath;
+                       menuIconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, menuIcon.GetPointer());
 
                        __pWriter->StartElement("icon");
-                       __pWriter->WriteString(liveboxIcon);
+                       __pWriter->WriteString(menuIconPath);
                        __pWriter->EndElement();
                }
 
@@ -303,6 +321,13 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
                        __pWriter->EndElement();
                }
 
+               if (pLiveboxInfo->__configurationAppControlAppId.IsEmpty() == false)
+               {
+                       __pWriter->StartElement("setup");
+                       __pWriter->WriteString(pLiveboxInfo->__configurationAppControlAppId);
+                       __pWriter->EndElement();
+               }
+
                popupEnabled.ToLowerCase();
                if (popupEnabled == L"true")
                {
@@ -494,22 +519,33 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
                        nodisplay = L"true";
                }
 
-               if (FindCategory(index, "http://tizen.org/category/ime") == true)
+               const char* pCategory = null;
+               pCategory = TIZEN_CATEGORY_IME;
+               if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/ime] is detected. taskmanage=false, nodisplay=true");
+                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false, nodisplay=true", pCategory);
                        taskmanage = L"false";
                        nodisplay = L"true";
                }
 
-               if (FindCategory(index, "http://tizen.org/category/homescreen") == true)
+               pCategory = TIZEN_CATEGORY_HOMESCREEN;
+               if (FindCategory(index, pCategory) == true)
+               {
+                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
+                       taskmanage = L"false";
+               }
+
+               pCategory = TIZEN_CATEGORY_LOCKSCREEN;
+               if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/homescreen] is detected. taskmanage=false");
+                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
                        taskmanage = L"false";
                }
 
-               if (FindCategory(index, "http://tizen.org/category/lockscreen") == true)
+               pCategory = TIZEN_CATEGORY_MENUSCREEN;
+               if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/lockscreen] is detected. taskmanage=false");
+                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
                        taskmanage = L"false";
                }
        }
index 3c742f4..d70f1bd 100755 (executable)
@@ -354,6 +354,10 @@ ManifestHandler::OnCharacters(const char *pCharacters)
        {
                status = OnUriValue(pCharacters);
        }
+       else if (strcasecmp(pName, "ConfigurationAppControlAppId") == 0)
+       {
+               status = OnConfigurationAppControlAppIdValue(pCharacters);
+       }
 
        if (!status)
        {
@@ -747,9 +751,6 @@ ManifestHandler::OnLiveBoxStartElement(void)
        TryReturn(__pLiveboxInfo == null, false, "[osp-installer] __pLiveboxInfo is not null");
 
        XmlAttribute *pAttr = null;
-       char *pUpdatePeriod = null;
-       char *pPopupEnabled = null;
-       char *pName = null;
 
        __pLiveboxInfo = new (std::nothrow) LiveboxInfo;
        TryReturn(__pLiveboxInfo, false, "[osp-installer] __pLiveboxInfo is null");
@@ -757,23 +758,36 @@ ManifestHandler::OnLiveBoxStartElement(void)
        pAttr = GetAttribute();
        TryReturn(pAttr, true, "[osp-installer] pAttr is null");
 
-       pUpdatePeriod = pAttr->Find("UpdatePeriod");
-       TryReturn(pUpdatePeriod, false, "[osp-installer] pUpdatePeriod is null");
-
-       long long updatePeriod = atoll(pUpdatePeriod);
-       __pLiveboxInfo->SetUpdatePeriod(updatePeriod);
+       AppLogTag(OSP_INSTALLER, "<Livebox>");
 
-       pPopupEnabled = pAttr->Find("LiveBoxPopupEnabled");
-       TryReturn(pPopupEnabled, false, "[osp-installer] pPopupEnabled is null");
-
-       __pLiveboxInfo->SetPopupEnabled(pPopupEnabled);
+       char *pProviderName = pAttr->Find("ProviderName");
+       if (pProviderName)
+       {
+               __pLiveboxInfo->SetName(pProviderName);
+               AppLogTag(OSP_INSTALLER, " - ProviderName=%s", pProviderName);
+       }
 
-       pName = pAttr->Find("Name");
-       TryReturn(pName, false, "[osp-installer] pName is null");
+       char *pUpdatePeriod = pAttr->Find("UpdatePeriod");
+       if (pUpdatePeriod)
+       {
+               long long updatePeriod = atoll(pUpdatePeriod);
+               __pLiveboxInfo->SetUpdatePeriod(updatePeriod);
+               AppLogTag(OSP_INSTALLER, " - UpdatePeriod=%lld", updatePeriod);
+       }
 
-       __pLiveboxInfo->SetName(pName);
+       char *pLiveboxPopupEnabled = pAttr->Find("LiveBoxPopupEnabled");
+       if (pLiveboxPopupEnabled)
+       {
+               __pLiveboxInfo->SetPopupEnabled(pLiveboxPopupEnabled);
+               AppLogTag(OSP_INSTALLER, " - LiveBoxPopupEnabled=%s", pLiveboxPopupEnabled);
+       }
 
-       AppLogTag(OSP_INSTALLER, "<Livebox UpdatePeriod=\"%lld\" pPopupEnabled=\"%s\">", updatePeriod, pPopupEnabled);
+       char *pMain = pAttr->Find("Main");
+       if (pMain)
+       {
+               __pLiveboxInfo->__main = pMain;
+               AppLogTag(OSP_INSTALLER, " - Main=%s", pMain);
+       }
 
        return true;
 }
@@ -1377,6 +1391,17 @@ ManifestHandler::OnUriValue(const char* pCharacters)
 }
 
 bool
+ManifestHandler::OnConfigurationAppControlAppIdValue(const char* pCharacters)
+{
+       TryReturn(__pLiveboxInfo, true, "[osp-installer] __pLiveboxInfo is null");
+
+       __pLiveboxInfo->__configurationAppControlAppId = pCharacters;
+       AppLogTag(OSP_INSTALLER, "<ConfigurationAppControlAppId>%s</ConfigurationAppControlAppId>", pCharacters);
+
+       return true;
+}
+
+bool
 ManifestHandler::FindElement(const char *pName)
 {
        bool res = false;
@@ -1478,15 +1503,15 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
 
                if (strcasecmp(pCategory, "home-screen") == 0)
                {
-                       __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/homescreen"));
+                       __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_HOMESCREEN));
                }
                else if (strcasecmp(pCategory, "lock-screen") == 0)
                {
-                       __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/lockscreen"));
+                       __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_LOCKSCREEN));
                }
                else if (strcasecmp(pCategory, "Ime") == 0)
                {
-                       __pAppData->__pCategoryList->Add(new (std::nothrow) String("http://tizen.org/category/ime"));
+                       __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_IME));
                }
 
                CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory);
@@ -1540,6 +1565,13 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
                        AppLogTag(OSP_INSTALLER, " - UseUi=%s", pUseUi);
                }
 
+               char *pLifeDuration = pAttr->Find("LifeDuration");
+               if (pLifeDuration)
+               {
+                       AddAppFeature("LifeDuration", pLifeDuration);
+                       AppLogTag(OSP_INSTALLER, " - LifeDuration=%s", pLifeDuration);
+               }
+
                char *pLaunchOnBoot = pAttr->Find("LaunchOnBoot");
                if (pLaunchOnBoot)
                {
index 4d7d205..ac2a009 100755 (executable)
@@ -119,6 +119,8 @@ private:
        bool OnMimeTypeValue(const char* pCharacters);
        bool OnUriValue(const char* pCharacters);
 
+       bool OnConfigurationAppControlAppIdValue(const char* pCharacters);
+
        // help functions
        bool FindElement(const char *pName);
        bool AddAppFeature(const Tizen::Base::String& name, const Tizen::Base::String& value);