From 3efabba92b137535498ec40e5e94ed9e75ebe542 Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Wed, 10 Oct 2012 19:35:04 +0900 Subject: [PATCH] Apply category for ime, home-screen, lock-screen Change-Id: Ifda8a6d7f69fd3db673f5d880d87b1e621d7d174 --- inc/InstallerDefs.h | 4 ++- src/Context/InstallationContext.cpp | 12 ++++++++ src/Context/InstallationContext.h | 4 +++ src/Manager/ConfigurationManager.cpp | 56 ++++++++++++++++++++++++++++++++++++ src/Manager/ConfigurationManager.h | 1 + src/XmlHandler/ManifestGenerator.cpp | 27 ++++++++++++++--- src/XmlHandler/ManifestHandler.cpp | 8 ++++++ 7 files changed, 107 insertions(+), 5 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 5f50fa7..56478cc 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -44,6 +44,7 @@ #define VERSION_INFO_FILE L"/info/version.info" #define UISCALABILITY_INFO_FILE L"/info/uiscalability.info" #define WEBSERVICE_INFO_FILE L"/info/webservice.info" +#define TYPE_INFO_FILE L"/info/type.info" #define PACKAGE_XML_FILE L"/info/manifest.xml" #define UISCALABILITY_INFO L"1 %ls %ls %ls" @@ -51,6 +52,7 @@ #define UIAPP_LOADER_PATH "/usr/lib/osp/osp-ui-app-loader" // UiApp #define SERVICEAPP_LOADER_PATH "/usr/lib/osp/osp-service-app-loader" // ServiceApp #define SYSTEMAPP_LOADER_PATH "/usr/lib/osp/osp-system-service-loader" // System Service +#define IME_PATH "/opt/apps/scim/lib/scim-1.0/1.4.0/Helper" #define APP_OWNER_ID 5000 #define APP_GROUP_ID 5000 @@ -70,7 +72,7 @@ #define DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP L"/opt/storage/sdcard/apps/__@@osp_tmp@@__" #define OSP_INSTALLER "osp-installer" -#define OSP_INSTALLER_VERSION "osp-installer version = 2012/10/09" +#define OSP_INSTALLER_VERSION "osp-installer version = 2012/10/10" enum InstallationSetStep { diff --git a/src/Context/InstallationContext.cpp b/src/Context/InstallationContext.cpp index 7b34d70..3351cf8 100755 --- a/src/Context/InstallationContext.cpp +++ b/src/Context/InstallationContext.cpp @@ -353,6 +353,18 @@ InstallationContext::SetAppVersion(const String& appVersion) __appVersion = appVersion; } +const String& +InstallationContext::GetCategory(void) const +{ + return __category; +} + +void +InstallationContext::SetCategory(const String& category) +{ + __category = category; +} + String InstallationContext::GetManifestXmlPath(void) { diff --git a/src/Context/InstallationContext.h b/src/Context/InstallationContext.h index a030b4e..b87fd8e 100755 --- a/src/Context/InstallationContext.h +++ b/src/Context/InstallationContext.h @@ -105,6 +105,9 @@ public: const Osp::Base::String& GetAppVersion(void) const; void SetAppVersion(const Osp::Base::String& appVersion); + const Osp::Base::String& GetCategory(void) const; + void SetCategory(const Osp::Base::String& category); + Osp::Base::String GetManifestXmlPath(void); Osp::Base::String GetSignatureXmlPath(void); @@ -146,6 +149,7 @@ private: Osp::Base::String __appId; Osp::Base::String __appVersion; Osp::Base::String __appRootPath; + Osp::Base::String __category; Osp::Base::Collection::ArrayList* __pPrivilegeList; RootCertificateType __rootCertType; diff --git a/src/Manager/ConfigurationManager.cpp b/src/Manager/ConfigurationManager.cpp index 525b029..56971dd 100755 --- a/src/Manager/ConfigurationManager.cpp +++ b/src/Manager/ConfigurationManager.cpp @@ -27,6 +27,8 @@ #include #include +#include +#include #include #include #include @@ -156,6 +158,27 @@ ConfigurationManager::CreateFile(InstallationContext* pContext) uiScalabilityInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), UISCALABILITY_INFO_FILE); CreateInfoFile(uiScalabilityInfoFile, &uiScalability); + + if (pContext->GetCategory().IsEmpty() == false) + { + String category = pContext->GetCategory(); + category.ToLowerCase(); + + int type = _Aul::GetAppType(category); + + if (category == L"ime") + { + CreateImeSymlink(binaryPath, appName); + } + + String typeInfo; + typeInfo.Format(1024, L"%d", type); + + String typeInfoFile; + typeInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), TYPE_INFO_FILE); + + CreateInfoFile(typeInfoFile, &typeInfo); + } } else if (appType == L"ServiceApp") { @@ -405,6 +428,39 @@ ConfigurationManager::CreateInfoFile(const String& filePath, const String* pCont } bool +ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& appName) +{ + bool res = true; + int err = 0; + const char* pExePath = null; + const char* pSymlinkPath = null; + + Directory::Create(IME_PATH, true); + + String exePath; + exePath.Format(1024, L"%ls.exe", binaryPath.GetPointer()); + + String symlinkPath; + symlinkPath.Format(1024, L"%s/%ls.so", IME_PATH, appName.GetPointer()); + + pExePath = _StringConverter::CopyToCharArrayN(exePath); + TryCatch(pExePath, res = false, "[osp-installer] pExePath is null"); + + pSymlinkPath = _StringConverter::CopyToCharArrayN(symlinkPath); + TryCatch(pSymlinkPath, res = false, "[osp-installer] pSymlinkPath is null"); + + err = symlink(pExePath, pSymlinkPath); + + AppLogTag(OSP_INSTALLER, "[%s] -> [%s]", pSymlinkPath, pExePath); + +CATCH: + delete[] pExePath; + delete[] pSymlinkPath; + + return res; +} + +bool ConfigurationManager::FindPrivilege(InstallationContext* pContext, const String& privilege) const { TryReturn(pContext, false, "[osp-installer] pContext is null."); diff --git a/src/Manager/ConfigurationManager.h b/src/Manager/ConfigurationManager.h index d5e7dc9..f4a7111 100755 --- a/src/Manager/ConfigurationManager.h +++ b/src/Manager/ConfigurationManager.h @@ -49,6 +49,7 @@ private: bool CreateSystemXmlFile(InstallationContext* pContext); bool CreateHybridServiceDesktopFile(InstallationContext* pContext); bool CreateInfoFile(const Osp::Base::String& filePath, const Osp::Base::String* pContext); + bool CreateImeSymlink(const Osp::Base::String& binaryPath, const Osp::Base::String& appName); bool FindPrivilege(InstallationContext* pContext, const Osp::Base::String& privilege) const; }; // ConfigurationManager diff --git a/src/XmlHandler/ManifestGenerator.cpp b/src/XmlHandler/ManifestGenerator.cpp index 4883b12..1c381bb 100755 --- a/src/XmlHandler/ManifestGenerator.cpp +++ b/src/XmlHandler/ManifestGenerator.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include "ManifestGenerator.h" @@ -57,7 +58,7 @@ ManifestGenerator::Construct(InstallationContext* pContext) bool ManifestGenerator::Write() { - bool preload = false; //__pContext->IsPreloaded(); + //bool preload = false; //__pContext->IsPreloaded(); String xmlPath; String package; String location; @@ -132,18 +133,31 @@ ManifestGenerator::Write() // temp String nodisplay("true"); String taskmanage("false"); + String category; if (pAppInfoImpl->GetType() == L"UiApp") { - taskmanage = "true"; + taskmanage = L"true"; if (pAppInfoImpl->IsMainmenuVisible() == true) { - nodisplay = "false"; + nodisplay = L"false"; } else { - nodisplay = "true"; + nodisplay = L"true"; + } + + if (__pContext->GetCategory().IsEmpty() == false) + { + category.Format(1024, L"%ls", __pContext->GetCategory().GetPointer()); + category.ToLowerCase(); + + if (_Aul::GetAppType(category) != 0) + { + taskmanage = L"false"; + nodisplay = L"true"; + } } } @@ -155,6 +169,11 @@ ManifestGenerator::Write() __pWriter->WriteAttribute("multiple", "false"); __pWriter->WriteAttribute("type", type); + if (category.IsEmpty() == false) + { + __pWriter->WriteAttribute("categories", category); + } + #if 0 if (pAppInfoImpl->GetType() == L"UiApp") { diff --git a/src/XmlHandler/ManifestHandler.cpp b/src/XmlHandler/ManifestHandler.cpp index 3bfaaa2..a56896d 100755 --- a/src/XmlHandler/ManifestHandler.cpp +++ b/src/XmlHandler/ManifestHandler.cpp @@ -969,6 +969,7 @@ ManifestHandler::OnUiAppElement(void) char *pExecutableName = null; char *pDefault = null; char *pMainmenuVisible = null; + char *pCategory = null; __pPackageAppInfoImpl = new _PackageAppInfoImpl; TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null"); @@ -1038,6 +1039,13 @@ ManifestHandler::OnUiAppElement(void) __pPackageAppInfoImpl->SetPackageName(app_id); + pCategory = pAttr->Find("Category"); + if (pCategory) + { + AppLogTag(OSP_INSTALLER, "", pCategory); + __pContext->SetCategory(pCategory); + } + AppLogTag(OSP_INSTALLER, "app_id = %S", app_id.GetPointer()); AppLogTag(OSP_INSTALLER, "", pExecutableName, pDefault ? pDefault:"False"); -- 2.7.4