From bcb232bdbabbc68e703da9089d861c967a9590b9 Mon Sep 17 00:00:00 2001 From: Dongeup Ham Date: Wed, 5 Dec 2012 18:39:23 +0900 Subject: [PATCH] GlFrame tag parser is implemented. Change-Id: Id284e3ddda154766f5108d346175fda66716dd62 --- inc/InstallerDefs.h | 4 +- src/XmlHandler/ManifestGenerator.cpp | 39 +++++++++++++- src/XmlHandler/ManifestGenerator.h | 1 + src/XmlHandler/ManifestHandler.cpp | 98 ++++++++++++++++-------------------- src/XmlHandler/ManifestHandler.h | 2 + 5 files changed, 87 insertions(+), 57 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index c67e634..a7c3638 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -21,7 +21,7 @@ #ifndef _INSTALLER_DEFS_H_ #define _INSTALLER_DEFS_H_ -#define OSP_INSTALLER_VERSION "osp-installer version = [2012/11/26]_RC[1]" +#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/05]_RC[1]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" @@ -83,7 +83,7 @@ #define DIR_MEMORYCARD_OSP_APPLICATIONS L"/opt/storage/sdcard/apps" #define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__" -#define DIR_MEMORYCARD_INSTALLATION L"/opt/storage/sdcard/installtosdcard" +#define DIR_MEMORYCARD_INSTALLATION L"/opt/storage/sdcard/installtosdcard" static const int BLOCK_SIZE = 4096; diff --git a/src/XmlHandler/ManifestGenerator.cpp b/src/XmlHandler/ManifestGenerator.cpp index cea6a20..65a5c4d 100755 --- a/src/XmlHandler/ManifestGenerator.cpp +++ b/src/XmlHandler/ManifestGenerator.cpp @@ -107,7 +107,6 @@ ManifestGenerator::Write() for (int i = 0 ; i < pAppList->GetCount(); i++) { pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i)); - if (pAppInfoImpl) { IMap* pNameList = pAppInfoImpl->GetNameList(); @@ -164,6 +163,9 @@ ManifestGenerator::Write() } } + ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList(); + String glFrame = GetGlFrameValue(pFeatureList); + __pWriter->StartElement("ui-application"); __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName()); __pWriter->WriteAttribute("exec", binaryPath); @@ -171,6 +173,7 @@ ManifestGenerator::Write() __pWriter->WriteAttribute("taskmanage", taskmanage); __pWriter->WriteAttribute("multiple", "false"); __pWriter->WriteAttribute("type", type); + __pWriter->WriteAttribute("hw-acceleration", glFrame); if (category.IsEmpty() == false) { @@ -280,6 +283,40 @@ ManifestGenerator::FindFeatureValue(ArrayList* pFeatureList, const String& featu return false; } +String +ManifestGenerator::GetGlFrameValue(ArrayList* pFeatureList) const +{ + if (pFeatureList == null) + { + return "use-system-setting"; + } + + _AppFeatureInfoImpl* pFeature = null; + for (int i = 0 ; i < pFeatureList->GetCount(); i++) + { + pFeature = dynamic_cast<_AppFeatureInfoImpl*>(pFeatureList->GetAt(i)); + if (pFeature == null) + { + return "use-system-setting"; + } + + if (pFeature->GetName() == L"GlFrame") + { + String value = pFeature->GetValue(); + if (value == L"On") + { + return "use-GL"; + } + else if (value == L"Off") + { + return "not-use-GL"; + } + } + } + + return "use-system-setting"; +} + bool ManifestGenerator::WriteLanguageValue(IMap* pList, const String& element) const { diff --git a/src/XmlHandler/ManifestGenerator.h b/src/XmlHandler/ManifestGenerator.h index 375bd70..0bcb8d1 100755 --- a/src/XmlHandler/ManifestGenerator.h +++ b/src/XmlHandler/ManifestGenerator.h @@ -54,6 +54,7 @@ private: bool WriteLanguageValue(Osp::Base::Collection::IMap* pList, const Osp::Base::String& label) const; bool WriteLiveboxes(Osp::App::_PackageAppInfoImpl* pAppInfoImpl) const; bool WriteAppControl(Osp::App::_PackageAppInfoImpl* pAppInfoImpl) const; + Osp::Base::String GetGlFrameValue(Osp::Base::Collection::ArrayList* pFeatureList) const; private: InstallationContext* __pContext; diff --git a/src/XmlHandler/ManifestHandler.cpp b/src/XmlHandler/ManifestHandler.cpp index fd1115c..0e2fb54 100755 --- a/src/XmlHandler/ManifestHandler.cpp +++ b/src/XmlHandler/ManifestHandler.cpp @@ -1106,10 +1106,6 @@ bool ManifestHandler::OnUiAppElement(void) { XmlAttribute *pAttr = null; - char *pExecutableName = null; - char *pDefault = null; - char *pMainmenuVisible = null; - char *pCategory = null; __pPackageAppInfoImpl = new _PackageAppInfoImpl; TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null"); @@ -1117,7 +1113,7 @@ ManifestHandler::OnUiAppElement(void) pAttr = GetAttribute(); TryReturn(pAttr, true, "[osp-installer] pAttr is null"); - pExecutableName = pAttr->Find("ExecutableName"); + char* pExecutableName = pAttr->Find("ExecutableName"); if (pExecutableName == null) { pExecutableName = pAttr->Find("Name"); @@ -1126,7 +1122,7 @@ ManifestHandler::OnUiAppElement(void) __pPackageAppInfoImpl->SetName(pExecutableName); - pDefault = pAttr->Find("Default"); + char* pDefault = pAttr->Find("Default"); if (pDefault) { __pPackageAppInfoImpl->SetDefault(pDefault); @@ -1144,7 +1140,7 @@ ManifestHandler::OnUiAppElement(void) __pPackageAppInfoImpl->SetType("UiApp"); - pMainmenuVisible = pAttr->Find("MainmenuVisible"); + char* pMainmenuVisible = pAttr->Find("MainmenuVisible"); if (pMainmenuVisible) { if (strcasecmp(pMainmenuVisible, "True") == 0) @@ -1156,18 +1152,27 @@ ManifestHandler::OnUiAppElement(void) __pPackageAppInfoImpl->SetMainmenuVisible(false); } - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; - TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); + AddAppFeature("MainmenuVisible", pMainmenuVisible); + AppLogTag(OSP_INSTALLER, "", pMainmenuVisible); + } - pAppFeatureInfo->SetName("MainmenuVisible"); - pAppFeatureInfo->SetValue(pMainmenuVisible); - __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); + char* pGlFrame = pAttr->Find("GlFrame"); + if (pGlFrame) + { + AddAppFeature("GlFrame", pGlFrame); + AppLogTag(OSP_INSTALLER, "", pGlFrame); + } - AppLogTag(OSP_INSTALLER, "", pMainmenuVisible); + char* pCategory = pAttr->Find("Category"); + if (pCategory) + { + AppLogTag(OSP_INSTALLER, "", pCategory); + + CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory); + __pPackageAppInfoImpl->SetAppFeature(categoryType); } String app_id; - if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG) { app_id.Format(1024, PACKAGE_NAME_RULE_ORG, __pPackageInfoImpl->GetAppId().GetPointer(), pExecutableName); @@ -1179,15 +1184,6 @@ ManifestHandler::OnUiAppElement(void) __pPackageAppInfoImpl->SetPackageName(app_id); - pCategory = pAttr->Find("Category"); - if (pCategory) - { - AppLogTag(OSP_INSTALLER, "", pCategory); - - CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory); - __pPackageAppInfoImpl->SetAppFeature(categoryType); - } - AppLogTag(OSP_INSTALLER, "app_id = %S", app_id.GetPointer()); AppLogTag(OSP_INSTALLER, "", pExecutableName, pDefault ? pDefault:"False"); @@ -1242,58 +1238,38 @@ ManifestHandler::OnServiceAppElement(void) pMainmenuVisible = pAttr->Find("MainmenuVisible"); if (pMainmenuVisible) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; - TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); - - pAppFeatureInfo->SetName("MainmenuVisible"); - pAppFeatureInfo->SetValue(pMainmenuVisible); - __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); - + AddAppFeature("MainmenuVisible", pMainmenuVisible); AppLogTag(OSP_INSTALLER, "", pMainmenuVisible); } pLaunchOnBoot = pAttr->Find("LaunchOnBoot"); if (pLaunchOnBoot) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; - TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); - - pAppFeatureInfo->SetName("LaunchOnBoot"); - pAppFeatureInfo->SetValue(pLaunchOnBoot); - - __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); - + AddAppFeature("LaunchOnBoot", pLaunchOnBoot); AppLogTag(OSP_INSTALLER, "", pLaunchOnBoot); } pAutoRestart = pAttr->Find("AutoRestart"); if (pAutoRestart) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; - TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); - - pAppFeatureInfo->SetName("AutoRestart"); - pAppFeatureInfo->SetValue(pAutoRestart); - - __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); - + AddAppFeature("AutoRestart", pAutoRestart); AppLogTag(OSP_INSTALLER, "", pAutoRestart); } pRemoteUi = pAttr->Find("RemoteUi"); if (pRemoteUi) { - _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; - TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); - - pAppFeatureInfo->SetName("RemoteUi"); - pAppFeatureInfo->SetValue(pRemoteUi); - - __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); - + AddAppFeature("RemoteUi", pRemoteUi); AppLogTag(OSP_INSTALLER, "", pRemoteUi); } + char* pGlFrame = pAttr->Find("GlFrame"); + if (pGlFrame) + { + AddAppFeature("GlFrame", pGlFrame); + AppLogTag(OSP_INSTALLER, "", pGlFrame); + } + String app_id; if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG) @@ -1340,3 +1316,17 @@ ManifestHandler::FindElement(const char *pName) return res; } + +bool +ManifestHandler::AddAppFeature(const Osp::Base::String& name, const Osp::Base::String& value) +{ + _AppFeatureInfoImpl* pAppFeatureInfo = new _AppFeatureInfoImpl; + TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null"); + + pAppFeatureInfo->SetName(name); + pAppFeatureInfo->SetValue(value); + __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo); + + return true; +} + diff --git a/src/XmlHandler/ManifestHandler.h b/src/XmlHandler/ManifestHandler.h index 1024d73..5e74553 100755 --- a/src/XmlHandler/ManifestHandler.h +++ b/src/XmlHandler/ManifestHandler.h @@ -24,6 +24,7 @@ #define _MANIFEST_HANDLER_H_ #include +#include #include "XmlHandler.h" #include "InstallationContext.h" @@ -90,6 +91,7 @@ private: bool OnServiceAppElement(void); bool FindElement(const char *pName); + bool AddAppFeature(const Osp::Base::String& name, const Osp::Base::String& value); private: InstallationContext* __pContext; -- 2.7.4