Apply category for ime, home-screen, lock-screen
authorDuyoung Jang <duyoung.jang@samsung.com>
Wed, 10 Oct 2012 10:35:04 +0000 (19:35 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Wed, 10 Oct 2012 10:35:04 +0000 (19:35 +0900)
Change-Id: Ifda8a6d7f69fd3db673f5d880d87b1e621d7d174

inc/InstallerDefs.h
src/Context/InstallationContext.cpp
src/Context/InstallationContext.h
src/Manager/ConfigurationManager.cpp
src/Manager/ConfigurationManager.h
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestHandler.cpp

index 5f50fa7..56478cc 100755 (executable)
@@ -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
 {
index 7b34d70..3351cf8 100755 (executable)
@@ -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)
 {
index a030b4e..b87fd8e 100755 (executable)
@@ -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;
index 525b029..56971dd 100755 (executable)
@@ -27,6 +27,8 @@
 
 #include <FBaseUtilStringUtil.h>
 #include <FIoFile.h>
+#include <FIoDirectory.h>
+#include <FApp_Aul.h>
 #include <FApp_PackageInfoImpl.h>
 #include <FApp_PackageManagerImpl.h>
 #include <FBase_StringConverter.h>
@@ -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.");
index d5e7dc9..f4a7111 100755 (executable)
@@ -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
index 4883b12..1c381bb 100755 (executable)
@@ -20,6 +20,7 @@
  */
 
 #include <FLclLocale.h>
+#include <FApp_Aul.h>
 #include <FApp_PackageInfoImpl.h>
 
 #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")
                        {
index 3bfaaa2..a56896d 100755 (executable)
@@ -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, "<Category=%s>", pCategory);
+               __pContext->SetCategory(pCategory);
+       }
+
        AppLogTag(OSP_INSTALLER, "app_id = %S", app_id.GetPointer());
        AppLogTag(OSP_INSTALLER, "<UiApp Name=\"%s\" Default=\"%s\">", pExecutableName, pDefault ? pDefault:"False");