merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:53 +0000 (01:16 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:16:53 +0000 (01:16 +0900)
57 files changed:
CMakeLists.txt
inc/InstallerDefs.h
packaging/osp-installer.spec
plugin/osp-installer-plugin.cpp [changed mode: 0644->0755]
src/Context/InstallationContext.cpp
src/Context/InstallationContext.h
src/Context/InstallationContextData.cpp
src/Context/InstallationContextData.h
src/Installer/DirectoryInstaller.cpp
src/Installer/GuestInstaller.cpp
src/Installer/IDEInstaller.cpp
src/Installer/Installer.cpp
src/Installer/PackageInstaller.cpp [changed mode: 0644->0755]
src/Installer/PreloadedInstaller.cpp
src/Installer/RestorationInstaller.cpp
src/Manager/ConfigurationManager.cpp
src/Manager/ConfigurationManager.h
src/Manager/DatabaseManager.cpp [new file with mode: 0755]
src/Manager/DatabaseManager.h [new file with mode: 0755]
src/Manager/InstallerManager.cpp
src/Manager/InstallerManager.h
src/Manager/PermissionManager.cpp
src/Manager/PermissionManager.h [changed mode: 0644->0755]
src/Manager/SignatureManager.cpp
src/Manager/SmackManager.cpp [new file with mode: 0755]
src/Manager/SmackManager.h [new file with mode: 0755]
src/Step/DrmStep.cpp
src/Step/LicenseStep.cpp
src/Step/ManifestXmlStep.cpp
src/Step/PackageCheckStep.cpp
src/Step/SignatureStep.cpp
src/Step/SystemCheckStep.cpp
src/Step/SystemCheckStep.h [changed mode: 0644->0755]
src/Step/UninstallStep.cpp
src/Step/UnpackStep.cpp
src/Step/UnpackStep.h [changed mode: 0644->0755]
src/Util/InstallerUtil.cpp
src/Util/InstallerUtil.h
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/ManifestGenerator.h
src/XmlHandler/ManifestHandler.cpp
src/XmlHandler/ManifestHandler.h
src/XmlHandler/Parser/ManifestAccountsParser.cpp
src/XmlHandler/Parser/ManifestAccountsParser.h
src/XmlHandler/Parser/ManifestAppControlsParser.cpp
src/XmlHandler/Parser/ManifestAppControlsParser.h
src/XmlHandler/Parser/ManifestLiveboxesParser.cpp
src/XmlHandler/Parser/ManifestLiveboxesParser.h
src/XmlHandler/Parser/ManifestParser.cpp
src/XmlHandler/Parser/ManifestParser.h
src/XmlHandler/PrivilegeHandler.cpp
src/XmlHandler/PrivilegeHandler.h
src/XmlHandler/SignatureHandler.cpp
src/XmlHandler/XmlAttribute.cpp
src/XmlHandler/XmlHandler.cpp
src/XmlHandler/XmlWriter.cpp
src/backend/backend.cpp

index 8b88653..5c29818 100755 (executable)
@@ -42,9 +42,11 @@ SET (${this_target}_SOURCE_FILES
        src/Installer/PreloadedInstaller.cpp
        src/Installer/RestorationInstaller.cpp
        src/Manager/ConfigurationManager.cpp
+       src/Manager/DatabaseManager.cpp
        src/Manager/InstallerManager.cpp
        src/Manager/PermissionManager.cpp
        src/Manager/SignatureManager.cpp
+       src/Manager/SmackManager.cpp
        src/Step/DrmStep.cpp
        src/Step/IInstallationStep.cpp
        src/Step/LicenseStep.cpp
@@ -75,7 +77,7 @@ SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
 SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
 
-TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -lxml2 -lpkgmgr_installer -lpkgmgr_parser -lglib-2.0 -lapp2ext" -Wl,--allow-shlib-undefined)
+TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw -lxml2 -lpkgmgr_installer -lpkgmgr_parser -lglib-2.0 -lapp2ext -ldl" -Wl,--allow-shlib-undefined)
 TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib -ldrm-service-core-intel")
 
 ADD_SUBDIRECTORY(plugin)
index 6ee4032..3f79eb0 100755 (executable)
@@ -21,7 +21,9 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = 20130131.2"
+#include "InstallerUtil.h"
+
+#define OSP_INSTALLER_VERSION "version=[20130314.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
@@ -33,6 +35,8 @@
 #define DIR_SETTING                    L"/setting"
 #define DIR_CONTENTS           L"/contents"
 #define DIR_SHARED_RES         L"/shared/res"
+#define DIR_SHARED_DATA                L"/shared/data"
+#define DIR_SHARED_TRUSTED             L"/shared/trusted"
 
 #define SLP_DIR_BIN                    L"/bin"
 #define SLP_DIR_RES                    L"/res"
 
 #define UISCALABILITY_INFO                     L"1 %ls %ls %ls"
 
+#define CONFIG_PATH                                                    L"/usr/etc/installer-config.ini"
+
 #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 SYSTEMSERIVCE_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 SUB_MODE_APPCONTROL_NAME       L"_AppControl"
 #define APP_OWNER_ID           5000
 #define APP_GROUP_ID           5000
 
-#define APPID_LENGTH           10
+#define PACKAGE_ID_LENGTH      10
 #define APP_DIR_LENGTH         20
 
 #define TEST_ARG_COUNT         1
 #define COMMAND_ARG_COUNT      3
+#define TERMINATE_RETRY_COUNT  300
 
 #define DIR_OSP_APPLICATIONS_TEMP                              L"/opt/usr/apps/__@@osp_tmp@@__"
 
@@ -104,10 +111,10 @@ static const int BLOCK_SIZE = 4096;
 
 #define OSP_INSTALLER  "osp-installer"
 
-#ifdef AppLogTag
-#undef AppLogTag
-#define AppLogTag(tag, ...)                                            AppLogTagInternal(tag, "        |", 0, __VA_ARGS__); \
-                                                                                               fprintf(stderr, "        |");fprintf(stderr, __VA_ARGS__);fprintf(stderr, "\n");
+#ifdef AppLog
+#undef AppLog
+#define AppLog(...)            AppLogTagInternal(OSP_INSTALLER, __PRETTY_FUNCTION__, __LINE__, __VA_ARGS__); \
+                                               InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, false, __VA_ARGS__);
 #endif
 
 #ifdef TryCatch
@@ -116,7 +123,7 @@ static const int BLOCK_SIZE = 4096;
        if (!(condition)) { \
                AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
                expr; \
-               fprintf(stderr, "        |");fprintf(stderr, __VA_ARGS__);fprintf(stderr, "\n"); \
+               InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
                goto CATCH;     \
        } \
        else {;}
@@ -127,7 +134,7 @@ static const int BLOCK_SIZE = 4096;
 #define TryReturn(condition, returnValue, ...) \
        if (!(condition)) { \
                AppLogExceptionTag(OSP_INSTALLER, __VA_ARGS__); \
-               fprintf(stderr, "        |");fprintf(stderr, __VA_ARGS__);fprintf(stderr, "\n"); \
+               InstallerUtil::AppendLog(__PRETTY_FUNCTION__, __LINE__, true, __VA_ARGS__); \
                return returnValue;     \
        } \
        else {;}
@@ -151,10 +158,10 @@ enum InstallationStep
 {
        INSTALLER_STEP_NONE = 0,
        INSTALLER_STEP_INIT,
-       INSTALLER_STEP_CHECK_SYSTEM,
        INSTALLER_STEP_CHECK_PACKAGE,
        INSTALLER_STEP_DRM,
        INSTALLER_STEP_PARSE_MANIFEST,
+       INSTALLER_STEP_CHECK_SYSTEM,
        INSTALLER_STEP_UNPACK,
        INSTALLER_STEP_LICENSE,
        INSTALLER_STEP_PARSE_SIGNATURE,
@@ -179,11 +186,15 @@ enum InstallerType
 
 };
 
-enum RequesterType
+enum InstallerOption
 {
-       REQUESTER_TYPE_NORMAL,
-       REQUESTER_TYPE_IDE,
-       REQUESTER_TYPE_PRELOADED,
+       INSTALLER_OPTION_NONE = 0,
+       INSTALLER_OPTION_NORMAL = 1,
+       INSTALLER_OPTION_IDE = 2,
+       INSTALLER_OPTION_PRELOADED = 4,
+       INSTALLER_OPTION_HYBRID = 8,
+       INSTALLER_OPTION_NO_INPUT = 16,
+       INSTALLER_OPTION_FILELOG_ON = 32,
 
 };
 
@@ -241,13 +252,6 @@ enum
        INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL = 3,
 };
 
-enum
-{
-       INSTALLER_PREFIX_TYPE_NONE,
-       INSTALLER_PREFIX_TYPE_ORG,
-
-};
-
 enum CategoryType
 {
        CATEGORY_TYPE_NONE,
@@ -257,4 +261,11 @@ enum CategoryType
 
 };
 
+enum InstallationStorage
+{
+       INSTALLATION_STORAGE_INTERNAL,
+       INSTALLATION_STORAGE_EXTERNAL,
+
+};
+
 #endif // _INSTALLER_DEFS_H_
index 106e0f8..0b9375e 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          osp-installer
 Summary:       osp application installer
-Version:       1.2.0.0
+Version:       1.2.1.0
 Release:       2
 Group:         TO_BE/FILLED_IN
 License:       Apache License, Version 2.0 or Flora
old mode 100644 (file)
new mode 100755 (executable)
index 14e7130..43210c9
@@ -25,6 +25,7 @@
 #include <dirent.h>
 #include <package-manager-plugin.h>
 
+#include <FAppTypes.h>
 #include <FBaseString.h>
 #include <FIoDirectory.h>
 #include <FAppPkg_PackageInfoImpl.h>
@@ -35,6 +36,7 @@
 
 using namespace Tizen::Base;
 using namespace Tizen::Io;
+using namespace Tizen::App;
 using namespace Tizen::App::Package;
 
 #ifdef __cplusplus
@@ -50,35 +52,35 @@ static int pkg_get_data_size(const String& rootPath);
 
 static void pkg_plugin_unload(void)
 {
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_plugin_unload() is called");
+       AppLog("[libtpk] pkg_plugin_unload() is called");
 }
 
 static int pkg_plugin_pkg_is_installed(const char *pkg_name)
 {
        int err = PKG_SUCCESS;
        String packageName(pkg_name);
-       String packageId;
+       PackageId packageId;
        bool installed = true;
 
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_plugin_pkg_is_installed() is called");
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_name=[%s]", pkg_name);
+       AppLog("[libtpk] pkg_plugin_pkg_is_installed() is called");
+       AppLog("[libtpk] pkg_name=[%s]", pkg_name);
 
        TryCatch(pkg_name, err = PKG_ERROR, "[osp-installer][libtpk] pkg_name is null");
 
        if (packageName.Contains(PACKAGE_NAME_PREFIX_ORG) == true)
        {
                String prefixPackage(PACKAGE_NAME_PREFIX_ORG);
-               packageName.SubString(prefixPackage.GetLength(), APPID_LENGTH, packageId);
+               packageName.SubString(prefixPackage.GetLength(), PACKAGE_ID_LENGTH, packageId);
        }
        else
        {
-               packageName.SubString(0, APPID_LENGTH, packageId);
+               packageName.SubString(0, PACKAGE_ID_LENGTH, packageId);
        }
 
        installed = _PackageManagerImpl::GetInstance()->IsPackageInstalled(packageId);
        TryCatch(installed == true, err = PKG_ERROR, "[osp-installer][libtpk] IsPackageInstalled() is failed");
 
-       AppLogTag(OSP_INSTALLER, "[libtpk] IsPackageInstalled=[%d]", installed);
+       AppLog("[libtpk] IsPackageInstalled=[%d]", installed);
        err = PKG_SUCCESS;
 
 CATCH:
@@ -88,7 +90,7 @@ CATCH:
 static int pkg_plugin_get_installed_pkg_list(const char *category,
                const char *option, package_manager_pkg_info_t **list, int *count)
 {
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_plugin_get_installed_pkg_list() is called");
+       AppLog("[libtpk] pkg_plugin_get_installed_pkg_list() is called");
 
        return PKG_ERROR;
 }
@@ -103,8 +105,8 @@ static int pkg_plugin_get_pkg_detail_info(const char *pkg_name,
        _PackageInfoImpl pkgInfoImpl;
        result r = E_SUCCESS;
 
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_plugin_get_pkg_detail_info() is called");
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_name=[%s]", pkg_name);
+       AppLog("[libtpk] pkg_plugin_get_pkg_detail_info() is called");
+       AppLog("[libtpk] pkg_name=[%s]", pkg_name);
 
        TryCatch(pkg_name, err = PKG_ERROR, "[osp-installer][libtpk] pkg_name is null");
 
@@ -113,11 +115,11 @@ static int pkg_plugin_get_pkg_detail_info(const char *pkg_name,
        if (packageName.Contains(PACKAGE_NAME_PREFIX_ORG) == true)
        {
                String prefixPackage(PACKAGE_NAME_PREFIX_ORG);
-               packageName.SubString(prefixPackage.GetLength(), APPID_LENGTH, appId);
+               packageName.SubString(prefixPackage.GetLength(), PACKAGE_ID_LENGTH, appId);
        }
        else
        {
-               packageName.SubString(0, APPID_LENGTH, appId);
+               packageName.SubString(0, PACKAGE_ID_LENGTH, appId);
        }
 
        r = pkgInfoImpl.Construct(appId);
@@ -147,7 +149,7 @@ CATCH:
 static int pkg_plugin_get_pkg_detail_info_from_package(const char *pkg_path,
                package_manager_pkg_detail_info_t *pkg_detail_info)
 {
-       AppLogTag(OSP_INSTALLER, "[libtpk] pkg_plugin_get_pkg_detail_info_from_package() is called");
+       AppLog("[libtpk] pkg_plugin_get_pkg_detail_info_from_package() is called");
 
        return PKG_ERROR;
 }
@@ -186,7 +188,7 @@ long long pkg_get_directory_size(const String& rootPath)
 
                if (S_ISLNK(fileinfo.st_mode))
                {
-                       AppLogTag(OSP_INSTALLER, "[libtpk] SYMLINK=%s", fileName);
+                       AppLog("[libtpk] SYMLINK=%s", fileName);
                        total += BLOCK_SIZE;
                        continue;
                }
@@ -195,7 +197,7 @@ long long pkg_get_directory_size(const String& rootPath)
                        ret = pkg_get_directory_size(fileName);
                        ret += fileinfo.st_size;
                        total += ret;
-                       AppLogTag(OSP_INSTALLER, "[libtpk] DIR=%s, size=%d[%dK],", fileName, (int)ret, (int)(ret/1024));
+                       AppLog("[libtpk] DIR=%s, size=%d[%dK],", fileName, (int)ret, (int)(ret/1024));
                }
                else
                {
@@ -210,7 +212,7 @@ long long pkg_get_directory_size(const String& rootPath)
 
                        if (q)
                        {
-                               AppLogTag(OSP_INSTALLER, "[libtpk] File=%s, size=%d[%dK]", fileName, (q * BLOCK_SIZE), (q * BLOCK_SIZE)/1024);
+                               AppLog("[libtpk] File=%s, size=%d[%dK]", fileName, (q * BLOCK_SIZE), (q * BLOCK_SIZE)/1024);
                        }
                }
        }
index fa4a891..4cfc34d 100755 (executable)
 #include "UninstallStep.h"
 #include "UnpackStep.h"
 
-#include <FAppPkg_PackageInfoImpl.h>
-
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Io;
 using namespace Tizen::Security::Cert;
 using namespace Tizen::App;
-using namespace Tizen::App::Package;
 
 InstallationContext::InstallationContext(void)
-:__pAppDataList(null)
-,__isSubMode(false)
-,__isOspCompat(false)
-,__pStep(null)
+:__pStep(null)
 ,__pDrmLicense(null)
 ,__error(INSTALLER_ERROR_NONE)
 ,__step(INSTALLER_STEP_NONE)
@@ -50,20 +44,23 @@ InstallationContext::InstallationContext(void)
 ,__state(INSTALLER_STATE_RUNNING)
 ,__stepChanged(true)
 ,__continue(true)
-,__preloaded(false)
-,__hybridService(false)
-,__verificationMode(false)
+,__pAppDataList(null)
+,__isOspCompat(false)
+,__isPreloaded(false)
+,__isHybridService(false)
+,__isVerificationMode(false)
+,__isUpdated(false)
 ,__operation(INSTALLER_OPERATION_INSTALL)
 ,__storage(INSTALLATION_STORAGE_INTERNAL)
+,__rootCertType(ROOT_CERTIFICATE_NONE)
+,__pApp2ExtHandle(null)
 ,__pPrivilegeList(null)
+,__pStringPrivilegeList(null)
 ,__pLiveboxDataList(null)
 ,__pContentDataList(null)
 ,__pAuthorCertPath(null)
 ,__pDistributorCertPath(null)
-,__rootCertType(ROOT_CERTIFICATE_NONE)
-,__packageNameType(INSTALLER_PREFIX_TYPE_NONE)
-,__pApp2ExtHandle(null)
-,__pPackageInfoImpl(null)
+,__certType(0)
 {
 }
 
@@ -88,6 +85,13 @@ InstallationContext::~InstallationContext(void)
                __pPrivilegeList = null;
        }
 
+       if (__pStringPrivilegeList)
+       {
+               __pStringPrivilegeList->RemoveAll(true);
+               delete __pStringPrivilegeList;
+               __pStringPrivilegeList = null;
+       }
+
        if (__pLiveboxDataList)
        {
                __pLiveboxDataList->RemoveAll();
@@ -105,11 +109,8 @@ InstallationContext::~InstallationContext(void)
 InstallerError
 InstallationContext::Construct(void)
 {
-       __pPackageInfoImpl = new (std::nothrow) _PackageInfoImpl();
-       TryReturn(__pPackageInfoImpl, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pPackageInfoImpl is null.");
-
        __pAppDataList = new (std::nothrow) ArrayListT<AppData*>;
-       TryReturn(__pAppDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pAppDataList is null");
+       TryReturn(__pAppDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pAppDataList is null");
 
        return INSTALLER_ERROR_NONE;
 }
@@ -130,42 +131,42 @@ InstallationContext::ChangeStep(InstallationStep step)
 
        case INSTALLER_STEP_CHECK_SYSTEM:
                __pStep = new (std::nothrow) SystemCheckStep();
-               TryReturn(__pStep, false, "[osp-installer] SystemCheckStep is failed.");
+               TryReturn(__pStep, false, "SystemCheckStep is failed.");
                break;
 
        case INSTALLER_STEP_CHECK_PACKAGE:
                __pStep = new (std::nothrow) PackageCheckStep();
-               TryReturn(__pStep, false, "[osp-installer] PackageCheckStep is failed.");
+               TryReturn(__pStep, false, "PackageCheckStep is failed.");
                break;
 
        case INSTALLER_STEP_UNPACK:
                __pStep = new (std::nothrow) UnpackStep();
-               TryReturn(__pStep, false, "[osp-installer] UnpackStep is failed.");
+               TryReturn(__pStep, false, "UnpackStep is failed.");
                break;
 
        case INSTALLER_STEP_PARSE_MANIFEST:
                __pStep = new (std::nothrow) ManifestXmlStep();
-               TryReturn(__pStep, false, "[osp-installer] ManifestXmlStep is failed.");
+               TryReturn(__pStep, false, "ManifestXmlStep is failed.");
                break;
 
        case INSTALLER_STEP_PARSE_SIGNATURE:
                __pStep = new (std::nothrow) SignatureStep();
-               TryReturn(__pStep, false, "[osp-installer] SignatureStep is failed.");
+               TryReturn(__pStep, false, "SignatureStep is failed.");
                break;
 
        case INSTALLER_STEP_UNINSTALL:
                __pStep = new (std::nothrow) UninstallStep();
-               TryReturn(__pStep, false, "[osp-installer] UninstallStep is failed.");
+               TryReturn(__pStep, false, "UninstallStep is failed.");
                break;
 
        case INSTALLER_STEP_LICENSE:
                __pStep = new (std::nothrow) LicenseStep();
-               TryReturn(__pStep, false, "[osp-installer] LicenseStep is failed.");
+               TryReturn(__pStep, false, "LicenseStep is failed.");
                break;
 
        case INSTALLER_STEP_DRM:
                __pStep = new (std::nothrow) DrmStep();
-               TryReturn(__pStep, false, "[osp-installer] DrmStep is failed.");
+               TryReturn(__pStep, false, "DrmStep is failed.");
                break;
 
        case INSTALLER_STEP_END:
@@ -183,7 +184,7 @@ InstallerError
 InstallationContext::Run(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "InstallationContext::Run()");
+       AppLog("InstallationContext::Run()");
        return error;
 }
 
@@ -230,18 +231,6 @@ InstallationContext::GetStep(void)
 }
 
 void
-InstallationContext::SetInputPath(const Tizen::Base::String& path)
-{
-       __inputPath = path;
-}
-
-const String&
-InstallationContext::GetInputPath(void) const
-{
-       return __inputPath;
-}
-
-void
 InstallationContext::SetInstallerOperation(InstallerOperation op)
 {
        __operation = op;
@@ -265,154 +254,12 @@ InstallationContext::SetContinue(bool cont)
        __continue = cont;
 }
 
-bool
-InstallationContext::IsPreloaded(void)
-{
-       return __preloaded;
-}
-
-void
-InstallationContext::SetPreloaded(bool preloaded)
-{
-       __preloaded = preloaded;
-}
-
-bool
-InstallationContext::IsHybridService(void)
-{
-       return __hybridService;
-}
-
-void
-InstallationContext::SetHybridService(bool hybridService)
-{
-       __hybridService = hybridService;
-}
-
-bool
-InstallationContext::IsVerificationMode(void)
-{
-       return __verificationMode;
-}
-
-void
-InstallationContext::SetVerificationMode(bool verificationMode)
-{
-       __verificationMode = verificationMode;
-}
-
-const String&
-InstallationContext::GetPackagePath(void) const
-{
-       return __packagePath;
-}
-
-void
-InstallationContext::SetPackagePath(const String& packagePath)
-{
-       __packagePath = packagePath;
-}
-
-const String&
-InstallationContext::GetLicensePath(void) const
-{
-       return __licensePath;
-}
-
-void
-InstallationContext::SetLicensePath(const String& licensePath)
-{
-       __licensePath = licensePath;
-}
-
-const String&
-InstallationContext::GetTemporaryDir(void) const
-{
-       return __temporaryDir;
-}
-
-void
-InstallationContext::SetTemporaryDir(const String& temporaryDir)
-{
-       __temporaryDir = temporaryDir;
-}
-
-const String&
-InstallationContext::GetInstallDir(void) const
-{
-       return __installDir;
-}
-
-void
-InstallationContext::SetInstallDir(const String& installDir)
-{
-       __installDir = installDir;
-}
-
-const String&
-InstallationContext::GetWorkingDir(void) const
-{
-       return __workingDir;
-}
-
-void
-InstallationContext::SetWorkingDir(const String& workingDir)
-{
-       __workingDir = workingDir;
-}
-
-void
-InstallationContext::SetInstallationStorage(InstallationStorage storage)
-{
-       __storage = storage;
-}
-
-InstallationContext::InstallationStorage
-InstallationContext::GetInstallationStorage(void) const
-{
-       return __storage;
-}
-
-const PackageId&
-InstallationContext::GetId(void) const
-{
-       return __packageId;
-}
-
-void
-InstallationContext::SetId(const PackageId& packageId)
-{
-       __packageId = packageId;
-}
-
-const String&
-InstallationContext::GetAppVersion(void) const
-{
-       return __appVersion;
-}
-
-void
-InstallationContext::SetAppVersion(const String& appVersion)
-{
-       __appVersion = appVersion;
-}
-
-String
-InstallationContext::GetManifestXmlPath(void)
-{
-       String  path;
-
-       path = GetInstallDir() + PACKAGE_XML_FILE;
-
-       return path;
-}
-
 String
 InstallationContext::GetSignatureXmlPath(void)
 {
        String  path;
 
-       path = GetInstallDir() + SIGNATURE1_XML_FILE;
+       path = __installDir + SIGNATURE1_XML_FILE;
 
        return path;
 }
@@ -422,7 +269,7 @@ InstallationContext::GetAuthorSignatureXmlPath(void)
 {
        String  path;
 
-       path = GetInstallDir() + AUTHOR_SIGNATURE_XML_FILE;
+       path = __installDir + AUTHOR_SIGNATURE_XML_FILE;
 
        return path;
 }
@@ -486,45 +333,3 @@ InstallationContext::SetDistributorCertPath(X509CertificatePath* pDistributorCer
 {
        __pDistributorCertPath = pDistributorCertPath;
 }
-
-RootCertificateType
-InstallationContext::GetRootCertType(void) const
-{
-       return __rootCertType;
-}
-
-void
-InstallationContext::SetRootCertType(RootCertificateType certType)
-{
-       __rootCertType = certType;
-}
-
-int
-InstallationContext::GetPackageNameType(void) const
-{
-       return __packageNameType;
-}
-
-void
-InstallationContext::SetPackageNameType(int type)
-{
-       __packageNameType = type;
-}
-
-app2ext_handle*
-InstallationContext::GetApp2ExtHandle(void) const
-{
-       return __pApp2ExtHandle;
-}
-
-void
-InstallationContext::SetApp2ExtHandle(app2ext_handle* pHandle)
-{
-       __pApp2ExtHandle = pHandle;
-}
-
-_PackageInfoImpl*
-InstallationContext::GetPackageInfoImpl(void) const
-{
-       return __pPackageInfoImpl;
-}
index 97c609f..b55ef80 100755 (executable)
 #ifndef _INSTALLATION_CONTEXT_H_
 #define _INSTALLATION_CONTEXT_H_
 
-#include <app2ext_interface.h>
-
 #include <FAppTypes.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FSecCertX509CertificatePath.h>
 
 #include "InstallerDefs.h"
@@ -47,14 +44,9 @@ class IInstallationStep;
 class InstallationContext
 {
 public:
-       enum InstallationStorage
-       {
-               INSTALLATION_STORAGE_INTERNAL,
-               INSTALLATION_STORAGE_EXTERNAL,
-       };
-
        InstallationContext(void);
        virtual ~InstallationContext(void);
+
        InstallerError Construct(void);
 
        bool ChangeStep(InstallationStep step);
@@ -71,49 +63,12 @@ public:
 
        IInstallationStep* GetStep(void);
 
-       void SetInputPath(const Tizen::Base::String& path);
-       const Tizen::Base::String& GetInputPath(void) const;
-
        void SetInstallerOperation(InstallerOperation op);
        InstallerOperation GetInstallerOperation(void) const;
 
-       void SetInstallationStorage(InstallationStorage storage);
-       InstallationStorage GetInstallationStorage(void) const;
-
        bool IsContinue(void);
        void SetContinue(bool cont);
 
-       bool IsPreloaded(void);
-       void SetPreloaded(bool preloaded);
-
-       bool IsHybridService(void);
-       void SetHybridService(bool hybridService);
-
-       bool IsVerificationMode(void);
-       void SetVerificationMode(bool verificationMode);
-
-       const Tizen::Base::String& GetPackagePath(void) const;
-       void SetPackagePath(const Tizen::Base::String& packagePath);
-
-       const Tizen::Base::String& GetLicensePath(void) const;
-       void SetLicensePath(const Tizen::Base::String& licensePath);
-
-       const Tizen::Base::String& GetTemporaryDir(void) const;
-       void SetTemporaryDir(const Tizen::Base::String& temporaryDir);
-
-       const Tizen::Base::String& GetInstallDir(void) const;
-       void SetInstallDir(const Tizen::Base::String& installDir);
-
-       const Tizen::Base::String& GetWorkingDir(void) const;
-       void SetWorkingDir(const Tizen::Base::String& workingDir);
-
-       const Tizen::App::PackageId& GetId(void) const;
-       void SetId(const  Tizen::App::PackageId& packageId);
-
-       const Tizen::Base::String& GetAppVersion(void) const;
-       void SetAppVersion(const Tizen::Base::String& appVersion);
-
-       Tizen::Base::String GetManifestXmlPath(void);
        Tizen::Base::String GetSignatureXmlPath(void);
        Tizen::Base::String GetAuthorSignatureXmlPath(void);
 
@@ -132,25 +87,6 @@ public:
        Tizen::Security::Cert::X509CertificatePath* GetDistributorCertPath(void) const;
        void SetDistributorCertPath(Tizen::Security::Cert::X509CertificatePath* pDistributorCertPath);
 
-       RootCertificateType GetRootCertType(void) const;
-       void SetRootCertType(RootCertificateType certType);
-
-       int GetPackageNameType(void) const;
-       void SetPackageNameType(int type);
-
-       app2ext_handle* GetApp2ExtHandle(void) const;
-       void SetApp2ExtHandle(app2ext_handle* pHandle);
-
-       Tizen::App::Package::_PackageInfoImpl* GetPackageInfoImpl(void) const;
-
-       PackageData __packageData;
-       Tizen::Base::Collection::IListT<AppData *>* __pAppDataList;
-
-       bool __isSubMode;
-       Tizen::Base::String __subModeAppName;
-
-       bool  __isOspCompat;
-
 private:
        InstallationContext(const InstallationContext& value);
        InstallationContext& operator =(const InstallationContext& source);
@@ -163,34 +99,50 @@ private:
        InstallationState __state;
        bool __stepChanged;
        bool __continue;
-       bool __preloaded;
-       bool __hybridService;
-       bool __verificationMode;
 
-       Tizen::Base::String __inputPath;
+public:
+       Tizen::Base::Collection::IListT<AppData *>* __pAppDataList;
+
+       bool __isOspCompat;
+
+       bool __isPreloaded;
+       bool __isHybridService;
+       bool __isVerificationMode;
+       bool __isUpdated;
+
        InstallerOperation __operation;
        InstallationStorage __storage;
-
-       Tizen::Base::String __packagePath;
-       Tizen::Base::String __licensePath;
-       Tizen::Base::String __temporaryDir;
-       Tizen::Base::String __installDir;
-       Tizen::Base::String __workingDir;
-       Tizen::Base::String __packageId;
-       Tizen::Base::String __appVersion;
-       Tizen::Base::String __appRootPath;
+       RootCertificateType __rootCertType;
+       int __packageNameType;
+       void* __pApp2ExtHandle;
 
        Tizen::Base::Collection::ArrayList* __pPrivilegeList;
+       Tizen::Base::Collection::ArrayList* __pStringPrivilegeList;
        Tizen::Base::Collection::ArrayList* __pLiveboxDataList;
        Tizen::Base::Collection::ArrayList* __pContentDataList;
        Tizen::Security::Cert::X509CertificatePath* __pAuthorCertPath;
        Tizen::Security::Cert::X509CertificatePath* __pDistributorCertPath;
-       RootCertificateType __rootCertType;
 
-       int __packageNameType;
-       app2ext_handle* __pApp2ExtHandle;
-
-       Tizen::App::Package::_PackageInfoImpl* __pPackageInfoImpl;
+       Tizen::Base::String __coreXmlPath;
+       Tizen::Base::String __inputPath;
+       Tizen::Base::String __packagePath;
+       Tizen::Base::String __licensePath;
+       Tizen::Base::String __temporaryDir;
+       Tizen::Base::String __installDir;
+       Tizen::Base::String __workingDir;
+       Tizen::App::PackageId __packageId;
+       Tizen::Base::String __version;
+       Tizen::Base::String __rootPath;
+       Tizen::Base::String __mainAppName;
+       Tizen::Base::String __apiVersion;
+       Tizen::Base::String __displayName;
+       Tizen::Base::String __privileges;
+       Tizen::Base::String __hmacPrivileges;
+       Tizen::Base::String __author;
+       Tizen::Base::String __url;
+       Tizen::Base::String __description;
+
+       int __certType;
 
 }; // InstallationContext
 
index 23b4d1c..603fb85 100755 (executable)
@@ -26,7 +26,6 @@ using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Io;
 using namespace Tizen::Security::Cert;
-using namespace Tizen::App::Package;
 
 
 AppControlData::AppControlData()
@@ -54,16 +53,35 @@ AppControlData::~AppControlData()
 
 AccountData::AccountData()
 :__pNameList(null)
+,__pCapabilityList(null)
 {
-       __pNameList = new (std::nothrow) HashMap;
-       TryReturn(__pNameList, , "[osp-installer] __pNameList is null.");
-       __pNameList->Construct();
+
 }
 
 AccountData::~AccountData()
 {
        __pNameList->RemoveAll(true);
        delete __pNameList;
+
+       __pCapabilityList->RemoveAll();
+       delete __pCapabilityList;
+}
+
+bool
+AccountData::Construct()
+{
+       result r = E_SUCCESS;
+
+       __pNameList = new (std::nothrow) HashMap;
+       TryReturn(__pNameList, false, "__pNameList is null.");
+
+       r = __pNameList->Construct();
+       TryReturn(!IsFailed(r), false, "__pNameList->Construct() is failed.");
+
+       __pCapabilityList = new (std::nothrow) ArrayListT<String*>;
+       TryReturn(__pCapabilityList, false, "__pCapabilityList is null.");
+
+       return true;
 }
 
 
@@ -73,11 +91,11 @@ LiveboxData::LiveboxData(void)
 ,__pSizeList(null)
 {
        __pNameList = new (std::nothrow) HashMap;
-       TryReturn(__pNameList, , "[osp-installer] __pNameList is null.");
+       TryReturn(__pNameList, , "__pNameList is null.");
        __pNameList->Construct();
 
-       __pSizeList = new (std::nothrow) ArrayList;
-       TryReturn(__pSizeList, , "[osp-installer] __pSizeList is null.");
+       __pSizeList = new (std::nothrow) HashMap;
+       TryReturn(__pSizeList, , "__pSizeList is null.");
        __pSizeList->Construct();
 }
 
@@ -159,27 +177,205 @@ LiveboxData::GetNameList(void) const
 }
 
 result
-LiveboxData::AddSize(const String& size)
+LiveboxData::AddSize(String* pSize, String* pPreviewImage)
 {
        result r = E_SUCCESS;
 
-       r = __pSizeList->Add(size);
+       r = __pSizeList->Add(pSize, pPreviewImage);
 
        return r;
 }
 
-ArrayList*
+HashMap*
 LiveboxData::GetSizeList(void) const
 {
        return __pSizeList;
 }
 
 
+_AppControlResolutionInfo::_AppControlResolutionInfo(void)
+       : __pUriScheme(null)
+       , __pMimeType(null)
+{
+
+}
+
+_AppControlResolutionInfo::~_AppControlResolutionInfo(void)
+{
+               delete __pUriScheme;
+               delete __pMimeType;
+}
+
+String*
+_AppControlResolutionInfo::GetUriScheme(void) const
+{
+       return __pUriScheme;
+}
+
+result
+_AppControlResolutionInfo::SetUriScheme(String* pUriScheme)
+{
+       __pUriScheme = pUriScheme;
+       return E_SUCCESS;
+}
+
+String*
+_AppControlResolutionInfo::GetMimeType(void) const
+{
+       return __pMimeType;
+}
+
+result
+_AppControlResolutionInfo::SetMimeType(String* pMimeType)
+{
+       __pMimeType = pMimeType;
+       return E_SUCCESS;
+}
+
+_AppControlCapabilityInfo::_AppControlCapabilityInfo(void)
+       : __appControlId(0)
+       ,__pResolutionList(null)
+{
+       __pResolutionList = new (std::nothrow) ArrayList;
+       TryReturnVoidResult(__pResolutionList != null, E_OUT_OF_MEMORY, "__pResolutionList instance must not be null.");
+       __pResolutionList->Construct();
+}
+
+_AppControlCapabilityInfo::~_AppControlCapabilityInfo(void)
+{
+       __pResolutionList->RemoveAll(true);
+       delete __pResolutionList;
+}
+
+int
+_AppControlCapabilityInfo::GetAppControlId(void) const
+{
+       return __appControlId;
+}
+
+result
+_AppControlCapabilityInfo::SetAppControlId(int appControlId)
+{
+       __appControlId = appControlId;
+       return E_SUCCESS;
+}
+
+const String&
+_AppControlCapabilityInfo::GetOperationId(void) const
+{
+       return __operationId;
+}
+
+result
+_AppControlCapabilityInfo::SetOperationId(const String& operationId)
+{
+       __operationId = operationId;
+       return E_SUCCESS;
+}
+
+ArrayList*
+_AppControlCapabilityInfo::GetResolutionList(void) const
+{
+       return __pResolutionList;
+}
+
+result
+_AppControlCapabilityInfo::AddResolution(_AppControlResolutionInfo* pResolutionImpl)
+{
+       result r = E_SUCCESS;
+       r = __pResolutionList->Add(*pResolutionImpl);
+       TryReturn(!IsFailed(r), r, "__pResolutionList->Add() is failed.");
+
+       return r;
+}
+
+_AppControlInfo::_AppControlInfo(void)
+       : __pCapabilityList(null)
+{
+       __pCapabilityList = new (std::nothrow) ArrayList;
+       TryReturnVoidResult(__pCapabilityList != null, E_OUT_OF_MEMORY, "__pCapabilityList instance must not be null.");
+       __pCapabilityList->Construct();
+}
+
+_AppControlInfo::~_AppControlInfo(void)
+{
+       __pCapabilityList->RemoveAll(true);
+       delete __pCapabilityList;
+}
+
+const String&
+_AppControlInfo::GetProviderId(void) const
+{
+       return __providerId;
+}
+
+result
+_AppControlInfo::SetProviderId(const String& providerId)
+{
+       __providerId = providerId;
+       return E_SUCCESS;
+}
+
+const String&
+_AppControlInfo::GetCategory(void) const
+{
+       return __category;
+}
+
+result
+_AppControlInfo::SetCategory(const String& category)
+{
+       __category = category;
+       return E_SUCCESS;
+}
+
+ArrayList*
+_AppControlInfo::GetCapabilityList(void) const
+{
+       return __pCapabilityList;
+}
+
+result
+_AppControlInfo::AddCapability(_AppControlCapabilityInfo* pCapability)
+{
+       result r = E_SUCCESS;
+       r = __pCapabilityList->Add(*pCapability);
+       TryReturn(!IsFailed(r), r, "__pCapabilityList->Add() is failed.");
+
+       return r;
+}
+
+
+DataControlType::DataControlType(void)
+{
+
+}
+
+DataControlType::~DataControlType(void)
+{
+
+}
+
+
+DataControlInfo::DataControlInfo(void)
+       : __pControlTypeList(null)
+{
+       __pControlTypeList = new (std::nothrow) ArrayListT<DataControlType*>;
+       TryReturnVoidResult(__pControlTypeList != null, E_OUT_OF_MEMORY, "__pControlTypeList instance must not be null.");
+}
+
+DataControlInfo::~DataControlInfo(void)
+{
+       __pControlTypeList->RemoveAll();
+       delete __pControlTypeList;
+}
+
+
 ContentData::ContentData(void)
 :__pNameList(null)
 {
        __pNameList = new (std::nothrow) HashMap;
-       TryReturn(__pNameList, , "[osp-installer] __pNameList is null.");
+       TryReturn(__pNameList, , "__pNameList is null.");
        __pNameList->Construct();
 }
 
@@ -235,21 +431,126 @@ AppData::AppData()
 :__pCategoryList(null)
 ,__pAccountDataList(null)
 ,__pAppControlDataList(null)
+,__pAppControlImplList(null)
+,__pDataControlList(null)
+,__pSubModeAppControlDataList(null)
+,__pNameList(null)
+,__pFeatureList(null)
+,__pLaunchConditionList(null)
+,__pNotificationMap(null)
+,__feature(0)
+,__isSubMode(false)
 ,__legacyAppControls(false)
+,__isSystemService(false)
+,__mainmenuVisible(false)
 {
-       __pCategoryList = new (std::nothrow) ArrayListT<String*>;
-       __pAccountDataList = new (std::nothrow) ArrayListT<AccountData*>;
-       __pAppControlDataList = new (std::nothrow) ArrayListT<AppControlData*>;
 }
 
 AppData::~AppData()
 {
-       __pCategoryList->RemoveAll();
-       delete __pCategoryList;
+       if (__pCategoryList)
+       {
+               __pCategoryList->RemoveAll();
+               delete __pCategoryList;
+       }
+
+       if (__pAccountDataList)
+       {
+               __pAccountDataList->RemoveAll();
+               delete __pAccountDataList;
+       }
+
+       if (__pAppControlDataList)
+       {
+               __pAppControlDataList->RemoveAll();
+               delete __pAppControlDataList;
+       }
+
+       if (__pAppControlImplList)
+       {
+               __pAppControlImplList->RemoveAll();
+               delete __pAppControlImplList;
+       }
+
+       if (__pDataControlList)
+       {
+               __pDataControlList->RemoveAll();
+               delete __pDataControlList;
+       }
+
+       if (__pSubModeAppControlDataList)
+       {
+               __pSubModeAppControlDataList->RemoveAll();
+               delete __pSubModeAppControlDataList;
+       }
+
+       if (__pNameList)
+       {
+               __pNameList->RemoveAll();
+               delete __pNameList;
+       }
+
+       if (__pFeatureList)
+       {
+               __pFeatureList->RemoveAll();
+               delete __pFeatureList;
+       }
+
+       if (__pLaunchConditionList)
+       {
+               __pLaunchConditionList->RemoveAll();
+               delete __pLaunchConditionList;
+       }
+
+       if (__pNotificationMap)
+       {
+               __pNotificationMap->RemoveAll();
+               delete __pNotificationMap;
+       }
+}
+
+InstallerError
+AppData::Construct(void)
+{
+       result r = E_SUCCESS;
+
+       __pCategoryList = new (std::nothrow) ArrayListT<String*>;
+       TryReturn(__pCategoryList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pCategoryList is null.");
+
+       __pAccountDataList = new (std::nothrow) ArrayListT<AccountData*>;
+       TryReturn(__pAccountDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pAccountDataList is null.");
+
+       __pAppControlDataList = new (std::nothrow) ArrayListT<AppControlData*>;
+       TryReturn(__pAppControlDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pAppControlDataList is null.");
+
+       __pAppControlImplList = new (std::nothrow) ArrayListT<_AppControlInfo*>;
+       TryReturn(__pAppControlImplList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pAppControlImplList is null.");
+
+       __pDataControlList = new (std::nothrow) ArrayListT<DataControlInfo*>;
+       TryReturn(__pDataControlList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pDataControlList is null.");
+
+       __pSubModeAppControlDataList = new (std::nothrow) ArrayListT<AppControlData*>;
+       TryReturn(__pSubModeAppControlDataList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pSubModeAppControlDataList is null.");
+
+       __pNameList = new (std::nothrow) HashMap(SingleObjectDeleter);
+       TryReturn(__pNameList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pNameList is null.");
+       r = __pNameList->Construct();
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pNameList->Construct() failed.");
+
+       __pFeatureList = new (std::nothrow) HashMap(SingleObjectDeleter);
+       TryReturn(__pFeatureList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pFeatureList is null.");
+       r = __pFeatureList->Construct();
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pFeatureList->Construct() failed.");
+
+       __pLaunchConditionList = new (std::nothrow) HashMap(SingleObjectDeleter);
+       TryReturn(__pLaunchConditionList, INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList is null.");
+       r = __pLaunchConditionList->Construct();
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pLaunchConditionList->Construct() failed.");
 
-       __pAccountDataList->RemoveAll();
-       delete __pAccountDataList;
+       __pNotificationMap = new (std::nothrow) HashMap(SingleObjectDeleter);
+       TryReturn(__pNotificationMap, INSTALLER_ERROR_OUT_OF_MEMORY, "__pNotificationMap is null.");
+       r = __pNotificationMap->Construct();
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_OUT_OF_MEMORY, "__pNotificationMap->Construct() failed.");
 
-       __pAppControlDataList->RemoveAll();
-       delete __pAppControlDataList;
+       return INSTALLER_ERROR_NONE;
 }
index e118ae4..5e5dbf9 100755 (executable)
@@ -23,7 +23,6 @@
 #ifndef _INSTALLATION_CONTEXT_DATA_H_
 #define _INSTALLATION_CONTEXT_DATA_H_
 
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FSecCertX509CertificatePath.h>
 
 #include "InstallerDefs.h"
@@ -50,10 +49,10 @@ public:
        result AddName(const Tizen::Base::String& language, const Tizen::Base::String& name);
        Tizen::Base::Collection::HashMap* GetNameList(void) const;
 
-       result AddSize(const Tizen::Base::String& size);
-       Tizen::Base::Collection::ArrayList* GetSizeList(void) const;
+       result AddSize(Tizen::Base::String* pSize, Tizen::Base::String* pPreviewImage);
+       Tizen::Base::Collection::HashMap* GetSizeList(void) const;
 
-       Tizen::Base::String __main;
+       Tizen::Base::String __default;
        Tizen::Base::String __configurationAppControlAppId;
 
 private:
@@ -66,7 +65,7 @@ private:
        Tizen::Base::String __providerName;
 
        Tizen::Base::Collection::HashMap* __pNameList;
-       Tizen::Base::Collection::ArrayList* __pSizeList;
+       Tizen::Base::Collection::HashMap* __pSizeList;
 
 };
 
@@ -77,12 +76,14 @@ class AccountData
 public:
        AccountData();
        virtual ~AccountData();
+       bool Construct();
 
        Tizen::Base::String __providerId;
        Tizen::Base::String __multipleAccountsSupport;
        Tizen::Base::String __accountIcon;
        Tizen::Base::String __accountSmallIcon;
        Tizen::Base::Collection::HashMap* __pNameList;
+       Tizen::Base::Collection::IListT<Tizen::Base::String*>* __pCapabilityList;
 };
 
 
@@ -99,6 +100,117 @@ public:
 };
 
 
+class _AppControlResolutionInfo
+       : public Tizen::Base::Object
+{
+public:
+       _AppControlResolutionInfo(void);
+       virtual ~_AppControlResolutionInfo(void);
+
+       Tizen::Base::String* GetUriScheme(void) const;
+       result SetUriScheme(Tizen::Base::String* pUriScheme);
+
+       Tizen::Base::String* GetMimeType(void) const;
+       result SetMimeType(Tizen::Base::String* pMimeType);
+
+private:
+       _AppControlResolutionInfo(const _AppControlResolutionInfo& value);
+       _AppControlResolutionInfo& operator =(const _AppControlResolutionInfo& source);
+
+       Tizen::Base::String* __pUriScheme;
+       Tizen::Base::String* __pMimeType;
+
+};
+
+
+class _AppControlCapabilityInfo
+       : public Tizen::Base::Object
+{
+public:
+       _AppControlCapabilityInfo(void);
+       virtual ~_AppControlCapabilityInfo(void);
+
+       int GetAppControlId(void) const;
+       result SetAppControlId(int uniqueId);
+
+       const Tizen::Base::String& GetOperationId(void) const;
+       result SetOperationId(const Tizen::Base::String& operationId);
+
+       Tizen::Base::Collection::ArrayList* GetResolutionList(void) const;
+       result AddResolution(_AppControlResolutionInfo* pResolution);
+
+private:
+       _AppControlCapabilityInfo(const _AppControlCapabilityInfo& value);
+       _AppControlCapabilityInfo& operator =(const _AppControlCapabilityInfo& source);
+
+       int __appControlId;
+       Tizen::Base::String __operationId;
+       Tizen::Base::Collection::ArrayList* __pResolutionList;
+
+};
+
+
+class _AppControlInfo
+       : public Tizen::Base::Object
+{
+public:
+       _AppControlInfo(void);
+       virtual ~_AppControlInfo(void);
+
+       const Tizen::Base::String& GetProviderId(void) const;
+       result SetProviderId(const Tizen::Base::String& providerId);
+
+       const Tizen::Base::String& GetCategory(void) const;
+       result SetCategory(const Tizen::Base::String& category);
+
+       Tizen::Base::Collection::ArrayList* GetCapabilityList(void) const;
+       result AddCapability(_AppControlCapabilityInfo* pCapability);
+
+private:
+       _AppControlInfo(const _AppControlInfo& value);
+       _AppControlInfo& operator =(const _AppControlInfo& source);
+
+       Tizen::Base::String __providerId;
+       Tizen::Base::String __category;
+       Tizen::Base::Collection::ArrayList* __pCapabilityList;
+
+};
+
+
+class DataControlType
+       : public Tizen::Base::Object
+{
+public:
+               DataControlType(void);
+       virtual ~DataControlType(void);
+
+       Tizen::Base::String __type;
+       Tizen::Base::String __access;
+
+private:
+       DataControlType(const DataControlType& value);
+       DataControlType& operator =(const DataControlType& source);
+
+};
+
+
+class DataControlInfo
+       : public Tizen::Base::Object
+{
+public:
+               DataControlInfo(void);
+       virtual ~DataControlInfo(void);
+
+       Tizen::Base::String __providerId;
+       Tizen::Base::Collection::IListT<DataControlType*>* __pControlTypeList;
+
+private:
+       DataControlInfo(const DataControlInfo& value);
+       DataControlInfo& operator =(const DataControlInfo& source);
+
+};
+
+
 class ContentData
        : public Tizen::Base::Object
 {
@@ -133,25 +245,40 @@ class AppData
 public:
        AppData();
        virtual ~AppData();
+       InstallerError Construct(void);
+
+       Tizen::Base::String __main;
+       Tizen::Base::String __name;
+       Tizen::Base::String __appId;
+       Tizen::Base::String __displayName;
+       Tizen::Base::String __mainmenuIcon;
+       Tizen::Base::String __settingIcon;
+       Tizen::Base::String __notificationIcon;
+       Tizen::Base::String __type;
+       Tizen::Base::String __subModeAppName;
+       Tizen::Base::String __launchingHistoryVisible;
+       Tizen::Base::String __permissionType;
 
-       Tizen::Base::String name;
        Tizen::Base::Collection::IListT<Tizen::Base::String*>* __pCategoryList;
        Tizen::Base::Collection::IListT<AccountData*>* __pAccountDataList;
        Tizen::Base::Collection::IListT<AppControlData*>* __pAppControlDataList;
+       Tizen::Base::Collection::IListT<_AppControlInfo*>* __pAppControlImplList;
+       Tizen::Base::Collection::IListT<DataControlInfo*>* __pDataControlList;
+       Tizen::Base::Collection::IListT<AppControlData*>* __pSubModeAppControlDataList;
 
-       bool __legacyAppControls;
+       Tizen::Base::Collection::HashMap* __pNameList;
+       Tizen::Base::Collection::HashMap* __pFeatureList;
+       Tizen::Base::Collection::HashMap* __pLaunchConditionList;
+       Tizen::Base::Collection::HashMap* __pNotificationMap;
 
-private:
-};
+       int __feature;
 
+       bool __isSubMode;
+       bool __legacyAppControls;
+       bool __isSystemService;
+       bool __mainmenuVisible;
 
-class PackageData
-       : public Tizen::Base::Object
-{
-public:
-       PackageData(){};
-       virtual ~PackageData(){};
+private:
 };
 
-
 #endif // _INSTALLATION_CONTEXT_DATA_H_
index 6c3b347..b1626e9 100755 (executable)
 #include <FIoFile.h>
 #include <FIoDirectory.h>
 #include <FIo_FileImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 
 #include "DirectoryInstaller.h"
 #include "InstallerUtil.h"
 
-using namespace Tizen::App::Package;
 using namespace Tizen::Base;
 using namespace Tizen::Io;
 
@@ -48,14 +46,14 @@ DirectoryInstaller::GetNext(InstallationStep step)
        }
        else if (step == INSTALLER_STEP_INIT)
        {
-               return INSTALLER_STEP_CHECK_SYSTEM;
-       }
-       else if (step == INSTALLER_STEP_CHECK_SYSTEM)
-       {
                return INSTALLER_STEP_PARSE_MANIFEST;
        }
        else if (step == INSTALLER_STEP_PARSE_MANIFEST)
        {
+               return INSTALLER_STEP_CHECK_SYSTEM;
+       }
+       else if (step == INSTALLER_STEP_CHECK_SYSTEM)
+       {
                return INSTALLER_STEP_PARSE_SIGNATURE;
        }
        else if (step == INSTALLER_STEP_PARSE_SIGNATURE)
@@ -72,23 +70,18 @@ DirectoryInstaller::GetNext(InstallationStep step)
 InstallerError
 DirectoryInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnInit()");
-
        InstallationContext* pContext = GetContext();
-       String installPath = pContext->GetInstallDir();
+       String installPath = pContext->__installDir;
 
        String newInstallPath;
        InstallerUtil::CreateSymlinkForAppDirectory(installPath, newInstallPath);
-       pContext->SetInstallDir(newInstallPath);
-
-       _PackageInfoImpl *pPackageInfoImpl = null;
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       pPackageInfoImpl->SetAppRootPath(newInstallPath);
+       pContext->__installDir = newInstallPath;
+       pContext->__rootPath = newInstallPath;
 
        // remove in /info/*.info files
        RemoveInfoFiles();
 
-       AppLogTag(OSP_INSTALLER, "installation path = [%ls]", newInstallPath.GetPointer());
+       AppLog("installation path = [%ls]", newInstallPath.GetPointer());
 
        return Installer::OnInit();
 }
@@ -96,35 +89,35 @@ DirectoryInstaller::OnInit(void)
 InstallerError
 DirectoryInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnRegister()");
+       AppLog("DirectoryInstaller::OnRegister()");
        return Installer::OnRegister();
 }
 
 InstallerError
 DirectoryInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnEnd()");
+       AppLog("DirectoryInstaller::OnEnd()");
        return Installer::OnEnd();
 }
 
 InstallerError
 DirectoryInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnError()");
+       AppLog("DirectoryInstaller::OnError()");
        return Installer::OnError();
 }
 
 InstallerError
 DirectoryInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnRollback()");
+       AppLog("DirectoryInstaller::OnRollback()");
        return Installer::OnRollback();
 }
 
 InstallerError
 DirectoryInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "DirectoryInstaller::OnUserCancel()");
+       AppLog("DirectoryInstaller::OnUserCancel()");
        return Installer::OnUserCancel();
 }
 
@@ -137,26 +130,21 @@ DirectoryInstaller::RemoveInfoFiles(void)
        int res = false;
        String appid;
        String path;
-
-       _PackageInfoImpl* pPackageInfoImpl = null;
        InstallationContext* pContext = null;
 
        pContext = GetContext();
-       TryCatch(pContext, res = false, "[osp-installer] pContext is null");
-
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryCatch(pPackageInfoImpl, res = false, "[osp-installer] pPackageInfoImpl is null");
+       TryCatch(pContext, res = false, "pContext is null");
 
-       path = pPackageInfoImpl->GetAppRootPath() + DIR_INFO;
+       path = pContext->__rootPath + DIR_INFO;
 
        pDir = new (std::nothrow) Directory; // Allocate %Directory instance
-       TryCatch(pDir, res = false, "[osp-installer] pDir is null");
+       TryCatch(pDir, res = false, "pDir is null");
 
        r = pDir->Construct(path);
-       TryCatch(!IsFailed(r), res = false, "[osp-installer] pDir->Construct() failed, path = [%ls]", path.GetPointer());
+       TryCatch(!IsFailed(r), res = false, "pDir->Construct() failed, path = [%ls]", path.GetPointer());
 
        pDirEnum = pDir->ReadN();
-       TryCatch(pDirEnum, res = false, "[osp-installer] pDirEnum is null");
+       TryCatch(pDirEnum, res = false, "pDirEnum is null");
 
        while (pDirEnum->MoveNext() == E_SUCCESS)
        {
@@ -175,7 +163,7 @@ DirectoryInstaller::RemoveInfoFiles(void)
                // check *.info file
                if (_FileImpl::GetFileExtension(entryDir) == FILE_EXT_INFO)
                {
-                       AppLogTag(OSP_INSTALLER, "Request to delete info file = [%ls]\n", entryDir.GetPointer());
+                       AppLog("Request to delete info file = [%ls]", entryDir.GetPointer());
                        InstallerUtil::Remove(entryDir);
                }
        }
index 7483f45..aa287d5 100755 (executable)
@@ -32,48 +32,44 @@ GuestInstaller::~GuestInstaller(void)
 InstallationStep
 GuestInstaller::GetNext(InstallationStep step)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::GetNext()");
        return PackageInstaller::GetNext(step);
 }
 
 InstallerError
 GuestInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnInit()");
        return PackageInstaller::OnInit();
 }
 
 InstallerError
 GuestInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnRegister()");
        return PackageInstaller::OnRegister();
 }
 
 InstallerError
 GuestInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnEnd()");
        return PackageInstaller::OnEnd();
 }
 
 InstallerError
 GuestInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnError()");
+       AppLog("GuestInstaller::OnError()");
        return PackageInstaller::OnError();
 }
 
 InstallerError
 GuestInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnRollback()");
+       AppLog("GuestInstaller::OnRollback()");
        return PackageInstaller::OnRollback();
 }
 
 InstallerError
 GuestInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "GuestInstaller::OnUserCancel()");
+       AppLog("GuestInstaller::OnUserCancel()");
        return PackageInstaller::OnUserCancel();
 }
index 9cbd8fe..b3afcf9 100755 (executable)
@@ -32,48 +32,44 @@ IDEInstaller::~IDEInstaller(void)
 InstallationStep
 IDEInstaller::GetNext(InstallationStep step)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::GetNext()");
        return DirectoryInstaller::GetNext(step);
 }
 
 InstallerError
 IDEInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnInit()");
        return DirectoryInstaller::OnInit();
 }
 
 InstallerError
 IDEInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnRegister()");
        return DirectoryInstaller::OnRegister();
 }
 
 InstallerError
 IDEInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnEnd()");
        return DirectoryInstaller::OnEnd();
 }
 
 InstallerError
 IDEInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnError()");
+       AppLog("IDEInstaller::OnError()");
        return DirectoryInstaller::OnError();
 }
 
 InstallerError
 IDEInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnUserCancel()");
+       AppLog("IDEInstaller::OnUserCancel()");
        return DirectoryInstaller::OnUserCancel();
 }
 
 InstallerError
 IDEInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "IDEInstaller::OnRollback()");
+       AppLog("IDEInstaller::OnRollback()");
        return DirectoryInstaller::OnRollback();
 }
index fb10659..53a561e 100755 (executable)
 
 #include <FIoFile.h>
 #include <FIoDirectory.h>
-#include <FAppPkg_PackageInfoImpl.h>
-#include <FAppPkg_PackageManagerImpl.h>
 
 #include "Installer.h"
 #include "PermissionManager.h"
 #include "ConfigurationManager.h"
+#include "DatabaseManager.h"
 #include "InstallerUtil.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
 Installer::Installer(void)
@@ -93,7 +91,7 @@ Installer::GetNext(InstallationStep step)
 InstallerError
 Installer::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "Installer::OnInit()");
+       AppLog("Installer::OnInit()");
 
        return INSTALLER_ERROR_NONE;
 }
@@ -101,28 +99,26 @@ Installer::OnInit(void)
 InstallerError
 Installer::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "Installer::OnRegister() - START");
+       AppLog("------------------------------------------");
+       AppLog("Installer::OnRegister() - START");
        InstallationContext* pContext = GetContext();
-       TryReturn(pContext, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null");
+       TryReturn(pContext, INSTALLER_ERROR_INTERNAL_STATE, "pContext is null");
 
        InstallerOperation operation = pContext->GetInstallerOperation();
 
-       _PackageManagerImpl *pManagerImpl = null;
-       pManagerImpl = pManagerImpl->GetInstance();
-       TryReturn(pManagerImpl, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pManagerImpl is null");
+       DatabaseManager databaseManager;
 
        if (operation == INSTALLER_OPERATION_INSTALL)
        {
-               pManagerImpl->UnregisterPackageInfo(pContext->GetId());
-               pManagerImpl->RegisterPackageInfo(*pContext->GetPackageInfoImpl());
+               databaseManager.UnregisterPackageInfo(pContext);
+               databaseManager.RegisterPackageInfo(pContext);
        }
        else
        {
-               pManagerImpl->UnregisterPackageInfo(pContext->GetId());
+               databaseManager.UnregisterPackageInfo(pContext);
        }
-       AppLogTag(OSP_INSTALLER, "Installer::OnRegister() - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("Installer::OnRegister() - END");
+       AppLog("------------------------------------------");
 
        return INSTALLER_ERROR_NONE;
 }
@@ -130,10 +126,11 @@ Installer::OnRegister(void)
 InstallerError
 Installer::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "Installer::OnEnd() - START");
+       AppLog("------------------------------------------");
+       AppLog("Installer::OnEnd() - START");
+       bool res = true;
        InstallationContext* pContext = GetContext();
-       TryReturn(pContext, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null");
+       TryReturn(pContext, INSTALLER_ERROR_INTERNAL_STATE, "pContext is null");
 
        InstallerOperation operation = pContext->GetInstallerOperation();
        ConfigurationManager configurationManager;
@@ -142,13 +139,23 @@ Installer::OnEnd(void)
 
        if (operation == INSTALLER_OPERATION_INSTALL)
        {
-               PermissionManager::SetDirectory(pContext);
-               PermissionManager::SetFile(pContext);
+               res = configurationManager.CreateFile(pContext);
+               TryReturn(res, INSTALLER_ERROR_INTERNAL_STATE, "CreateFile() failed.");
 
-               configurationManager.CreateFile(pContext);
-               configurationManager.UnregisterCertInfo(pContext);
-               configurationManager.RegisterCertInfo(pContext);
-               configurationManager.PostInstall(pContext, false);
+               res = PermissionManager::SetDirectory(pContext);
+               TryReturn(res, INSTALLER_ERROR_INTERNAL_STATE, "SetDirectory() failed.");
+
+               res = PermissionManager::SetFile(pContext);
+               TryReturn(res, INSTALLER_ERROR_INTERNAL_STATE, "SetFile() failed.");
+
+               res = configurationManager.PostInstall(pContext, false);
+               TryReturn(res, INSTALLER_ERROR_INTERNAL_STATE, "PostInstall() failed.");
+
+               res = configurationManager.UnregisterCertInfo(pContext);
+               TryReturn(res, INSTALLER_ERROR_DATABASE, "UnregisterCertInfo() failed.");
+
+               res = configurationManager.RegisterCertInfo(pContext);
+               TryReturn(res, INSTALLER_ERROR_DATABASE, "RegisterCertInfo() failed.");
        }
        else if (operation == INSTALLER_OPERATION_UNINSTALL)
        {
@@ -157,8 +164,8 @@ Installer::OnEnd(void)
                configurationManager.PostUninstall(pContext);
        }
 
-       AppLogTag(OSP_INSTALLER, "Installer::OnEnd() - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("Installer::OnEnd() - END");
+       AppLog("------------------------------------------");
 
        return INSTALLER_ERROR_NONE;
 }
@@ -166,7 +173,7 @@ Installer::OnEnd(void)
 InstallerError
 Installer::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "Installer::OnError()");
+       AppLog("Installer::OnError()");
 
        InstallerOperation operation = __pContext->GetInstallerOperation();
        ConfigurationManager configurationManager;
@@ -186,14 +193,14 @@ Installer::OnError(void)
 InstallerError
 Installer::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "Installer::OnRollback()");
+       AppLog("Installer::OnRollback()");
        return INSTALLER_ERROR_NONE;
 }
 
 InstallerError
 Installer::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "Installer::OnUserCancel()");
+       AppLog("Installer::OnUserCancel()");
        return INSTALLER_ERROR_NONE;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index 54317c1..1796bb2
@@ -43,29 +43,25 @@ PackageInstaller::GetNext(InstallationStep step)
 InstallerError
 PackageInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnInit()");
        return Installer::OnInit();
 }
 
 InstallerError
 PackageInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnRegister()");
        return Installer::OnRegister();
 }
 
 InstallerError
 PackageInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnEnd()");
-
        return Installer::OnEnd();
 }
 
 InstallerError
 PackageInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnError()");
+       AppLog("PackageInstaller::OnError()");
 
        return Installer::OnError();
 }
@@ -73,13 +69,13 @@ PackageInstaller::OnError(void)
 InstallerError
 PackageInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnRollback()");
+       AppLog("PackageInstaller::OnRollback()");
        return Installer::OnRollback();
 }
 
 InstallerError
 PackageInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "PackageInstaller::OnUserCancel()");
+       AppLog("PackageInstaller::OnUserCancel()");
        return Installer::OnUserCancel();
 }
index 948c8a5..9b11de8 100755 (executable)
@@ -40,45 +40,43 @@ PreloadedInstaller::~PreloadedInstaller(void)
 InstallationStep
 PreloadedInstaller::GetNext(InstallationStep step)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::GetNext()");
        return DirectoryInstaller::GetNext(step);
 }
 
 InstallerError
 PreloadedInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnInit()");
-
        InstallationContext* pContext = GetContext();
-       String path = pContext->GetInputPath();
+       String path = pContext->__inputPath;
 
        String appId;
        String prefix(PATH_USR_APPS);
        prefix += L"/";
 
-       path.SubString(prefix.GetLength(), APPID_LENGTH, appId);
+       path.SubString(prefix.GetLength(), PACKAGE_ID_LENGTH, appId);
 
        String destRootPath(PATH_OPT_USR_APPS);
        destRootPath += L"/";
        destRootPath += appId;
 
-       InstallerUtil::Remove(destRootPath);
        Directory::Create(destRootPath);
 
        String srcPath;
        String destPath;
 
+       // /setting
+       srcPath = path + DIR_SETTING;
+       destPath = destRootPath + DIR_SETTING;
+       InstallerUtil::CopyDirectory(srcPath, destPath);
+
        // /data
        srcPath = path + DIR_DATA;
        destPath = destRootPath + DIR_DATA;
        InstallerUtil::CopyDirectory(srcPath, destPath);
 
-       // /info
        srcPath = path + DIR_INFO;
        destPath = destRootPath + DIR_INFO;
-       InstallerUtil::CopyDirectory(srcPath, destPath);
-
-       // appRoot - signature
+       InstallerUtil::CreateSymlink(srcPath, destPath);
 
        srcPath = path + DIR_BIN;
        destPath = destRootPath + DIR_BIN;
@@ -111,11 +109,7 @@ PreloadedInstaller::OnInit(void)
                InstallerUtil::CreateSymlink(srcPath, destPath);
        }
 
-       srcPath = path + DIR_SETTING;
-       destPath = destRootPath + DIR_SETTING;
-       InstallerUtil::CreateSymlink(srcPath, destPath);
-
-       pContext->SetInstallDir(destRootPath);
+       pContext->__installDir = destRootPath;
 
        return DirectoryInstaller::OnInit();
 }
@@ -123,34 +117,32 @@ PreloadedInstaller::OnInit(void)
 InstallerError
 PreloadedInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnRegister()");
        return DirectoryInstaller::OnRegister();
 }
 
 InstallerError
 PreloadedInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnEnd()");
        return DirectoryInstaller::OnEnd();
 }
 
 InstallerError
 PreloadedInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnError()");
+       AppLog("PreloadedInstaller::OnError()");
        return DirectoryInstaller::OnError();
 }
 
 InstallerError
 PreloadedInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnRollback()");
+       AppLog("PreloadedInstaller::OnRollback()");
        return DirectoryInstaller::OnRollback();
 }
 
 InstallerError
 PreloadedInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "PreloadedInstaller::OnUserCancel()");
+       AppLog("PreloadedInstaller::OnUserCancel()");
        return DirectoryInstaller::OnUserCancel();
 }
index 26ce8e6..8630922 100755 (executable)
@@ -32,48 +32,44 @@ RestorationInstaller::~RestorationInstaller(void)
 InstallationStep
 RestorationInstaller::GetNext(InstallationStep step)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::GetNext()");
        return DirectoryInstaller::GetNext(step);
 }
 
 InstallerError
 RestorationInstaller::OnInit(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnInit()");
        return DirectoryInstaller::OnInit();
 }
 
 InstallerError
 RestorationInstaller::OnRegister(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnRegister()");
        return DirectoryInstaller::OnRegister();
 }
 
 InstallerError
 RestorationInstaller::OnEnd(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnEnd()");
        return DirectoryInstaller::OnEnd();
 }
 
 InstallerError
 RestorationInstaller::OnError(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnError()");
+       AppLog("RestorationInstaller::OnError()");
        return DirectoryInstaller::OnError();
 }
 
 InstallerError
 RestorationInstaller::OnRollback(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnRollback()");
+       AppLog("RestorationInstaller::OnRollback()");
        return DirectoryInstaller::OnRollback();
 }
 
 InstallerError
 RestorationInstaller::OnUserCancel(void)
 {
-       AppLogTag(OSP_INSTALLER, "RestorationInstaller::OnUserCancel()");
+       AppLog("RestorationInstaller::OnUserCancel()");
        return DirectoryInstaller::OnUserCancel();
 }
index b29dd49..296a8b3 100755 (executable)
 
 #include <pkgmgr_parser.h>
 #include <pkgmgr_installer.h>
+#include <app2ext_interface.h>
 
 #include <FBaseUtilStringUtil.h>
 #include <FIoFile.h>
 #include <FIoDirectory.h>
 #include <FSecCertX509CertificatePath.h>
 #include <FApp_Aul.h>
-#include <FAppPkg_PackageInfoImpl.h>
-#include <FAppPkg_PackageManagerImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ConfigurationManager.h"
 #include "ManifestGenerator.h"
 #include "InstallerUtil.h"
+#include "SmackManager.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
 using namespace Tizen::Security::Cert;
 using namespace Tizen::App;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
 ConfigurationManager::ConfigurationManager(void)
@@ -59,30 +58,20 @@ ConfigurationManager::~ConfigurationManager(void)
 bool
 ConfigurationManager::CreateFile(InstallationContext* pContext)
 {
-       bool res = false;
-       const char* pBinaryPath = null;
-       String xmlPath;
-       char* pXmlPath = null;
        int err = 0;
-       bool hybridService = pContext->IsHybridService();
-       ArrayList* pContentDataList = null;
-
-       _PackageInfoImpl *pPackageInfoImpl = null;
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
 
        String rootPath;
-       rootPath = pPackageInfoImpl->GetAppRootPath();
+       rootPath = pContext->__rootPath;
 
        String apiVersion;
-       apiVersion = pPackageInfoImpl->GetAppApiVersion();
+       apiVersion = pContext->__apiVersion;
        String versionInfoFile;
        versionInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), VERSION_INFO_FILE);
        CreateInfoFile(versionInfoFile, &apiVersion);
 
        if (pContext->__isOspCompat == true)
        {
-               AppLogTag(OSP_INSTALLER, "[OspCompat] is detected");
+               AppLog("[OspCompat] is detected");
 
                String compatInfoFile;
                compatInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), COMPAT_INFO_FILE);
@@ -92,148 +81,123 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
        String webServicePrivilege(TIZEN_PRIVILEGE_WEB_SERVICE);
        if (FindPrivilege(pContext, webServicePrivilege) == true)
        {
-               AppLogTag(OSP_INSTALLER, "WEB_SERVICE privilege is detected. rootPath=[%ls]", rootPath.GetPointer());
+               AppLog("WEB_SERVICE privilege is detected. rootPath=[%ls]", rootPath.GetPointer());
 
                String webServiceInfoFile;
                webServiceInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), WEBSERVICE_INFO_FILE);
                CreateInfoFile(webServiceInfoFile, null);
        }
 
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
-       pAppList = pPackageInfoImpl->GetAppInfoList();
-       for (int i = 0 ; i < pAppList->GetCount(); i++)
-       {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
-               {
-                       result r = E_SUCCESS;
-
-                       String appName;
-                       appName = pAppInfoImpl->GetName();
+       IListT<AppData*>* pAppDataList = pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "pAppDataList is null");
 
-                       String appType;
-                       appType = pAppInfoImpl->GetType();
+       for (int i = 0 ; i < pAppDataList->GetCount(); i++)
+       {
+               AppData* pAppData = null;
+               pAppDataList->GetAt(i, pAppData);
+               TryReturn(pAppData, false, "pAppData is null");
 
-                       String packageName;
-                       packageName = pAppInfoImpl->GetPackageName();
+               String appName = pAppData->__name;
+               String appType = pAppData->__type;
+               AppId appId = pAppData->__appId;
 
-                       String binaryPath;
-                       binaryPath.Format(1024, L"%ls%ls/%ls", rootPath.GetPointer(), DIR_BIN, appName.GetPointer());
+               String binaryPath;
+               binaryPath.Format(1024, L"%ls%ls/%ls", rootPath.GetPointer(), DIR_BIN, appName.GetPointer());
 
-                       String tempBinaryPath;
-                       tempBinaryPath.Format(1024, L"%ls%ls/.%ls", rootPath.GetPointer(), DIR_BIN, appName.GetPointer());
+               if (File::IsFileExist(binaryPath) == true)
+               {
+                       InstallerUtil::Remove(binaryPath);
+               }
 
-                       pBinaryPath = _StringConverter::CopyToCharArrayN(binaryPath);
-                       TryCatch(pBinaryPath, res = false, "[osp-installer] pBinaryPath is null");
+               if (appType == L"UiApp")
+               {
+                       //err = symlink(UIAPP_LOADER_PATH, pBinaryPath);
 
-                       if (File::IsFileExist(binaryPath) == true)
-                       {
-                               InstallerUtil::Remove(binaryPath);
-                       }
+                       AppLog("copy ui app loader");
+                       InstallerUtil::Copy(UIAPP_LOADER_PATH, binaryPath);
 
-                       if (appType == L"UiApp")
-                       {
-                               //err = symlink(UIAPP_LOADER_PATH, pBinaryPath);
+                       HashMap* pFeatureList = pAppData->__pFeatureList;
+                       TryReturn(pFeatureList, false, "pFeatureList is null");
 
-                               //r = File::Copy(UIAPP_LOADER_PATH, pBinaryPath, false);
-                               //TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed[%s], filePath=[%s]", GetErrorMessage(r), pBinaryPath);
+                       String coordinateSystem;
+                       String baseScreenSize;
+                       String logicalCoordinate;
 
-                               InstallerUtil::Copy(UIAPP_LOADER_PATH, binaryPath);
-                               InstallerUtil::Copy(UIAPP_LOADER_PATH, tempBinaryPath);
+                       std::unique_ptr< IMapEnumerator > pEnum(pFeatureList->GetMapEnumeratorN());
+                       TryReturn(pEnum, false, "GetMapEnumeratorN() failed. [%s]", GetErrorMessage(GetLastResult()));
 
-                               ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
-                               TryCatch(pFeatureList, res = false, "[osp-installer] pFeatureList is null");
+                       while (pEnum->MoveNext() == E_SUCCESS)
+                       {
+                               String* pKey = static_cast< String* > (pEnum->GetKey());
+                               TryReturn(pEnum, false, "GetKey() failed. [%s]", GetErrorMessage(GetLastResult()));
 
-                               String coordinateSystem;
-                               String baseScreenSize;
-                               String logicalCoordinate;
+                               String* pValue = static_cast< String* > (pEnum->GetValue());
+                               TryReturn(pEnum, false, "GetValue() failed. [%s]", GetErrorMessage(GetLastResult()));
 
-                               for (int j = 0; j < pFeatureList->GetCount(); j++)
+                               if ((*pKey) == L"CoordinateSystem")
                                {
-                                       _AppFeatureInfoImpl* pAppFeature = dynamic_cast<_AppFeatureInfoImpl*>(pFeatureList->GetAt(j));
-
-                                       if (pAppFeature != null)
-                                       {
-                                               if (pAppFeature->GetName() == L"CoordinateSystem")
-                                               {
-                                                       coordinateSystem = pAppFeature->GetValue();
-                                               }
-
-                                               if (pAppFeature->GetName() == L"BaseScreenSize")
-                                               {
-                                                       baseScreenSize = pAppFeature->GetValue();
-                                               }
-
-                                               if (pAppFeature->GetName() == L"LogicalCoordinate")
-                                               {
-                                                       logicalCoordinate = pAppFeature->GetValue();
-                                               }
-                                       }
+                                       coordinateSystem = (*pValue);
                                }
 
-                               String uiScalability;
-                               uiScalability.Format(1024, UISCALABILITY_INFO, coordinateSystem.GetPointer(), baseScreenSize.GetPointer(), logicalCoordinate.GetPointer());
-
-                               String uiScalabilityInfoFile;
-                               uiScalabilityInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), UISCALABILITY_INFO_FILE);
-
-                               CreateInfoFile(uiScalabilityInfoFile, &uiScalability);
-
-                               int categoryType = pAppInfoImpl->GetAppFeature();
-                               if (categoryType != CATEGORY_TYPE_NONE)
+                               if ((*pKey) == L"BaseScreenSize")
                                {
-                                       String category = InstallerUtil::GetCategory(categoryType);
-                                       category.ToLowerCase();
+                                       baseScreenSize = (*pValue);
+                               }
 
-                                       int type = _Aul::GetAppType(category);
+                               if ((*pKey) == L"LogicalCoordinate")
+                               {
+                                       logicalCoordinate = (*pValue);
+                               }
+                       }
 
-                                       if (category == L"ime")
-                                       {
-                                               CreateImeSymlink(binaryPath, packageName);
-                                       }
+                       String uiScalability;
+                       uiScalability.Format(1024, UISCALABILITY_INFO, coordinateSystem.GetPointer(), baseScreenSize.GetPointer(), logicalCoordinate.GetPointer());
 
-                                       String typeInfo;
-                                       typeInfo.Format(1024, L"%d", type);
+                       String uiScalabilityInfoFile;
+                       uiScalabilityInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), UISCALABILITY_INFO_FILE);
 
-                                       String typeInfoFile;
-                                       typeInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), TYPE_INFO_FILE);
+                       CreateInfoFile(uiScalabilityInfoFile, &uiScalability);
 
-                                       CreateInfoFile(typeInfoFile, &typeInfo);
-                               }
-                       }
-                       else if (appType == L"ServiceApp")
+                       int categoryType = pAppData->__feature;
+                       if (categoryType != CATEGORY_TYPE_NONE)
                        {
-                               if (pContext->IsPreloaded() == false)
-                               {
-                                       //err = symlink(SERVICEAPP_LOADER_PATH, pBinaryPath);
+                               String category = InstallerUtil::GetCategory(categoryType);
+                               category.ToLowerCase();
 
-                                       InstallerUtil::Copy(SERVICEAPP_LOADER_PATH, tempBinaryPath);
-                                       InstallerUtil::Copy(SERVICEAPP_LOADER_PATH, binaryPath);
+                               int type = _Aul::GetAppType(category);
 
-                                       //r = File::Copy(SERVICEAPP_LOADER_PATH, pBinaryPath, false);
-                                       //TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed[%s], filePath=[%s]", GetErrorMessage(r), pBinaryPath);
-                               }
-                               else
+                               if (category == L"ime")
                                {
-                                       //err = symlink(SYSTEMAPP_LOADER_PATH, pBinaryPath);
-
-                                       InstallerUtil::Copy(SYSTEMAPP_LOADER_PATH, tempBinaryPath);
-                                       InstallerUtil::Copy(SERVICEAPP_LOADER_PATH, binaryPath);
-
-                                       //r = File::Copy(SYSTEMAPP_LOADER_PATH, pBinaryPath, false);
-                                       //TryCatch(!IsFailed(r), res = false, "[osp-installer] File::Copy() failed[%s], filePath=[%s]", GetErrorMessage(r), pBinaryPath);
+                                       CreateImeSymlink(binaryPath, appId);
                                }
-                       }
 
-                       InstallerUtil::ChangeMode(pBinaryPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+                               String typeInfo;
+                               typeInfo.Format(1024, L"%d", type);
+
+                               String typeInfoFile;
+                               typeInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), TYPE_INFO_FILE);
 
-                       delete[] pBinaryPath;
-                       pBinaryPath = null;
+                               CreateInfoFile(typeInfoFile, &typeInfo);
+                       }
                }
+               else if (appType == L"ServiceApp")
+               {
+                       if (pContext->__isPreloaded == true || pAppData->__isSystemService == true)
+                       {
+                               AppLog("copy system service loader");
+                               InstallerUtil::Copy(SYSTEMSERIVCE_LOADER_PATH, binaryPath);
+                       }
+                       else
+                       {
+                               AppLog("copy service app loader");
+                               InstallerUtil::Copy(SERVICEAPP_LOADER_PATH, binaryPath);
+                       }
+               }
+
+               InstallerUtil::ChangeMode(binaryPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
        }
 
-       pContentDataList = pContext->GetContentDataList();
+       ArrayList* pContentDataList = pContext->GetContentDataList();
        if (pContentDataList)
        {
                int contentCount = pContentDataList->GetCount();
@@ -252,7 +216,7 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
                                }
 
                                String newPath = SLP_FONT_PATH;
-                               newPath += L"/" + pContext->GetId();
+                               newPath += L"/" + pContext->__packageId;
                                Directory::Create(newPath, false);
                                InstallerUtil::ChangeMode(newPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
 
@@ -263,127 +227,108 @@ ConfigurationManager::CreateFile(InstallationContext* pContext)
                }
        }
 
-       //if (pContext->IsPreloaded() == true)
-       //{
-       //      xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
-       //}
-       //else
-       //{
-       xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
-       //}
+       if (pContext->__isPreloaded == true)
+       {
+               pContext->__coreXmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+       }
+       else
+       {
+               pContext->__coreXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
+       }
 
-       pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
-       TryCatch(pXmlPath != null, res = false, "[osp-installer] pXmlPath is null");
+       std::unique_ptr<char[]> pXmlPath(_StringConverter::CopyToCharArrayN(pContext->__coreXmlPath));
+       TryReturn(pXmlPath != null, false, "pXmlPath is null");
 
-       if (hybridService == true)
+       if (pContext->__isHybridService == true)
        {
-               String webXmlPath = pXmlPath;
+               String webXmlPath = pXmlPath.get();
                webXmlPath += L".wgt";
-               InstallerUtil::Copy(pXmlPath, webXmlPath);
+               InstallerUtil::Copy(pXmlPath.get(), webXmlPath);
 
-               pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null);
-               CreateSystemXmlFile(pContext);
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - START");
+               pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath.get(), null);
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - END");
+               CreateCoreXmlFile(pContext);
 
-               String serviceXmlPath = pXmlPath;
+               String serviceXmlPath = pXmlPath.get();
                serviceXmlPath += L".tpk";
-               InstallerUtil::Copy(pXmlPath, serviceXmlPath);
-               InstallerUtil::Remove(pXmlPath);
+               InstallerUtil::Copy(pXmlPath.get(), serviceXmlPath);
+               InstallerUtil::Remove(pXmlPath.get());
 
-               MergeToSystemXmlFile(pXmlPath, webXmlPath, serviceXmlPath);
+               MergeToSystemXmlFile(pXmlPath.get(), webXmlPath, serviceXmlPath);
                InstallerUtil::Remove(webXmlPath);
                InstallerUtil::Remove(serviceXmlPath);
        }
        else
        {
-               pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null);
-               CreateSystemXmlFile(pContext);
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - START");
+               pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath.get(), null);
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() - END");
+               CreateCoreXmlFile(pContext);
        }
        
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "sync() - START");
+       AppLog("------------------------------------------");
+       AppLog("sync() - START");
        sync();
-       AppLogTag(OSP_INSTALLER, "sync() - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("sync() - END");
+       AppLog("------------------------------------------");
        
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() - START");
-       err = pkgmgr_parser_parse_manifest_for_installation(pXmlPath, null);
-       if (err != 0)
-       {
-               AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() is failed. error = [%d][%s]", err, pXmlPath);
-       }
-       AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_installation() - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       err = pkgmgr_parser_check_manifest_validation(pXmlPath.get());
+       TryReturn(err == 0, false, "pkgmgr_parser_check_manifest_validation() is failed. error = [%d][%s]", err, pXmlPath.get());
 
-       res = true;
-
-CATCH:
-       delete[] pBinaryPath;
-       delete[] pXmlPath;
-
-       return res;
+       return true;
 }
 
 bool
 ConfigurationManager::RemoveFile(InstallationContext* pContext)
 {
-       String xmlPath;
-       char* pXmlPath = null;
-       _PackageInfoImpl *pPackageInfoImpl = null;
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
-
-       //if (pContext->IsPreloaded() == true)
-       //{
-       //      xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
-       //}
-       //else
-       //{
-       xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->GetId().GetPointer());
-       //}
-
-       pXmlPath = _StringConverter::CopyToCharArrayN(xmlPath);
-       TryCatch(pXmlPath != null, , "[osp-installer] pXmlPath is null");
-
-       if (pContext->IsHybridService() == true)
+       if (pContext->__isPreloaded == true)
        {
-               AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService - skip");
-
+               pContext->__coreXmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() START");
-               if (pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath, null) != 0)
-               {
-                       AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() is failed.[%s]", pXmlPath);
-               }
-               AppLogTag(OSP_INSTALLER, "pkgmgr_parser_parse_manifest_for_uninstallation() END");
-
-               InstallerUtil::Remove(xmlPath);
+               pContext->__coreXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, pContext->__packageId.GetPointer());
        }
 
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryCatch(pPackageInfoImpl, , "[osp-installer] pPackageInfoImpl is null.");
+       std::unique_ptr<char[]> pXmlPath(_StringConverter::CopyToCharArrayN(pContext->__coreXmlPath));
+       TryReturn(pXmlPath != null, false, "pXmlPath is null");
 
-       pAppList = pPackageInfoImpl->GetAppInfoList();
+       if (pContext->__isHybridService == true)
+       {
+               AppLog("Uninstallation for HybridService - skip");
 
-       for (int i = 0 ; i < pAppList->GetCount(); i++)
+       }
+       else
        {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() START");
+               if (pkgmgr_parser_parse_manifest_for_uninstallation(pXmlPath.get(), null) != 0)
                {
-                       String packageName = pAppInfoImpl->GetPackageName();
-                       String destPath;
-                       char    dest[772] = {0};
-
-                       destPath.Format(1024, L"%ls/%ls", SLP_APP_PATH, packageName.GetPointer());
-                       sprintf(dest, "%ls", destPath.GetPointer());
-                       unlink(dest);
+                       AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() is failed.[%s]", pXmlPath.get());
                }
+               AppLog("pkgmgr_parser_parse_manifest_for_uninstallation() END");
+
+               InstallerUtil::Remove(pXmlPath.get());
        }
 
-CATCH:
-       delete[] pXmlPath;
+//     _PackageInfoImpl* pPackageInfoImpl = pContext->GetPackageInfoImpl();
+//     TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
+//
+//     ArrayList* pAppList = pPackageInfoImpl->GetAppInfoList();
+//     for (int i = 0 ; i < pAppList->GetCount(); i++)
+//     {
+//             _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
+//             if (pAppInfoImpl)
+//             {
+//                     String packageName = pAppInfoImpl->GetPackageName();
+//                     String destPath;
+//                     char    dest[772] = {0};
+//
+//                     destPath.Format(1024, L"%ls/%ls", SLP_APP_PATH, packageName.GetPointer());
+//                     sprintf(dest, "%ls", destPath.GetPointer());
+//                     unlink(dest);
+//             }
+//     }
 
        return true;
 }
@@ -391,41 +336,46 @@ CATCH:
 bool
 ConfigurationManager::RegisterCertInfo(InstallationContext* pContext) const
 {
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "RegisterCertInfo - START");
+       if (pContext->__isHybridService == true)
+       {
+               AppLog("Skip - HybridService");
+               return true;
+       }
+
+       AppLog("START");
 
        int res = 0;
        bool result = true;
        pkgmgr_instcertinfo_h handle = null;
-       String appId = pContext->GetId();
+       String appId = pContext->__packageId;
        X509CertificatePath* pAuthorCertPath = pContext->GetAuthorCertPath();
        X509CertificatePath* pDistributorCertPath = pContext->GetDistributorCertPath();
 
        char* pAppId = _StringConverter::CopyToCharArrayN(appId);
-       TryCatch(pAppId, result = false, "[osp-installer] pAppId is null");
+       TryCatch(pAppId, result = false, "pAppId is null");
 
        res = pkgmgr_installer_create_certinfo_set_handle(&handle);
-       TryCatch(res == 0, result = false, "[osp-installer] pkgmgr_installer_create_certinfo_set_handle() failed.[%d]", res);
+       TryCatch(res == 0, result = false, "pkgmgr_installer_create_certinfo_set_handle() failed.[%d]", res);
 
        if (pAuthorCertPath)
        {
-               AppLogTag(OSP_INSTALLER, "[AuthorCert]");
+               AppLog("[AuthorCert]");
                result = SetCertHashValue(handle, pAuthorCertPath, PM_SET_AUTHOR_SIGNER_CERT);
-               TryCatch(result == true, , "[osp-installer] RegisterCertHashValue() failed. [pAuthorCertPath]");
+               TryCatch(result == true, , "RegisterCertHashValue() failed. [pAuthorCertPath]");
        }
 
        if (pDistributorCertPath)
        {
-               AppLogTag(OSP_INSTALLER, "[DistributorCert]");
+               AppLog("[DistributorCert]");
                result = SetCertHashValue(handle, pDistributorCertPath, PM_SET_DISTRIBUTOR_SIGNER_CERT);
-               TryCatch(result == true, , "[osp-installer] RegisterCertHashValue() failed. [pDistributorCertPath]");
+               TryCatch(result == true, , "RegisterCertHashValue() failed. [pDistributorCertPath]");
        }
 
        res = pkgmgr_installer_save_certinfo(pAppId, handle);
-       TryCatch(res == 0, result = false, "[osp-installer] pkgmgr_installer_save_certinfo(%s) failed.[%d]", pAppId, res);
+       TryCatch(res == 0, result = false, "pkgmgr_installer_save_certinfo(%s) failed.[%d]", pAppId, res);
 
-       AppLogTag(OSP_INSTALLER, "RegisterCertInfo - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("RegisterCertInfo - END");
+       AppLog("------------------------------------------");
 
 CATCH:
        if (handle)
@@ -440,7 +390,7 @@ CATCH:
 bool
 ConfigurationManager::SetCertHashValue(void* pHandle, X509CertificatePath* pCertPath, int certType) const
 {
-       TryReturn(pCertPath, false, "[osp-installer] pCertPath is null.");
+       TryReturn(pCertPath, false, "pCertPath is null.");
 
        int res = 0;
        bool result = true;
@@ -450,17 +400,17 @@ ConfigurationManager::SetCertHashValue(void* pHandle, X509CertificatePath* pCert
        for (int i = 0; i < pCertPath->GetLength(); i++)
        {
                pCert = pCertPath->GetCertificateN(i);
-               TryCatch(pCert, result = false, "[osp-installer] pCert is null.[%i]", i);
+               TryCatch(pCert, result = false, "pCert is null.[%i]", i);
 
                pCertValue = GetCertValueN(pCert);
-               TryCatch(pCertValue, result = false, "[osp-installer] pCertValue is null.[%i]", i);
+               TryCatch(pCertValue, result = false, "pCertValue is null.[%i]", i);
 
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "CertValue(%d), certType[%d]", i, certType);
-               AppLogTag(OSP_INSTALLER, "[%s]", pCertValue);
+               AppLog("------------------------------------------");
+               AppLog("CertValue(%d), certType[%d]", i, certType);
+               AppLog("[%s]", pCertValue);
 
                res = pkgmgr_installer_set_cert_value(pHandle, (pkgmgr_instcert_type)certType, pCertValue);
-               TryCatch(res == 0, result = false, "[osp-installer] pkgmgr_installer_set_cert_value(%d) failed.[%d]", i, res);
+               TryCatch(res == 0, result = false, "pkgmgr_installer_set_cert_value(%d) failed.[%d]", i, res);
 
                delete pCert;
                pCert = null;
@@ -486,13 +436,13 @@ ConfigurationManager::GetCertValueN(ICertificate* pCert) const
        char* pEncodedValue = null;
 
        pEncodedData = pCert->GetEncodedDataN();
-       TryCatch(pEncodedData, , "[osp-installer] pEncodedData is null.");
+       TryCatch(pEncodedData, , "pEncodedData is null.");
 
        r = StringUtil::EncodeToBase64String(*pEncodedData, base64Value);
-       TryCatch(!IsFailed(r), , "[osp-installer] StringUtil::EncodeToBase64String is failed.");
+       TryCatch(!IsFailed(r), , "StringUtil::EncodeToBase64String is failed.");
 
        pEncodedValue = _StringConverter::CopyToCharArrayN(base64Value);
-       TryCatch(pEncodedValue, , "[osp-installer] pEncodedValue is null");
+       TryCatch(pEncodedValue, , "pEncodedValue is null");
 
 CATCH:
        delete pEncodedData;
@@ -503,20 +453,25 @@ CATCH:
 bool
 ConfigurationManager::UnregisterCertInfo(InstallationContext* pContext) const
 {
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "UnregisterCertInfo - START");
+       if (pContext->__isHybridService == true)
+       {
+               AppLog("Skip - HybridService");
+               return true;
+       }
+
+       AppLog("START");
        int res = 0;
        bool result = true;
-       String appId = pContext->GetId();
+       String appId = pContext->__packageId;
 
        char* pAppId = _StringConverter::CopyToCharArrayN(appId);
-       TryCatch(pAppId, result = false, "[osp-installer] pAppId is null");
+       TryCatch(pAppId, result = false, "pAppId is null");
 
        res = pkgmgr_installer_delete_certinfo(pAppId);
-       TryCatch(res == 0, result = false, "[osp-installer] pkgmgr_installer_delete_certinfo(%s) failed.[%d]", pAppId, res);
+       TryCatch(res == 0, result = false, "pkgmgr_installer_delete_certinfo(%s) failed.[%d]", pAppId, res);
 
-       AppLogTag(OSP_INSTALLER, "UnregisterCertInfo - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("UnregisterCertInfo - END");
+       AppLog("------------------------------------------");
 
 CATCH:
        delete[] pAppId;
@@ -526,22 +481,40 @@ CATCH:
 bool
 ConfigurationManager::PostInstall(InstallationContext* pContext, bool error) const
 {
-       app2ext_handle* pHandle = pContext->GetApp2ExtHandle();
-       if (pHandle)
+       app2ext_handle* pHandle = (app2ext_handle*)pContext->__pApp2ExtHandle;
+
+       PackageId packageId = pContext->__packageId;
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null");
+
+       if (error == false)
        {
-               String appId = pContext->GetId();
-               std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-               TryReturn(pAppId, false, "[osp-installer] pAppId is null");
+               std::unique_ptr<char[]> pXmlPath(_StringConverter::CopyToCharArrayN(pContext->__coreXmlPath));
+               TryReturn(pXmlPath != null, false, "pXmlPath is null");
 
+               AppLog("------------------------------------------");
+               AppLog("pkgmgr_parser_parse_manifest_for_installation() - START");
+               int err = pkgmgr_parser_parse_manifest_for_installation(pXmlPath.get(), null);
+               TryReturn(err == 0, false, "pkgmgr_parser_parse_manifest_for_installation() is failed. error = [%d][%s]", err, pXmlPath.get());
+
+               AppLog("pkgmgr_parser_parse_manifest_for_installation() - END");
+               AppLog("------------------------------------------");
+
+               SmackManager smackManager;
+               smackManager.AddPermissions(packageId);
+       }
+
+       if (pHandle)
+       {
                if (error == true)
                {
-                       pHandle->interface.post_install(pAppId.get(), APP2EXT_STATUS_FAILED);
-                       AppLogTag(OSP_INSTALLER, "[app2sd] post_install(%s, APP2EXT_STATUS_FAILED)", pAppId.get());
+                       pHandle->interface.post_install(pPackageId.get(), APP2EXT_STATUS_FAILED);
+                       AppLog("[app2sd] post_install(%s, APP2EXT_STATUS_FAILED)", pPackageId.get());
                }
                else
                {
-                       pHandle->interface.post_install(pAppId.get(), APP2EXT_STATUS_SUCCESS);
-                       AppLogTag(OSP_INSTALLER, "[app2sd] post_install(%s, APP2EXT_STATUS_SUCCESS)", pAppId.get());
+                       pHandle->interface.post_install(pPackageId.get(), APP2EXT_STATUS_SUCCESS);
+                       AppLog("[app2sd] post_install(%s, APP2EXT_STATUS_SUCCESS)", pPackageId.get());
                }
 
                app2ext_deinit(pHandle);
@@ -553,27 +526,31 @@ ConfigurationManager::PostInstall(InstallationContext* pContext, bool error) con
 bool
 ConfigurationManager::PostUninstall(InstallationContext* pContext) const
 {
-       app2ext_handle* pHandle = pContext->GetApp2ExtHandle();
+       app2ext_handle* pHandle = (app2ext_handle*)pContext->__pApp2ExtHandle;
+
+       PackageId packageId = pContext->__packageId;
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null.");
+
        if (pHandle)
        {
-               String appId = pContext->GetId();
-               std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-               TryReturn(pAppId, false, "[osp-installer] pAppId is null");
-
-               pHandle->interface.post_uninstall(pAppId.get());
-               AppLogTag(OSP_INSTALLER, "[app2sd] post_uninstall(%s)", pAppId.get());
+               pHandle->interface.post_uninstall(pPackageId.get());
+               AppLog("[app2sd] post_uninstall(%s)", pPackageId.get());
 
                app2ext_deinit(pHandle);
        }
 
+       SmackManager smackManager;
+       smackManager.RevokePermissions(packageId);
+
        return true;
 }
 
 bool
-ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
+ConfigurationManager::CreateCoreXmlFile(InstallationContext* pContext)
 {
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "CreateSystemXmlFile() - START");
+       AppLog("------------------------------------------");
+       AppLog("CreateCoreXmlFile() - START");
        bool ret = false;
 
        ManifestGenerator manifestGenerator;
@@ -582,10 +559,10 @@ ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
 
        if (ret == false)
        {
-               AppLogTag(OSP_INSTALLER, "manifestGenerator.Write() is failed.");
+               AppLog("manifestGenerator.Write() is failed.");
        }
-       AppLogTag(OSP_INSTALLER, "CreateSystemXmlFile() - END");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("CreateCoreXmlFile() - END");
+       AppLog("------------------------------------------");
 
        return ret;
 }
@@ -593,7 +570,7 @@ ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
 //bool
 //ConfigurationManager::CreateHybridServiceDesktopFile(InstallationContext* pContext)
 //{
-//     AppLogTag(OSP_INSTALLER, "HybridServiceDesktopFile - START");
+//     AppLog("HybridServiceDesktopFile - START");
 //
 //     bool ret = true;
 //     _PackageInfoImpl *pPackageInfoImpl = pContext->GetPackageInfoImpl();
@@ -617,7 +594,7 @@ ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
 //                     iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
 //
 //                     String version;
-//                     version.Format(1024, L"%ls", pPackageInfoImpl->GetAppVersion().GetPointer());
+//                     version.Format(1024, L"%ls", pPackageInfoImpl->GetVersion().GetPointer());
 //
 //                     String desktop;
 //                     desktop.Format(1024, L"[Desktop Entry]\n"
@@ -637,7 +614,7 @@ ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
 //
 //                     if (File::IsFileExist(desktopPath) == true)
 //                     {
-//                             AppLogTag(OSP_INSTALLER, "removing desktop filePath=[%ls]", desktopPath.GetPointer());
+//                             AppLog("removing desktop filePath=[%ls]", desktopPath.GetPointer());
 //                             InstallerUtil::Remove(desktopPath);
 //                     }
 //
@@ -645,7 +622,7 @@ ConfigurationManager::CreateSystemXmlFile(InstallationContext* pContext)
 //             }
 //     }
 //
-//     AppLogTag(OSP_INSTALLER, "HybridServiceDesktopFile - END");
+//     AppLog("HybridServiceDesktopFile - END");
 //
 //     return ret;
 //}
@@ -657,11 +634,11 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St
 
        FileAttributes webXmlAttr;
        r = File::GetAttributes(webXmlPath, webXmlAttr);
-       TryReturn(!IsFailed(r), false, "[osp-installer] File::GetAttributes() failed, webXmlPath=%ls", webXmlPath.GetPointer());
+       TryReturn(!IsFailed(r), false, "File::GetAttributes() failed, webXmlPath=%ls", webXmlPath.GetPointer());
 
        FileAttributes serviceAttr;
        r = File::GetAttributes(serviceXmlPath, serviceAttr);
-       TryReturn(!IsFailed(r), false, "[osp-installer] File::GetAttributes() failed, serviceXmlPath=%ls", serviceXmlPath.GetPointer());
+       TryReturn(!IsFailed(r), false, "File::GetAttributes() failed, serviceXmlPath=%ls", serviceXmlPath.GetPointer());
 
        long long webXmlFileSize = webXmlAttr.GetFileSize();
        long long serviceXmlFileSize = serviceAttr.GetFileSize();
@@ -669,34 +646,34 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St
 
        File webXml;
        r = webXml.Construct(webXmlPath, L"r");
-       TryReturn(!IsFailed(r), false, "[osp-installer] webXmlPath.Construct is failed");
+       TryReturn(!IsFailed(r), false, "webXmlPath.Construct is failed");
 
        std::unique_ptr<char[]> pMergedBuf(new (std::nothrow) char[mergedSize + 1]);
-       TryReturn(pMergedBuf, false, "[osp-installer] pMergedBuf is null");
+       TryReturn(pMergedBuf, false, "pMergedBuf is null");
        memset(pMergedBuf.get(), 0, mergedSize + 1);
 
        int readBytes = webXml.Read(pMergedBuf.get(), webXmlFileSize);
-       TryReturn(readBytes >= 0, false, "[osp-installer] webXml.Read is failed");
+       TryReturn(readBytes >= 0, false, "webXml.Read is failed");
 
        File serviceXml;
        r = serviceXml.Construct(serviceXmlPath, L"r");
-       TryReturn(!IsFailed(r), false, "[osp-installer] serviceXmlPath.Construct is failed");
+       TryReturn(!IsFailed(r), false, "serviceXmlPath.Construct is failed");
 
        std::unique_ptr<char[]> pServiceBuf(new (std::nothrow) char[serviceXmlFileSize + 1]);
-       TryReturn(pServiceBuf, false, "[osp-installer] pServiceBuf is null");
+       TryReturn(pServiceBuf, false, "pServiceBuf is null");
        memset(pServiceBuf.get(), 0, serviceXmlFileSize + 1);
 
        readBytes = serviceXml.Read(pServiceBuf.get(), serviceXmlFileSize);
-       TryReturn(readBytes >= 0, false, "[osp-installer] serviceXml.Read is failed");
+       TryReturn(readBytes >= 0, false, "serviceXml.Read is failed");
 
        char* pManifestTag = strcasestr(pMergedBuf.get(), "</manifest>");
-       TryReturn(pManifestTag, false, "[osp-installer] pManifestTag is null");
+       TryReturn(pManifestTag, false, "pManifestTag is null");
 
        char* pAppTagStart = strcasestr(pServiceBuf.get(), "<ui-application");
-       TryReturn(pAppTagStart, false, "[osp-installer] pAppTagStart is null");
+       TryReturn(pAppTagStart, false, "pAppTagStart is null");
 
        char* pAppTagEnd = strcasestr(pServiceBuf.get(), "</ui-application>");
-       TryReturn(pAppTagEnd, false, "[osp-installer] pAppTagEnd is null");
+       TryReturn(pAppTagEnd, false, "pAppTagEnd is null");
 
        int serviceAppLen = pAppTagEnd - pAppTagStart + strlen("</ui-application>");
 
@@ -709,11 +686,11 @@ ConfigurationManager::MergeToSystemXmlFile(const String& systemXmlPath, const St
 
        File systemXml;
        r = systemXml.Construct(systemXmlPath, L"w");
-       TryReturn(!IsFailed(r), false, "[osp-installer] systemXmlPath.Construct is failed");
+       TryReturn(!IsFailed(r), false, "systemXmlPath.Construct is failed");
 
        systemXml.Write(pMergedBuf.get(), fileSize);
 
-       AppLogTag(OSP_INSTALLER, "pMergedBuf.get()=0x%0x, length=%d", (unsigned int)pMergedBuf.get(), fileSize);
+       AppLog("pMergedBuf.get()=0x%0x, length=%d", (unsigned int)pMergedBuf.get(), fileSize);
        InstallerUtil::DumpLogData(pMergedBuf.get(), fileSize);
 
        return true;
@@ -726,24 +703,24 @@ ConfigurationManager::CreateInfoFile(const String& filePath, const String* pCont
        File file;
 
        r = file.Construct(filePath, "w");
-       TryReturn(!IsFailed(r), false, "[osp-installer] file.Construct() failed, filePath=[%ls]", filePath.GetPointer());
+       TryReturn(!IsFailed(r), false, "file.Construct() failed, filePath=[%ls]", filePath.GetPointer());
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "CreateInfoFile(), filePath = [%ls]", filePath.GetPointer());
+       AppLog("------------------------------------------");
+       AppLog("CreateInfoFile(), filePath = [%ls]", filePath.GetPointer());
 
        if (pContext)
        {
                r = file.Write(*pContext);
-               TryReturn(!IsFailed(r), false, "[osp-installer] file.Write() failed, filePath=[%ls]", filePath.GetPointer());
-               AppLogTag(OSP_INSTALLER, "string = [%ls]", pContext->GetPointer());
+               TryReturn(!IsFailed(r), false, "file.Write() failed, filePath=[%ls]", filePath.GetPointer());
+               AppLog("string = [%ls]", pContext->GetPointer());
        }
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        return true;
 }
 
 bool
-ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& packageName)
+ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& appId)
 {
        bool res = true;
        int err = 0;
@@ -756,17 +733,17 @@ ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& p
        exePath.Format(1024, L"%ls.exe", binaryPath.GetPointer());
 
        String symlinkPath;
-       symlinkPath.Format(1024, L"%s/%ls.so", IME_PATH, packageName.GetPointer());
+       symlinkPath.Format(1024, L"%s/%ls.so", IME_PATH, appId.GetPointer());
 
        pExePath = _StringConverter::CopyToCharArrayN(exePath);
-       TryCatch(pExePath, res = false, "[osp-installer] pExePath is null");
+       TryCatch(pExePath, res = false, "pExePath is null");
 
        pSymlinkPath = _StringConverter::CopyToCharArrayN(symlinkPath);
-       TryCatch(pSymlinkPath, res = false, "[osp-installer] pSymlinkPath is null");
+       TryCatch(pSymlinkPath, res = false, "pSymlinkPath is null");
 
        err = symlink(pExePath, pSymlinkPath);
 
-       AppLogTag(OSP_INSTALLER, "[%s] -> [%s]", pSymlinkPath, pExePath);
+       AppLog("[%s] -> [%s]", pSymlinkPath, pExePath);
 
 CATCH:
        delete[] pExePath;
@@ -778,7 +755,7 @@ CATCH:
 bool
 ConfigurationManager::FindPrivilege(InstallationContext* pContext, const String& privilege) const
 {
-       TryReturn(pContext, false, "[osp-installer] pContext is null.");
+       TryReturn(pContext, false, "pContext is null.");
 
        bool ret = false;
        const ArrayList* pPrivilegeList = pContext->GetPrivilegeList();
@@ -787,7 +764,7 @@ ConfigurationManager::FindPrivilege(InstallationContext* pContext, const String&
        {
                if (pPrivilegeList->Contains(privilege) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Privilege = [%ls]", privilege.GetPointer());
+                       AppLog("Privilege = [%ls]", privilege.GetPointer());
                        ret = true;
                }
        }
index f17aa4c..a36379b 100755 (executable)
 #ifndef _CONFIGURATION_MANAGER_H_
 #define _CONFIGURATION_MANAGER_H_
 
-#include <FAppPkg_PackageAppInfoImpl.h>
-
 #include "InstallationContext.h"
 
-
 /**
  * @class              ConfigurationManager
  * @brief              This class represents the class of ConfigurationManager.
@@ -52,7 +49,7 @@ public:
        bool PostUninstall(InstallationContext* pContext) const;
 
 private:
-       bool CreateSystemXmlFile(InstallationContext* pContext);
+       bool CreateCoreXmlFile(InstallationContext* pContext);
        // bool CreateHybridServiceDesktopFile(InstallationContext* pContext);
        bool MergeToSystemXmlFile(const Tizen::Base::String& systemXmlPath, const Tizen::Base::String& webXmlPath,const Tizen::Base::String& serviceXmlPath);
 
diff --git a/src/Manager/DatabaseManager.cpp b/src/Manager/DatabaseManager.cpp
new file mode 100755 (executable)
index 0000000..a1253ff
--- /dev/null
@@ -0,0 +1,693 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file       DatabaseManager.cpp
+ * @brief      This is the implementation file for %DatabaseManager class.
+ */
+
+#include <unique_ptr.h>
+
+#include <FIoDatabase.h>
+#include <FIoDbStatement.h>
+#include <FIoDbEnumerator.h>
+#include <FIoFile.h>
+
+#include <FAppPkg_PackageManagerImpl.h>
+
+#include "DatabaseManager.h"
+#include "SmackManager.h"
+
+using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+
+DatabaseManager::DatabaseManager(void)
+{
+       CreatePackageTables();
+}
+
+DatabaseManager::~DatabaseManager(void)
+{
+}
+
+bool
+DatabaseManager::RegisterPackageInfo(InstallationContext* pContext) const
+{
+       bool res = true;
+       Database db;
+       String query;
+
+       result r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r+");
+       TryReturn(r == E_SUCCESS, false, "db.Construct failed. [%s]", GetErrorMessage(r));
+
+       query.Format(1024, L"INSERT INTO PkgInfo "
+                         "(PKG_ID, PKG_SECRET, PKG_VERSION, PKG_TYPE, PKG_MIMETYPE, PKG_APIVERSION, PKG_NAME, PKG_VENDOR, PKG_DESCRIPTION, PKG_URL, PKG_CID, PKG_READONLY_SIZE, PKG_DATA_SIZE, PKG_PARENT_ID,"
+                         " PKG_ATTRIBUTE, PKG_ROOTPATH, PKG_STORAGE_TYPE, PKG_INSTALLATION_DATE, PKG_STATE, PKG_INITIATOR) "
+                         "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+
+       std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+       TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       PackageId packageId = pContext->__packageId;
+       String version = pContext->__version;
+       String apiVersion = pContext->__apiVersion;
+       String name = pContext->__displayName;
+       String rootPath = pContext->__rootPath;
+
+       if (!packageId.IsEmpty())
+       {
+               r = pStmt.get()->BindString(0, packageId);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (!version.IsEmpty())
+       {
+               r = pStmt->BindString(2, version);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (!apiVersion.IsEmpty())
+       {
+               r = pStmt->BindString(5, apiVersion);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (!name.IsEmpty())
+       {
+               r = pStmt->BindString(6, name);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (!rootPath.IsEmpty())
+       {
+               r = pStmt->BindString(15, rootPath);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+       TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       res = RegisterPrivilegeInfo(pContext, db);
+       TryReturn(res == true, false, "RegisterPrivilegeInfo() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       res = RegisterAppInfoList(pContext, db);
+       TryReturn(res == true, false, "RegisterAppInfoList() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       return true;
+}
+
+bool
+DatabaseManager::RegisterPrivilegeInfo(InstallationContext* pContext, Database& db) const
+{
+       result r = E_SUCCESS;
+       String query;
+       PackageId packageId = pContext->__packageId;
+
+       query.Format(1024, L"INSERT INTO PkgPrivileges (ID, PRIVILEGES, HMAC_PPRIVILEGES, CERTIFICATE_TYPE, STR_PRIVILEGES) "
+                       "VALUES ((SELECT PkgInfo.UNIQUE_ID FROM PkgInfo WHERE PkgInfo.PKG_ID = '%ls'), ?, ?, ?, ?)", packageId.GetPointer());
+
+       std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+       TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       String privileges = pContext->__privileges;
+       String hmacPrivileges = pContext->__hmacPrivileges;
+       int certType = pContext->__certType;
+       ArrayList* pStringPrivilegeList = pContext->__pStringPrivilegeList;
+
+       if (!privileges.IsEmpty())
+       {
+               r = pStmt->BindString(0, privileges);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (!hmacPrivileges.IsEmpty())
+       {
+               r = pStmt->BindString(1, hmacPrivileges);
+               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (certType != 0)
+       {
+               r = pStmt->BindInt(2, certType);
+               TryReturn(r == E_SUCCESS, false, "BindInt() failed. [%s]", GetErrorMessage(r));
+       }
+
+       if (pStringPrivilegeList != null)
+       {
+               IEnumerator* pEnum = pStringPrivilegeList->GetEnumeratorN();
+               String MergedString;
+               while(pEnum->MoveNext() == E_SUCCESS)
+               {
+                       MergedString.Append(*(static_cast<String*>(pEnum->GetCurrent())));
+                       MergedString.Append(L"#");
+               }
+               delete pEnum;
+
+               r = pStmt->BindString(3, MergedString);
+               TryReturn(r == E_SUCCESS, false, "BindInt() failed. [%s]", GetErrorMessage(r));
+       }
+
+       std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+       TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       return true;
+}
+
+bool
+DatabaseManager::RegisterAppInfoList(InstallationContext* pContext, Database& db) const
+{
+       result r = E_SUCCESS;
+       bool res = true;
+       String query;
+
+       IListT<AppData*>* pAppDataList = pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "pAppDataList is null");
+
+       int count = pAppDataList->GetCount();
+
+       for (int i = 0; i < count; i++)
+       {
+               AppData* pAppData = null;
+               pAppDataList->GetAt(i, pAppData);
+
+               if (pAppData)
+               {
+                       String name = pAppData->__name;
+                       String main = pAppData->__main;
+                       String mainmenuIcon = pAppData->__mainmenuIcon;
+                       String settingIcon = pAppData->__settingIcon;
+                       String notificationIcon = pAppData->__notificationIcon;
+                       int feature = pAppData->__feature;
+                       String appId = pAppData->__appId;
+                       String type = pAppData->__type;
+
+                       query.Format(1024, L"INSERT INTO AppInfo "
+                                         "(ID, APP_NAME, APP_DEFAULT, APP_MAINMENU_ICON, APP_SETTING_ICON, APP_TICKER_ICON, APP_QUICKPANEL_ICON, APP_LAUNCHIMAGE_ICON, APP_FEATURE, PACKAGE_NAME, APP_TYPE) "
+                                         "VALUES ((SELECT PkgInfo.UNIQUE_ID FROM PkgInfo WHERE PkgInfo.PKG_ID = '%ls'),?,?,?,?,?,?,?,?,?,?)", pContext->__packageId.GetPointer());
+
+                       std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+                       TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+                       if (!name.IsEmpty())
+                       {
+                               r = pStmt->BindString(0, name);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!main.IsEmpty())
+                       {
+                               r = pStmt->BindString(1, main);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!mainmenuIcon.IsEmpty())
+                       {
+                               r = pStmt->BindString(2, mainmenuIcon);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!settingIcon.IsEmpty())
+                       {
+                               r = pStmt->BindString(3, settingIcon);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!notificationIcon.IsEmpty())
+                       {
+                               r = pStmt->BindString(5, notificationIcon);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (feature != 0)
+                       {
+                               r = pStmt->BindInt(7, feature);
+                               TryReturn(r == E_SUCCESS, false, "BindInt() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!appId.IsEmpty())
+                       {
+                               r = pStmt->BindString(8, appId);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!type.IsEmpty())
+                       {
+                               r = pStmt->BindString(9, type);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+                       TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+                       if (pAppData->__pLaunchConditionList)
+                       {
+                               res = RegisterLaunchConditionList(pAppData, db);
+                               TryReturn(res == true, false, "RegisterLaunchConditionList() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (pAppData->__pFeatureList)
+                       {
+                               res = RegisterAppFeatureList(pAppData, db);
+                               TryReturn(res == true, false, "RegisterAppFeatureList() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (pAppData->__pDataControlList)
+                       {
+                               res = RegisterDataControlList(pAppData, db);
+                               TryReturn(res == true, false, "RegisterDataControlList() failed. [%s]", GetErrorMessage(r));
+                       }
+               }
+       }
+
+       return true;
+}
+
+bool
+DatabaseManager::RegisterLaunchConditionList(AppData* pAppData, Database& db) const
+{
+       TryReturn(pAppData, E_SYSTEM, "pAppData is null.");
+       TryReturn(pAppData->__pLaunchConditionList, E_SYSTEM, "__pLaunchConditionList is null.");
+
+       result r = E_SUCCESS;
+       HashMap* pList = pAppData->__pLaunchConditionList;
+
+       std::unique_ptr< IMapEnumerator > pEnum(pList->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()));
+
+               String* pValue = static_cast< String* > (pEnum->GetValue());
+               TryReturn(pEnum, false, "GetValue() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+               String query;
+               query.Format(1024, L"INSERT INTO LaunchCondition (ID, NAME, VALUE) VALUES ((SELECT AppInfo.UNIQUE_ID FROM AppInfo WHERE AppInfo.PACKAGE_NAME = '%ls'),?,?)", pAppData->__appId.GetPointer());
+
+               std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+               TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+               if (!(pKey->IsEmpty()))
+               {
+                       r = pStmt->BindString(0, *pKey);
+                       TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+               }
+
+               if (!(pValue->IsEmpty()))
+               {
+                       r = pStmt->BindString(1, *pValue);
+                       TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+               }
+
+               std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+               TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+       }
+
+       return true;
+}
+
+bool
+DatabaseManager::RegisterAppFeatureList(AppData* pAppData, Database& db) const
+{
+       TryReturn(pAppData, E_SYSTEM, "pAppData is null.");
+       TryReturn(pAppData->__pFeatureList, E_SYSTEM, "__pFeatureList is null.");
+
+       result r = E_SUCCESS;
+       HashMap* pList = pAppData->__pFeatureList;
+
+       std::unique_ptr< IMapEnumerator > pEnum(pList->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()));
+
+               String* pValue = static_cast< String* > (pEnum->GetValue());
+               TryReturn(pEnum, false, "GetValue() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+               String query;
+               query.Format(1024, L"INSERT INTO AppFeature (ID, NAME, VALUE) VALUES ((SELECT AppInfo.UNIQUE_ID FROM AppInfo WHERE AppInfo.PACKAGE_NAME = '%ls'),?,?)", pAppData->__appId.GetPointer());
+
+               std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+               TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+               if (!(pKey->IsEmpty()))
+               {
+                       r = pStmt->BindString(0, *pKey);
+                       TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+               }
+
+               if (!(pValue->IsEmpty()))
+               {
+                       r = pStmt->BindString(1, *pValue);
+                       TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+               }
+
+               std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+               TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+       }
+
+       return true;
+}
+
+bool
+DatabaseManager::RegisterDataControlList(AppData* pAppData, Database& db) const
+{
+       TryReturn(pAppData, E_SYSTEM, "pAppData is null.");
+       TryReturn(pAppData->__pDataControlList, E_SYSTEM, "__pDataControlList is null.");
+
+       result r = E_SUCCESS;
+
+       IListT<DataControlInfo*>* pDataControlList = pAppData->__pDataControlList;
+       TryReturn(pDataControlList, false, "pDataControlList is null.");
+
+       for (int i = 0; i < pDataControlList->GetCount(); i++)
+       {
+               DataControlInfo* pDataControlInfo = null;
+               pDataControlList->GetAt(i, pDataControlInfo);
+               TryReturn(pDataControlInfo, false, "pDataControlInfo is null.");
+
+               String providerId = pDataControlInfo->__providerId;
+               IListT<DataControlType*>* pTypeList = pDataControlInfo->__pControlTypeList;
+               TryReturn(pTypeList, false, "pTypeList is null.");
+
+               for (int j = 0; j < pTypeList->GetCount(); j++)
+               {
+                       DataControlType* pDataControlType = null;
+                       pTypeList->GetAt(j, pDataControlType);
+                       TryReturn(pDataControlType, false, "pDataControlType is null.");
+
+                       String access = pDataControlType->__access;
+                       String type = pDataControlType->__type;
+
+                       String query;
+                       query.Format(1024, L"INSERT INTO DataControl (ID, PROVIDER_ID, TYPE, ACCESS) VALUES ((SELECT AppInfo.UNIQUE_ID FROM AppInfo WHERE AppInfo.PACKAGE_NAME = '%ls'),?,?,?)", pAppData->__appId.GetPointer());
+
+                       std::unique_ptr< DbStatement > pStmt(_PackageManagerImpl::CreateStatementN(db, query));
+                       TryReturn(pStmt, false, "CreateStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+                       if (!providerId.IsEmpty())
+                       {
+                               r = pStmt->BindString(0, providerId);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!type.IsEmpty())
+                       {
+                               r = pStmt->BindString(1, type);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       if (!access.IsEmpty())
+                       {
+                               r = pStmt->BindString(2, access);
+                               TryReturn(r == E_SUCCESS, false, "BindString() failed. [%s]", GetErrorMessage(r));
+                       }
+
+                       std::unique_ptr< DbEnumerator > pEnum(_PackageManagerImpl::ExecuteStatementN(db, pStmt.get()));
+                       TryReturn(!IsFailed(GetLastResult()), false, "ExecuteStatementN() failed. [%s]", GetErrorMessage(GetLastResult()));
+               }
+       }
+
+       return true;
+}
+
+bool
+DatabaseManager::UnregisterPackageInfo(InstallationContext* pContext) const
+{
+       Database db;
+       String query;
+       PackageId packageId = pContext->__packageId;
+
+       result r = db.Construct(L"/opt/usr/dbspace/.app-package.db", "r+");
+       TryReturn(r == E_SUCCESS, false, "db.Construct failed. [%s]", GetErrorMessage(r));
+
+       // DataControl
+       query.Format(1024, L"DELETE FROM DataControl WHERE DataControl.ID IN "
+                       "(SELECT AppInfo.UNIQUE_ID FROM PkgInfo, AppInfo "
+                       "WHERE AppInfo.ID = PkgInfo.UNIQUE_ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // LaunchCondition
+       query.Format(1024, L"DELETE FROM LaunchCondition WHERE LaunchCondition.ID IN "
+                       "(SELECT AppInfo.UNIQUE_ID FROM PkgInfo, AppInfo "
+                       "WHERE AppInfo.ID = PkgInfo.UNIQUE_ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // Notification
+       query.Format(1024, L"DELETE FROM Notification WHERE Notification.ID IN "
+                       "(SELECT AppInfo.UNIQUE_ID FROM PkgInfo, AppInfo "
+                       "WHERE AppInfo.ID = PkgInfo.UNIQUE_ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // AppFeature
+       query.Format(1024, L"DELETE FROM AppFeature WHERE AppFeature.ID IN "
+                       "(SELECT AppInfo.UNIQUE_ID FROM PkgInfo, AppInfo "
+                       "WHERE AppInfo.ID = PkgInfo.UNIQUE_ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // AppInfo
+       query.Format(1024, L"DELETE FROM AppInfo WHERE AppInfo.ID IN "
+                       "(SELECT PkgInfo.UNIQUE_ID FROM PkgInfo, AppInfo "
+                       "WHERE PkgInfo.UNIQUE_ID = AppInfo.ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // PkgPrivileges
+       query.Format(1024, L"DELETE FROM PkgPrivileges WHERE PkgPrivileges.ID IN "
+                       "(SELECT PkgInfo.UNIQUE_ID FROM PkgInfo, PkgPrivileges "
+                       "WHERE PkgInfo.UNIQUE_ID = PkgPrivileges.ID and PkgInfo.PKG_ID = '%ls')", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       // PkgInfo
+       query.Format(1024, L"DELETE FROM PkgInfo WHERE PKG_ID = '%ls'", packageId.GetPointer());
+       r = db.ExecuteSql(query, true);
+       if (r != E_SUCCESS)
+       {
+               AppLog("ExecuteSql() failed. [%ls][%s]", query.GetPointer(), GetErrorMessage(r));
+       }
+       query.Clear();
+
+       return true;
+}
+
+bool
+DatabaseManager::CreatePackageTables(void) const
+{
+       if (File::IsFileExist(PACKAGE_DATABASE_FILE_NAME) == true)
+       {
+               return true;
+       }
+
+       result r = E_SUCCESS;
+       Database db;
+       String createQuery;
+
+       r = db.Construct(PACKAGE_DATABASE_FILE_NAME, true);
+       TryReturn(r == E_SUCCESS, false, "db.Construct is failed. [%s]", GetErrorMessage(r));
+
+       // PkgInfo
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS PkgInfo"
+                                                        "( UNIQUE_ID                                   INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "PKG_ID                        TEXT,"
+                                                        "PKG_SECRET                    TEXT,"
+                                                        "PKG_VERSION                   TEXT,"
+                                                        "PKG_TYPE                  TEXT,"
+                                                        "PKG_MIMETYPE              TEXT,"
+                                                        "PKG_APIVERSION                TEXT,"
+                                                        "PKG_NAME                  TEXT,"
+                                                        "PKG_VENDOR                    TEXT,"
+                                                        "PKG_DESCRIPTION           TEXT,"
+                                                        "PKG_URL                       TEXT,"
+                                                        "PKG_CID                       TEXT,"
+                                                        "PKG_READONLY_SIZE             INTEGER,"
+                                                        "PKG_DATA_SIZE                 INTEGER,"
+                                                        "PKG_PARENT_ID                         TEXT,"
+                                                        "PKG_ATTRIBUTE                         INTEGER,"
+                                                        "PKG_ROOTPATH              TEXT,"
+                                                        "PKG_STORAGE_TYPE          INTEGER,"
+                                                        "PKG_INSTALLATION_DATE         TEXT,"
+                                                        "PKG_STATE                     INTEGER,"
+                                                        "PKG_INITIATOR                 INTEGER )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // PkgPrivileges
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS PkgPrivileges"
+                                                        "( ID                          INTEGER,"
+                                                        "PRIVILEGES                                    TEXT,"
+                                                        "HMAC_PPRIVILEGES                      TEXT,"
+                                                        "CERTIFICATE_TYPE              INTEGER,"
+                                                        "STR_PRIVILEGES                TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // PkgIntegrity
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS PkgIntegrity"
+                                                        "( ID                          INTEGER,"
+                                                        "HMAC_APPID                                    TEXT,"
+                                                        "HMAC_APPSECRET                                TEXT,"
+                                                        "HMAC_HTB                                              TEXT,"
+                                                        "SLOT_NUM                              INTEGER )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // AppInfo
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS AppInfo"
+                                                        "( UNIQUE_ID                                   INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "ID                            INTEGER,"
+                                                        "APP_NAME                  TEXT,"
+                                                        "APP_TYPE                  TEXT,"
+                                                        "APP_DEFAULT                   TEXT,"
+                                                        "APP_MAINMENU_ICON             TEXT,"
+                                                        "APP_SETTING_ICON          TEXT,"
+                                                        "APP_TICKER_ICON                               TEXT,"
+                                                        "APP_QUICKPANEL_ICON                   TEXT,"
+                                                        "APP_LAUNCHIMAGE_ICON      TEXT,"
+                                                        "APP_FEATURE               INTEGER,"
+                                                        "PACKAGE_NAME              TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // Notification
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS Notification"
+                                                        "( ID                          INTEGER,"
+                                                        "NAME                      TEXT,"
+                                                        "VALUE                     TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // AppFeature
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS AppFeature"
+                                                        "( ID                          INTEGER,"
+                                                        "NAME                      TEXT,"
+                                                        "VALUE                     TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // LaunchCondition
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS LaunchCondition"
+                                                        "( ID                          INTEGER,"
+                                                        "NAME                      TEXT,"
+                                                        "VALUE                     TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // DataControl
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS DataControl"
+                                                        "( ID INTEGER,"
+                                                        "PROVIDER_ID TEXT,"
+                                                        "TYPE TEXT,"
+                                                        "ACCESS TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // Capability
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS Capability"
+                                                        "( ID                          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "OPERATION_ID                          TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // ResolutionUriScheme
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS ResolutionUriScheme"
+                                                        "( ID                          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "URI_SCHEME                            TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // ResolutionMimeType
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS ResolutionMimeType"
+                                                        "( ID                          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "MIME_TYPE                             TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // AppControl
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS AppControl"
+                                                        "( ID                          INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+                                                        "PROVIDER_ID                   TEXT,"
+                                                        "CATEGORY                                      TEXT )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       // AppInfoLookup
+       createQuery.Format(1024, L"CREATE TABLE IF NOT EXISTS AppInfoLookup"
+                                                        "( AppInfoID                   INTEGER,"
+                                                        "CapabilityID              INTEGER,"
+                                                        "ResolutionUriSchemeID         INTEGER,"
+                                                        "ResolutionMimeTypeID      INTEGER,"
+                                                        "AppControlID                              INTEGER )");
+       r = db.ExecuteSql(createQuery, true);
+       TryReturn(r == E_SUCCESS, false, "db.ExecuteSql is failed. [%s]", GetErrorMessage(r));
+       createQuery.Clear();
+
+       String label("app-package::db");
+       String dbPath("/opt/usr/dbspace/.app-package.db");
+       String dbJournalPath("/opt/usr/dbspace/.app-package.db-journal");
+
+       SmackManager smackManager;
+       smackManager.AddLabelDir(label, dbPath);
+       smackManager.AddLabelDir(label, dbJournalPath);
+
+       return r;
+}
diff --git a/src/Manager/DatabaseManager.h b/src/Manager/DatabaseManager.h
new file mode 100755 (executable)
index 0000000..83653fe
--- /dev/null
@@ -0,0 +1,53 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file       DatabaseManager.h
+ * @brief      This is the header file for the %DatabaseManager class.
+ *
+ * This header file contains the declarations of the %DatabaseManager class.
+ */
+#ifndef _DATABASE_MANAGER_H_
+#define _DATABASE_MANAGER_H_
+
+#include "InstallationContext.h"
+
+namespace Tizen { namespace Io
+{
+class Database;
+}}
+
+class DatabaseManager
+{
+public:
+       DatabaseManager(void);
+       virtual ~DatabaseManager(void);
+
+       bool RegisterPackageInfo(InstallationContext* pContext) const;
+       bool UnregisterPackageInfo(InstallationContext* pContext) const;
+
+private:
+       bool RegisterPrivilegeInfo(InstallationContext* pContext, Tizen::Io::Database& db) const;
+       bool RegisterAppInfoList(InstallationContext* pContext, Tizen::Io::Database& db) const;
+       bool RegisterLaunchConditionList(AppData* pAppData, Tizen::Io::Database& db) const;
+       bool RegisterAppFeatureList(AppData* pAppData, Tizen::Io::Database& db) const;
+       bool RegisterDataControlList(AppData* pAppData, Tizen::Io::Database& db) const;
+
+       bool CreatePackageTables(void) const;
+
+}; // DatabaseManager
+
+#endif // _DATABASE_MANAGER_H_
index bbad10e..20c6aae 100755 (executable)
@@ -21,6 +21,7 @@
 
 #include <unistd.h>
 #include <unique_ptr.h>
+#include <stdio.h>
 
 #include <app2ext_interface.h>
 
@@ -56,6 +57,7 @@ InstallerManager::InstallerManager(void)
 ,__operation(INSTALLER_OPERATION_INSTALL)
 ,__startTick(0)
 ,__endTick(0)
+,__isFileLogOn(false)
 {
 }
 
@@ -74,84 +76,103 @@ InstallerManager::GetInstance()
        if (__pInstallerManager == null)
        {
                __pInstallerManager = new InstallerManager();
-               TryReturn(__pInstallerManager, null, "[osp-installer] __pInstallerManager is null");
+               TryReturn(__pInstallerManager, null, "__pInstallerManager is null");
        }
 
        return __pInstallerManager;
 }
 
 InstallerError
-InstallerManager::Construct(const String& path, InstallerOperation operation, RequesterType requesterType, bool hybridService)
+InstallerManager::Construct(const String& path, InstallerOperation operation, InstallerOption option)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
        InstallerType installerType = INSTALLER_TYPE_INSTALLER;
        result r = E_SUCCESS;
+       String newPath = path;
+
+       Tizen::System::SystemTime::GetTicks(__startTick);
+       SetInstallerOperation(operation);
+
+       if (option & INSTALLER_OPTION_FILELOG_ON)
+       {
+               r = Directory::Create(DIR_OSP_APPLICATIONS_TEMP, false);
+               if (!IsFailed(r))
+               {
+                       __logFilePath = DIR_OSP_APPLICATIONS_TEMP;
+                       __logFilePath += L"/log.txt";
+                       InstallerUtil::CreateLog(__logFilePath);
+
+                       __isFileLogOn = true;
+               }
+       }
+
+       AppLog("------------------------------------------");
+       AppLog("InstallerManager");
+       AppLog("------------------------------------------");
+       AppLog(" # operation = [%s]", (operation == INSTALLER_OPERATION_INSTALL)?"Install":"Uninstall");
+       AppLog(" # path      = [%ls]", path.GetPointer());
+       AppLog("------------------------------------------");
 
        __pContext = new InstallationContext();
-       TryReturn(__pContext, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pContext is null.");
+       TryReturn(__pContext, INSTALLER_ERROR_OUT_OF_MEMORY, "__pContext is null.");
 
        error = __pContext->Construct();
-       TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] __pContext->Construct() failed.");
+       TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "__pContext->Construct() failed.");
 
-       // 1. operation
        if (operation == INSTALLER_OPERATION_INSTALL)
        {
                FileAttributes attr;
-               r = File::GetAttributes(path, attr);
-               TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] File::GetAttributes() failed");
+               r = File::GetAttributes(newPath, attr);
+               TryReturn(!IsFailed(r), INSTALLER_ERROR_PACKAGE_NOT_FOUND, "File::GetAttributes() failed");
 
                if (attr.IsDirectory())
                {
                        installerType = INSTALLER_TYPE_DIRECTORY;
-                       if (path.StartsWith(PATH_USR_APPS, 0) == true)
+
+                       if (newPath.EndsWith("/") == true)
+                       {
+                               int length = newPath.GetLength();
+                               newPath.Remove(length - 1, 1);
+                               AppLog("newPath=[%ls]", newPath.GetPointer());
+                       }
+
+                       if (newPath.StartsWith(PATH_USR_APPS, 0) == true)
                        {
                                installerType = INSTALLER_TYPE_PRELOADED;
+                               __pContext->__isPreloaded = true;
                        }
 
-                       __pContext->SetInputPath(path);
-                       __pContext->SetInstallDir(path);
+                       __pContext->__inputPath = newPath;
+                       __pContext->__installDir = newPath;
                }
                else
                {
                        installerType = INSTALLER_TYPE_PACKAGE;
-                       __pContext->SetPackagePath(path);
-               }
-
-               // org.tizen.*
-               if (path.Contains(PACKAGE_NAME_PREFIX_ORG) == true)
-               {
-                       __pContext->SetPackageNameType(INSTALLER_PREFIX_TYPE_ORG);
+                       __pContext->__packagePath = newPath;
                }
        }
        else if (operation == INSTALLER_OPERATION_UNINSTALL)
        {
                installerType = INSTALLER_TYPE_INSTALLER;
 
-               AppLogTag(OSP_INSTALLER, "operation is INSTALLER_OPERATION_UNINSTALL");
+               AppLog("operation is INSTALLER_OPERATION_UNINSTALL");
                __pContext->SetCurrentInstallationStep(INSTALLER_STEP_INIT_UNINSTALL);
-               __pContext->SetId(path);
+               __pContext->__packageId = newPath;
        }
 
        __pContext->SetInstallerOperation(operation);
 
-       // 2. requesterType
-       if (requesterType == REQUESTER_TYPE_PRELOADED)
-       {
-               __pContext->SetPreloaded(true);
-       }
-
-       // 3. hybridService
-       if (hybridService == true)
+       if (option & INSTALLER_OPTION_HYBRID)
        {
-               AppLogTag(OSP_INSTALLER, "Request to install HybridService app!");
-               __pContext->SetHybridService(true);
+               AppLog("Request to install HybridService app!");
+               __pContext->__isHybridService = true;
        }
 
        __pInstaller = CreateInstaller(installerType);
-       TryReturn(__pInstaller, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] __pInstaller is null.");
+       TryReturn(__pInstaller, INSTALLER_ERROR_INTERNAL_STATE, "__pInstaller is null.");
 
        error = __pInstaller->Construct(__pContext);
-       TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] __pInstaller->Construct() failed");
+       TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "__pInstaller->Construct() failed");
 
        return error;
 }
@@ -171,37 +192,37 @@ InstallerManager::CreateInstaller(InstallerType installerType)
        switch (installerType)
        {
        case INSTALLER_TYPE_INSTALLER:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [Installer]");
+               AppLog("InstallerType = [Installer]");
                pInstaller = new (std::nothrow) Installer();
                break;
 
        case INSTALLER_TYPE_PACKAGE:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [PackageInstaller]");
+               AppLog("InstallerType = [PackageInstaller]");
                pInstaller = new (std::nothrow) PackageInstaller();
                break;
 
        case INSTALLER_TYPE_DIRECTORY:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [DirectoryInstaller]");
+               AppLog("InstallerType = [DirectoryInstaller]");
                pInstaller = new (std::nothrow) DirectoryInstaller();
                break;
 
        case INSTALLER_TYPE_GUEST:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [GuestInstaller]");
+               AppLog("InstallerType = [GuestInstaller]");
                pInstaller = new (std::nothrow) GuestInstaller();
                break;
 
        case INSTALLER_TYPE_PRELOADED:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [PreloadedInstaller]");
+               AppLog("InstallerType = [PreloadedInstaller]");
                pInstaller = new (std::nothrow) PreloadedInstaller();
                break;
 
        case INSTALLER_TYPE_IDE:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [IDEInstaller]");
+               AppLog("InstallerType = [IDEInstaller]");
                pInstaller = new (std::nothrow) IDEInstaller();
                break;
 
        case INSTALLER_TYPE_RESTORATION:
-               AppLogTag(OSP_INSTALLER, "InstallerType = [RestorationInstaller]");
+               AppLog("InstallerType = [RestorationInstaller]");
                pInstaller = new (std::nothrow) RestorationInstaller();
                break;
 
@@ -284,15 +305,15 @@ InstallerManager::Activate(void)
                if (currentStep == INSTALLER_STEP_INIT)
                {
                        error = Init();
-                       TryReturn(error == INSTALLER_ERROR_NONE, error, "[osp-installer] error is occurred.");
+                       TryReturn(error == INSTALLER_ERROR_NONE, error, "error is occurred.");
                }
                else if (currentStep == INSTALLER_STEP_END)
                {
                        error = Register();
-                       TryReturn(error == INSTALLER_ERROR_NONE, error, "[osp-installer] error is occurred.");
+                       TryReturn(error == INSTALLER_ERROR_NONE, error, "error is occurred.");
 
                        error = End();
-                       TryReturn(error == INSTALLER_ERROR_NONE, error, "[osp-installer] error is occurred.");
+                       TryReturn(error == INSTALLER_ERROR_NONE, error, "error is occurred.");
                }
 
                if (__pContext->IsContinue() == false)
@@ -322,732 +343,703 @@ InstallerManager::GetContext(void)
 }
 
 int
-InstallerManager::Request(const String& path, InstallerOperation operation, RequesterType requesterType, bool hybridService)
+InstallerManager::ParseCommandArg(int argc, char **argv, int *mode, char *buf, bool *output)
 {
-       InstallationContext* pContext = null;
-       InstallerError errorType = INSTALLER_ERROR_NONE;
-       InstallerManager* pInstallManager = null;
-       PackageId packageId;
+       const char* pOpts_str = "u:i:r:v";
+       int s = 0;
 
-       if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true)
+       if (mode == NULL)
        {
-               InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP);
+               AppLog("mode is null");
+               exit(-1);
        }
 
-       Tizen::System::SystemTime::GetTicks(__startTick);
+       *mode = 0;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "InstallerManager::Request");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " # operation = [%s]", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation");
-       AppLogTag(OSP_INSTALLER, " # path      = [%ls]", path.GetPointer());
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       while (1)
+       {
+               s = getopt(argc, argv, pOpts_str);
 
-       SetInstallerOperation(operation);
+               if (s == -1)
+               {
+                       break;
+               }
 
-       pInstallManager = InstallerManager::GetInstance();
-       TryCatch(pInstallManager, errorType = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pInstallManager is null.");
+               switch (s)
+               {
+               case 'i':
+                       if (*mode)
+                       {
+                               break;
+                       }
 
-       errorType = pInstallManager->Construct(path, operation, requesterType, hybridService);
-       TryCatch(errorType == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Construct() failed.");
+                       AppLog("__osp_installer_parse_options: i");
+                       *mode = INSTALLER_MODE_INSTALL;
+                       if (optarg[0] == 'v')
+                       {
+                               AppLog("__osp_installer_parse_options: v");
+                               *output = true;
+                               strncpy(buf, argv[optind++], BUFSIZE);
+                               AppLog("__osp_installer_parse_options: buf = [%s]", buf);
+                       }
+                       else
+                       {
+                               strncpy(buf, optarg, BUFSIZE);
+                               AppLog("__osp_installer_parse_options: optarg = [%s]", optarg);
+                       }
+                       break;
 
-       errorType = pInstallManager->Activate();
-       TryCatch(errorType == INSTALLER_ERROR_NONE, , "[osp-installer] pInstallManager->Activate() failed.");
+               case 'u':
+                       if (*mode)
+                       {
+                               break;
+                       }
 
-       pContext = pInstallManager->GetContext();
-       TryCatch(pContext, errorType = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pContext is null.");
+                       AppLog("__osp_installer_parse_options: u");
+                       *mode = INSTALLER_MODE_UNINSTALL;
+                       if (optarg[0] == 'v')
+                       {
+                               AppLog("__osp_installer_parse_options: v");
+                               *output = true;
+                               strncpy(buf, argv[optind++], BUFSIZE);
+                               AppLog("__osp_installer_parse_options: buf = [%s]", buf);
+                       }
+                       else
+                       {
+                               strncpy(buf, optarg, BUFSIZE);
+                               AppLog("__osp_installer_parse_options: optarg = [%s]", optarg);
+                       }
+                       break;
+
+               case 'r':
+                       if (*mode)
+                       {
+                               break;
+                       }
 
-       packageId = pContext->GetId();
-       SetId(packageId);
+                       AppLog("__osp_installer_parse_options: r");
+                       *mode = INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL;
+                       strncpy(buf, optarg, BUFSIZE);
+                       AppLog("__osp_installer_parse_options: optarg = [%s]", optarg);
+                       break;
 
-CATCH:
-       if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true)
+               case 'v':
+                       AppLog("__osp_installer_parse_options: v");
+                       *output = true;
+                       AppLog("__osp_installer_parse_options: optarg = [%s]", optarg);
+                       break;
+
+               default:
+                       AppLog("Invalid option");
+                       exit(-1);
+                       break;
+               }
+       }
+
+       if (mode == 0)
        {
-               InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP);
+               AppLog("Invalid mode");
+               exit(-1);
        }
 
-       SetErrorType(errorType);
-       return errorType;
+       return 0;
 }
 
-int
-InstallerManager::RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType)
+bool
+InstallerManager::RemoveGarbage(const String& filePath)
 {
-       Directory* pDir = null;
-       DirEnumerator* pDirEnum = null;
-       result r = E_SUCCESS;
-       int res = false;
-       String appid;
-       InstallerError error = INSTALLER_ERROR_NONE;
-       int totalCount = 0;
-       int successCount = 0;
-       int failureCount = 0;
+       AppLog("RemoveGarbage Directory = [%ls]", filePath.GetPointer());
 
-       pDir = new (std::nothrow) Directory; // Allocate %Directory instance
-       TryCatch(pDir, res = false, "[osp-installer] pDir is null");
+       String realPath;
+       if (InstallerUtil::IsSymlink(filePath) == true)
+       {
+               if (InstallerUtil::GetRealPath(filePath, realPath) == true)
+               {
+                       InstallerUtil::Remove(realPath);
+               }
+       }
 
-       r = pDir->Construct(path);
-       TryCatch(!IsFailed(r), res = false, "[osp-installer] pDir->Construct() failed, path = [%ls]", path.GetPointer());
+       InstallerUtil::Remove(filePath);
 
-       pDirEnum = pDir->ReadN();
-       TryCatch(pDirEnum, res = false, "[osp-installer] pDirEnum is null");
+       return true;
+}
 
-       while (pDirEnum->MoveNext() == E_SUCCESS)
-       {
-               DirEntry entry = pDirEnum->GetCurrentDirEntry();
+int
+InstallerManager::ReqeustByTest(void)
+{
+       int errorType = 0;
+       String appId;
+       Tizen::Io::File file;
+       Tizen::Io::FileAttributes attr;
+       result r = E_SUCCESS;
+       char readBuf[512] = {0};
+       PackageId packageId;
 
-               String entryName = entry.GetName();
-               String entryDir = path;
-               entryDir += L"/";
-               entryDir += entryName;
+       r = File::GetAttributes(L"/opt/apps/cmtamb4mtv/data/configuration", attr);
+       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "file not found");
 
-               if (entryName == L"." || entryName == L"..")
-               {
-                       continue;
-               }
+       r = file.Construct(L"/opt/apps/cmtamb4mtv/data/configuration", L"r");
+       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "file.Construct failed");
 
-               if (entry.IsDirectory() == false)
-               {
-                       continue;
-               }
+       if (file.Read(readBuf, sizeof(readBuf)-1) > 1)
+       {
+               String path;
+               path.Format(1024, L"%s", &readBuf[1]);
 
-               const int entryLength = entryName.GetLength();
-               if (entryLength == APPID_LENGTH)
-               {
-                       // AppId
-               }
-               else if (entryLength == APP_DIR_LENGTH)
+               if (readBuf[0] == '+')
                {
-                       if (entryName.Contains(PACKAGE_NAME_PREFIX_ORG) == false)
-                       {
-                               AppLogTag(OSP_INSTALLER, " - Not osp = [%ls]: prefix mismatch", entryDir.GetPointer());
-                               continue;
-                       }
+                       errorType = InstallerManager::Request(path, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_NORMAL, packageId);
                }
-               else
+               else if (readBuf[0] == '-')
                {
-                       AppLogTag(OSP_INSTALLER, " - Not osp = [%ls]: length(%d) mismatch", entryDir.GetPointer(), entryLength);
-                       continue;
+                       errorType = InstallerManager::Request(path, INSTALLER_OPERATION_UNINSTALL, INSTALLER_OPTION_NORMAL, packageId);
                }
-
-               String xmlFile;
-               xmlFile.Format(1024, L"%ls%ls", entryDir.GetPointer(), PACKAGE_XML_FILE);
-
-               FileAttributes attr;
-               r = File::GetAttributes(xmlFile, attr);
-               if (IsFailed(r))
+               else if (readBuf[0] == '*')
                {
-                       AppLogTag(OSP_INSTALLER, " - Not osp = [%ls]: No manifest.xml", entryDir.GetPointer());
-                       continue;
+                       errorType = InstallerManager::RequestRecursiveDirectory(path, errorType);
                }
-
-               totalCount++;
-
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, " # Directory = [%ls]", entryDir.GetPointer());
-
-               errorType = Request(entryDir, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_PRELOADED);
-               if (errorType == 0)
+               else if (readBuf[0] == '>')
                {
-                       successCount++;
+                       errorType = InstallerManager::RequestMove(path, PM_MOVE_TO_SDCARD);
                }
-               else
+               else if (readBuf[0] == '<')
                {
-                       failureCount++;
+                       errorType = InstallerManager::RequestMove(path, PM_MOVE_TO_INTERNAL);
                }
-
-               PrintResult();
-
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
        }
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "recursive directory installation");
-       AppLogTag(OSP_INSTALLER, " # totalCount   = [%d]", totalCount);
-       AppLogTag(OSP_INSTALLER, " # successCount = [%d]", successCount);
-       AppLogTag(OSP_INSTALLER, " # failureCount = [%d]", failureCount);
-
 CATCH:
-       delete pDirEnum;
-       delete pDir;
-       return error;
+       return errorType;
 }
 
-int
-InstallerManager::RequestByCommand(int argc, char **argv)
+void
+InstallerManager::PrintResult(void)
 {
-       int mode = 0;
-       char buf[BUFSIZE] = {0};
-       // String appId;
-       int errorType = 0;
-       bool output = false;
-       bool hybridService = false;
+       int errorType = GetErrorType();
+       InstallerOperation operation = GetInstallerOperation();
 
-       AppLogTag(OSP_INSTALLER, " # argc = [%d]", argc);
+       Tizen::System::SystemTime::GetTicks(__endTick);
 
-       for (int i = 0; i < argc; i++)
+       const char* pOperation = null;
+       (operation == INSTALLER_OPERATION_INSTALL)? (pOperation = "Install"): (pOperation = "Uninstall");
+
+       const wchar_t* pPackageId = L"Unknown";
+       if (__pContext && !__pContext->__packageId.IsEmpty())
        {
-               AppLogTag(OSP_INSTALLER, " # argv[%d] = [%s]", i, argv[i]);
+               pPackageId = __pContext->__packageId.GetPointer();
        }
 
-       ParseCommandArg(argc, argv, &mode, buf, &output);
-
-       if (output == true)
+       const wchar_t* pMainAppName = L"Unknown";
+       if (__pContext && !__pContext->__mainAppName.IsEmpty())
        {
-               AppLogTag(OSP_INSTALLER, "HybridService is detected in ParseCommandArg()");
-               hybridService = true;
+               pMainAppName = __pContext->__mainAppName.GetPointer();
        }
 
-       switch (mode)
-       {
-       case INSTALLER_MODE_INSTALL:
-               {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " # Directory = [%s]", buf);
+       const char* pError = null;
+       (errorType == 0)?(pError = "Success"):(pError = "Failure");
 
-                       errorType = Request(buf, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL, hybridService);
-                       if (errorType != 0)
-                       {
-                               // in case of command, garbage directory is not deleted.
-                               // RemoveGarbage(buf);
-                       }
-                       PrintResult();
-               }
-               break;
+       int duration = (int)(__endTick - __startTick);
 
-       case INSTALLER_MODE_UNINSTALL:
-               {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " # Directory = [%s]", buf);
+       AppLog("==========================================");
+       AppLog(" # operation = %s", pOperation);
+       AppLog(" # %s", OSP_INSTALLER_VERSION);
+       AppLog(" # PackageId = [%ls]", pPackageId);
+       AppLog(" # MainApp   = [%ls]", pMainAppName);
+       AppLog(" # Time      = [%d]ms", duration);
+       PrintError(errorType);
+       AppLog("==========================================");
 
-                       errorType = Request(buf, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL, hybridService);
-                       PrintResult();
-               }
-               break;
+       fprintf(stderr, "  ## osp-installer: operation=[%s] result=[%s(%03d)] package id=[%ls] main appname=[%ls] time=[%d]ms\n",
+                       pOperation, pError, errorType, pPackageId, pMainAppName, duration);
+}
 
-       case INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL:
-               {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+void
+InstallerManager::PrintError(int errorType)
+{
+       const char* pError = null;
 
-                       errorType = RequestRecursiveDirectory(buf, errorType);
-               }
+       switch (errorType)
+       {
+       case INSTALLER_ERROR_NONE:
+               pError = "Success";
                break;
 
-       default:
-               {
-                       AppLogTag(OSP_INSTALLER, "__install_package_by_cmd, Invalid mode");
-               }
+       case INSTALLER_ERROR_PACKAGE_NOT_FOUND:
+               pError = "[PACKAGE_NOT_FOUND] Thrown when package file is not found.";
                break;
-       }
 
-       AppLogTag(OSP_INSTALLER, "==========================================");
+       case INSTALLER_ERROR_PACKAGE_INVALID:
+               pError = "[PACKAGE_INVALID] Thrown when package file is not valid due to file operation or directory hierarchy.";
+               break;
 
-       if (output == true)
-       {
-               AppLogTag(OSP_INSTALLER, "stdout is updated by errorType");
-               fprintf(stdout, "%d", errorType);
-       }
-
-       return errorType;
-}
-
-int
-InstallerManager::RequestMove(const PackageId& packageId, int moveType)
-{
-       result r = E_SUCCESS;
-       int res = 0;
-       InstallerError errorType = INSTALLER_ERROR_NONE;
-       app2ext_handle* pHandle = null;
-       app2ext_move_type location = APP2EXT_MOVE_TO_EXT;
-       GList* pDirectoryList = null;
-       Directory* pDir = null;
-       DirEnumerator* pDirEnum = null;
-       PackageInfo* pPackageInfo = null;
-       _PackageInfoImpl* pPackageInfoImpl = null;
-       String rootPath;
-
-       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
-       TryReturn(pPackageId, INSTALLER_ERROR_OUT_OF_MEMORY, "pPackageId is null");
+       case INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
+               pError = "[PACKAGE_LOWER_VERSION] Thrown when the lower version package is tried to install.";
+               break;
 
-       if (moveType == PM_MOVE_TO_INTERNAL)
-       {
-               location = APP2EXT_MOVE_TO_PHONE;
-       }
+       case INSTALLER_ERROR_EXECUTABLE_NOT_FOUND:
+               pError = "[EXECUTABLE_NOT_FOUND] Thrown when executable file is not found in the package.";
+               break;
 
-       pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(packageId);
-       TryCatch(pPackageInfo != null, errorType = INSTALLER_ERROR_INTERNAL_STATE, "GetPackageInfoN() failed");
+       case INSTALLER_ERROR_MANIFEST_NOT_FOUND:
+               pError = "[MANIFEST_NOT_FOUND] Thrown when manifest.xml is not found in the package.";
+               break;
 
-       pPackageInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo);
-       TryCatch(pPackageInfoImpl, errorType = INSTALLER_ERROR_INTERNAL_STATE, "GetInstance() failed");
+       case INSTALLER_ERROR_MANIFEST_INVALID:
+               pError = "[MANIFEST_INVALID] Thrown when manifest.xml is not valid due to schema or parsing failure.";
+               break;
 
-       rootPath = pPackageInfoImpl->GetAppRootPath();
+       case INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
+               pError = "[SIGNATURE_NOT_FOUND] Thrown when the signature files are not found in the package.";
+               break;
 
-       pHandle = app2ext_init(APP2EXT_SD_CARD);
-       TryCatch(pHandle, errorType = INSTALLER_ERROR_INTERNAL_STATE, "app2ext_init() failed");
+       case INSTALLER_ERROR_SIGNATURE_INVALID:
+               pError = "[SIGNATURE_INVALID] Thrown when the signature files are not valid due to schema or parsing failure.";
+               break;
 
-       if (location == APP2EXT_MOVE_TO_PHONE)
-       {
-               res = pHandle->interface.enable(pPackageId.get());
-               TryCatch(res == 0, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pHandle->interface.eable() failed [%d]", res);
-       }
+       case INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
+               pError = "[SIGNATURE_VERIFICATION_FAILED] Thrown when the signature verification has failed due to be modified illegally.";
+               break;
 
-       pDir = new (std::nothrow) Directory;
-       TryCatch(pDir, errorType = INSTALLER_ERROR_OUT_OF_MEMORY, "pDir is null");
+       case INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
+               pError = "[ROOT_CERTIFICATE_NOT_FOUND] Thrown when the root certificate is not found.";
+               break;
 
-       r = pDir->Construct(rootPath);
-       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDir->Construct() failed, path = [%ls]", rootPath.GetPointer());
+       case INSTALLER_ERROR_CERTIFICATE_INVALID:
+               pError = "[CERTIFICATE_INVALID] Thrown when the certificate verification has failed.";
+               break;
 
-       pDirEnum = pDir->ReadN();
-       TryCatch(pDirEnum, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDirEnum is null");
+       case INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
+               pError = "[CERTIFICATE_CHAIN_VERIFICATION_FAILED] Thrown when the certificate chain verification has failed.";
+               break;
 
-       while (pDirEnum->MoveNext() == E_SUCCESS)
-       {
-               DirEntry entry = pDirEnum->GetCurrentDirEntry();
+       case INSTALLER_ERROR_CERTIFICATE_EXPIRED:
+               pError = "[CERTIFICATE_EXPIRED] Thrown when the used certificates have expired.";
+               break;
 
-               String entryName = entry.GetName();
-               //String rootDirectory = rootPath;
-               //rootDirectory += L"/";
-               //rootDirectory += entryName;
+       case INSTALLER_ERROR_PRIVILEGE_INVALID:
+               pError = "[PRIVILEGE_INVALID] Thrown when unsupported privilege strings are detected.";
+               break;
 
-               if (entryName == L"." || entryName == L"..")
-               {
-                       continue;
-               }
+       case INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
+               pError = "[MENU_ICON_NOT_FOUND] Thrown when an icon for menu is not found. This icon is mandatory.";
+               break;
 
-               int length = 0;
-               app2ext_dir_details* pDirDetails = null;
+       case INSTALLER_ERROR_FATAL_ERROR:
+               pError = "[FATAL_ERROR] Thrown when an icon for menu is not found. This icon is mandatory.";
+               break;
 
-               pDirDetails = (app2ext_dir_details*) calloc(1, sizeof(app2ext_dir_details));
-               TryCatch(pDirDetails, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDirDetails is null");
+       case INSTALLER_ERROR_OUT_OF_STORAGE:
+               pError = "[OUT_OF_STORAGE] Thrown when the storage is full.";
+               break;
 
-               length = entryName.GetLength();
-               pDirDetails->name = (char*) calloc(1, (sizeof(char) * length) + 1);
-               snprintf(pDirDetails->name, length + 1, "%ls", entryName.GetPointer());
+       case INSTALLER_ERROR_OUT_OF_MEMORY:
+               pError = "[OUT_OF_MEMORY] Thrown when the memory is not sufficient to perform the requested installation or uninstallation.";
+               break;
 
-               String bin(L"bin");
-               String res(L"res");
-               String icons(L"icons");
+       default:
+               pError = "fatal error";
+               break;
+       }
 
-               if (entryName.Contains(bin) || entryName.Contains(res) || entryName.Contains(icons))
-               {
-                       pDirDetails->type = APP2EXT_DIR_RO;
-               }
-               else
-               {
-                       pDirDetails->type = APP2EXT_DIR_RW;
-               }
+       AppLog(" # Error     = %s(%d)", pError, errorType);
+}
 
-               AppLog("------------------------------------------");
-               AppLog("# Root Directory = [%s], Type = [%d]", pDirDetails->name, pDirDetails->type);
+const PackageId&
+InstallerManager::GetId(void) const
+{
+       return __packageId;
+}
 
-               pDirectoryList = g_list_append(pDirectoryList, pDirDetails);
-       }
+void
+InstallerManager::SetId(const PackageId& packageId)
+{
+       __packageId = packageId;
+}
 
-       res = pHandle->interface.move(pPackageId.get(), pDirectoryList, location);
-       TryCatch(res == 0, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pHandle->interface.move() failed [%d]", res);
+int
+InstallerManager::GetErrorType(void) const
+{
+       return __errorType;
+}
 
-       app2ext_deinit(pHandle);
+void
+InstallerManager::SetErrorType(int errorType)
+{
+       __errorType = errorType;
+}
 
-CATCH:
-       if (pDirectoryList)
-       {
-               GList* pList = null;
-               app2ext_dir_details* pDirDetails = null;
+void
+InstallerManager::SetInstallerOperation(InstallerOperation op)
+{
+       __operation = op;
+}
 
-               pList = g_list_first(pDirectoryList);
-               while (pList)
-               {
-                       pDirDetails = (app2ext_dir_details*)pList->data;
-                       if (pDirDetails && pDirDetails->name)
-                       {
-                               free(pDirDetails->name);
-                       }
-                       pList = g_list_next(pList);
-               }
-               g_list_free(pDirectoryList);
-       }
+InstallerOperation
+InstallerManager::GetInstallerOperation(void) const
+{
+       return __operation;
+}
 
-       delete pDirEnum;
-       delete pDir;
-       delete pPackageInfo;
+String
+InstallerManager::GetLogFilePath() const
+{
+       return __logFilePath;
+}
 
-       return errorType;
+bool
+InstallerManager::IsFileLogOn() const
+{
+       return __isFileLogOn;
 }
 
 int
-InstallerManager::ParseCommandArg(int argc, char **argv, int *mode, char *buf, bool *output)
+InstallerManager::Request(const String& path, InstallerOperation operation, InstallerOption option, PackageId& packageId)
 {
-       const char* pOpts_str = "u:i:r:v";
-       int s = 0;
+       InstallationContext* pContext = null;
+       InstallerError errorType = INSTALLER_ERROR_NONE;
+       InstallerManager* pInstallManager = null;
 
-       if (mode == NULL)
+       if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true)
        {
-               AppLogTag(OSP_INSTALLER, "mode is null");
-               exit(-1);
+               InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP);
        }
+       pInstallManager = InstallerManager::GetInstance();
+       TryCatch(pInstallManager, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pInstallManager is null.");
 
-       *mode = 0;
+       errorType = pInstallManager->Construct(path, operation, option);
+       TryCatch(errorType == INSTALLER_ERROR_NONE, , "pInstallManager->Construct() failed.");
 
-       while (1)
-       {
-               s = getopt(argc, argv, pOpts_str);
+       errorType = pInstallManager->Activate();
+       TryCatch(errorType == INSTALLER_ERROR_NONE, , "pInstallManager->Activate() failed.");
 
-               if (s == -1)
+       pContext = pInstallManager->GetContext();
+       TryCatch(pContext, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pInstallManager->GetContext failed.");
+       packageId = pContext->__packageId;
+
+CATCH:
+       pInstallManager->SetErrorType(errorType);
+
+       if (pInstallManager)
+       {
+               if (!(option & INSTALLER_OPTION_NO_INPUT))
                {
-                       break;
+                       pInstallManager->PrintResult();
                }
 
-               switch (s)
+               if (errorType != INSTALLER_ERROR_NONE)
                {
-               case 'i':
-                       if (*mode)
-                       {
-                               break;
-                       }
-
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: i");
-                       *mode = INSTALLER_MODE_INSTALL;
-                       if (optarg[0] == 'v')
-                       {
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: v");
-                               *output = true;
-                               strncpy(buf, argv[optind++], BUFSIZE);
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: buf = [%s]", buf);
-                       }
-                       else
-                       {
-                               strncpy(buf, optarg, BUFSIZE);
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: optarg = [%s]", optarg);
-                       }
-                       break;
-
-               case 'u':
-                       if (*mode)
-                       {
-                               break;
-                       }
-
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: u");
-                       *mode = INSTALLER_MODE_UNINSTALL;
-                       if (optarg[0] == 'v')
-                       {
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: v");
-                               *output = true;
-                               strncpy(buf, argv[optind++], BUFSIZE);
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: buf = [%s]", buf);
-                       }
-                       else
-                       {
-                               strncpy(buf, optarg, BUFSIZE);
-                               AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: optarg = [%s]", optarg);
-                       }
-                       break;
-
-               case 'r':
-                       if (*mode)
-                       {
-                               break;
-                       }
-
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: r");
-                       *mode = INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL;
-                       strncpy(buf, optarg, BUFSIZE);
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: optarg = [%s]", optarg);
-                       break;
-
-               case 'v':
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: v");
-                       *output = true;
-                       AppLogTag(OSP_INSTALLER, "__osp_installer_parse_options: optarg = [%s]", optarg);
-                       break;
-
-               default:
-                       AppLogTag(OSP_INSTALLER, "Invalid option");
-                       exit(-1);
-                       break;
+                       InstallerUtil::PrintLog(pInstallManager->GetLogFilePath());
                }
-       }
 
-       if (mode == 0)
-       {
-               AppLogTag(OSP_INSTALLER, "Invalid mode");
-               exit(-1);
+               pInstallManager->Release();
        }
 
-       return 0;
-}
-
-bool
-InstallerManager::RemoveGarbage(const String& filePath)
-{
-       AppLogTag(OSP_INSTALLER, "RemoveGarbage Directory = [%ls]", filePath.GetPointer());
-
-       String realPath;
-       if (InstallerUtil::IsSymlink(filePath) == true)
+       if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == true)
        {
-               if (InstallerUtil::GetRealPath(filePath, realPath) == true)
-               {
-                       InstallerUtil::Remove(realPath);
-               }
+               InstallerUtil::Remove(DIR_OSP_APPLICATIONS_TEMP);
        }
 
-       InstallerUtil::Remove(filePath);
-
-       return true;
+       return errorType;
 }
 
 int
-InstallerManager::ReqeustByTest(void)
+InstallerManager::RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType)
 {
-       int errorType = 0;
-       String appId;
-       Tizen::Io::File file;
-       Tizen::Io::FileAttributes attr;
+       Directory* pDir = null;
+       DirEnumerator* pDirEnum = null;
        result r = E_SUCCESS;
-       char readBuf[512] = {0};
+       int res = false;
+       String appid;
+       InstallerError error = INSTALLER_ERROR_NONE;
+       int totalCount = 0;
+       int successCount = 0;
+       int failureCount = 0;
+       PackageId packageId;
 
-       r = File::GetAttributes(L"/opt/apps/cmtamb4mtv/data/configuration", attr);
-       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] file not found");
+       pDir = new (std::nothrow) Directory; // Allocate %Directory instance
+       TryCatch(pDir, res = false, "pDir is null");
 
-       r = file.Construct(L"/opt/apps/cmtamb4mtv/data/configuration", L"r");
-       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_PACKAGE_NOT_FOUND, "[osp-installer] file.Construct failed");
+       r = pDir->Construct(path);
+       TryCatch(!IsFailed(r), res = false, "pDir->Construct() failed, path = [%ls]", path.GetPointer());
 
-       if (file.Read(readBuf, sizeof(readBuf)-1) > 1)
+       pDirEnum = pDir->ReadN();
+       TryCatch(pDirEnum, res = false, "pDirEnum is null");
+
+       while (pDirEnum->MoveNext() == E_SUCCESS)
        {
-               String path;
-               path.Format(1024, L"%s", &readBuf[1]);
+               DirEntry entry = pDirEnum->GetCurrentDirEntry();
 
-               if (readBuf[0] == '+')
+               String entryName = entry.GetName();
+               String entryDir = path;
+               entryDir += L"/";
+               entryDir += entryName;
+
+               if (entryName == L"." || entryName == L"..")
                {
-                       errorType = Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL);
+                       continue;
                }
-               else if (readBuf[0] == '-')
+
+               if (entry.IsDirectory() == false)
                {
-                       errorType = Request(path, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL);
+                       continue;
                }
-               else if (readBuf[0] == '*')
+
+               const int entryLength = entryName.GetLength();
+               if (entryLength == PACKAGE_ID_LENGTH)
                {
-                       errorType = RequestRecursiveDirectory(path, errorType);
+                       // PackageId
                }
-               else if (readBuf[0] == '>')
+               else if (entryLength == APP_DIR_LENGTH)
+               {
+                       if (entryName.Contains(PACKAGE_NAME_PREFIX_ORG) == false)
+                       {
+                               AppLog(" - Not osp = [%ls]: prefix mismatch", entryDir.GetPointer());
+                               continue;
+                       }
+               }
+               else
+               {
+                       AppLog(" - Not osp = [%ls]: length(%d) mismatch", entryDir.GetPointer(), entryLength);
+                       continue;
+               }
+
+               String xmlFile;
+               xmlFile.Format(1024, L"%ls%ls", entryDir.GetPointer(), PACKAGE_XML_FILE);
+
+               FileAttributes attr;
+               r = File::GetAttributes(xmlFile, attr);
+               if (IsFailed(r))
+               {
+                       AppLog(" - Not osp = [%ls]: No manifest.xml", entryDir.GetPointer());
+                       continue;
+               }
+
+               totalCount++;
+
+               AppLog("------------------------------------------");
+               AppLog(" # Directory = [%ls]", entryDir.GetPointer());
+
+               errorType = Request(entryDir, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_NORMAL, packageId);
+               if (errorType == 0)
                {
-                       errorType = RequestMove(path, PM_MOVE_TO_SDCARD);
+                       successCount++;
                }
-               else if (readBuf[0] == '<')
+               else
                {
-                       errorType = RequestMove(path, PM_MOVE_TO_INTERNAL);
+                       failureCount++;
                }
+
+               AppLog("------------------------------------------");
        }
 
+       AppLog("------------------------------------------");
+       AppLog("recursive directory installation");
+       AppLog(" # totalCount   = [%d]", totalCount);
+       AppLog(" # successCount = [%d]", successCount);
+       AppLog(" # failureCount = [%d]", failureCount);
+
 CATCH:
-       return errorType;
+       delete pDirEnum;
+       delete pDir;
+       return error;
 }
 
-void
-InstallerManager::PrintPackageInfo(const char* appId)
+int
+InstallerManager::RequestByCommand(int argc, char **argv)
 {
-       _PackageInfoImpl* pPackageInfoImpl = null;
-       ArrayList* pAppList = null;
-       int totalCount = 0;
+       int mode = 0;
+       char buf[BUFSIZE] = {0};
+       PackageId packageId;
+       int errorType = 0;
+       bool output = false;
+       InstallerOption option = INSTALLER_OPTION_NORMAL;
 
-       pPackageInfoImpl = new (std::nothrow) _PackageInfoImpl;
-       if (pPackageInfoImpl == null)
+       AppLog(" # argc = [%d]", argc);
+
+       for (int i = 0; i < argc; i++)
        {
-               return;
+               AppLog(" # argv[%d] = [%s]", i, argv[i]);
        }
 
-       pPackageInfoImpl->Construct(appId);
-
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "PackageInfo");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "# id = [%S]",  pPackageInfoImpl->GetId().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# version = [%S]", pPackageInfoImpl->GetAppVersion().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# name = [%S]", pPackageInfoImpl->GetAppName().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# vendor = [%S]", pPackageInfoImpl->GetAppVendor().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# description = [%S]", pPackageInfoImpl->GetAppDescription().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# mimeType = [%S]", pPackageInfoImpl->GetAppMimeType().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# api version = [%S]", pPackageInfoImpl->GetAppApiVersion().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# uri = [%S]", pPackageInfoImpl->GetAppUrl().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# cid = [%S]",  pPackageInfoImpl->GetAppCid().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# installationDate = [%S]", pPackageInfoImpl->GetAppInstallationTime().ToString().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# rootpath = [%S]", pPackageInfoImpl->GetAppRootPath().GetPointer());
-       AppLogTag(OSP_INSTALLER, "# storageType = [%d]", pPackageInfoImpl->GetAppStorageType());
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-
-       pAppList = pPackageInfoImpl->GetAppInfoListN();
-       if (pAppList == null)
+       InstallerManager::ParseCommandArg(argc, argv, &mode, buf, &output);
+       if (output == true)
        {
-               delete pPackageInfoImpl;
-               return;
+               AppLog("HybridService is detected in ParseCommandArg()");
+               option = (InstallerOption)(option | INSTALLER_OPTION_HYBRID);
        }
 
-       totalCount = pAppList->GetCount();
-
-       for (int i = 0; i < totalCount; i++)
+       switch (mode)
        {
-               _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "AppInfo(%d/%d)", i+1, totalCount);
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "# default = [%S]", pAppInfoImpl->GetDefault().GetPointer());
-               AppLogTag(OSP_INSTALLER, "# appname = [%S]", pAppInfoImpl->GetName().GetPointer());
-               AppLogTag(OSP_INSTALLER, "# packagename = [%S]", pAppInfoImpl->GetPackageName().GetPointer());
-               AppLogTag(OSP_INSTALLER, "# mainmenu icon = [%S]", pAppInfoImpl->GetMainmenuIcon().GetPointer());
-               AppLogTag(OSP_INSTALLER, "# setting icon = [%S]", pAppInfoImpl->GetSettingIcon().GetPointer());
-               AppLogTag(OSP_INSTALLER, "# quickpanel icon = [%S]", pAppInfoImpl->GetQuickpanelIcon().GetPointer());
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       }
+       case INSTALLER_MODE_INSTALL:
+               {
+                       AppLog("------------------------------------------");
+                       AppLog(" # Directory = [%s]", buf);
 
-       pAppList->RemoveAll();
-       delete pAppList;
-       pAppList = null;
+                       option = (InstallerOption)(option | INSTALLER_OPTION_FILELOG_ON);
+                       errorType = InstallerManager::Request(buf, INSTALLER_OPERATION_INSTALL, option, packageId);
+                       if (errorType != 0)
+                       {
+                               // in case of command, garbage directory is not deleted.
+                               // RemoveGarbage(buf);
+                       }
+               }
+               break;
 
-       delete pPackageInfoImpl;
-}
+       case INSTALLER_MODE_UNINSTALL:
+               {
+                       AppLog("------------------------------------------");
+                       AppLog(" # Directory = [%s]", buf);
 
-void
-InstallerManager::PrintResult(void)
-{
-       String packageId = GetId();
-       int errorType = GetErrorType();
-       InstallerOperation operation = GetInstallerOperation();
+                       option = (InstallerOption)(option | INSTALLER_OPTION_FILELOG_ON);
+                       errorType = InstallerManager::Request(buf, INSTALLER_OPERATION_UNINSTALL, option, packageId);
+               }
+               break;
 
-       Tizen::System::SystemTime::GetTicks(__endTick);
+       case INSTALLER_MODE_RECURSIVE_DIRECTORY_INSTALL:
+               {
+                       AppLog("------------------------------------------");
 
-       AppLogTag(OSP_INSTALLER, "==========================================");
-       AppLogTag(OSP_INSTALLER, "%s Result", (operation == INSTALLER_OPERATION_INSTALL)?"Installation":"Uninstallation");
-       AppLogTag(OSP_INSTALLER, " # %s", OSP_INSTALLER_VERSION);
-       AppLogTag(OSP_INSTALLER, " # PackageId = [%ls]", packageId.IsEmpty() ? L"Unknown" : packageId.GetPointer());
-       AppLogTag(OSP_INSTALLER, " # Result    = [%s]", (errorType == 0)?"Success":"Failure");
-       AppLogTag(OSP_INSTALLER, " # Time      = [%d]ms (start=%d, end=%d)", (int)(__endTick-__startTick), (int)__startTick, (int)__endTick);
-       PrintError(errorType);
+                       errorType = InstallerManager::RequestRecursiveDirectory(buf, errorType);
+               }
+               break;
+
+       default:
+               {
+                       AppLog("__install_package_by_cmd, Invalid mode");
+               }
+               break;
+       }
+
+       AppLog("==========================================");
+
+       if (output == true)
+       {
+               AppLog("stdout is updated by errorType");
+               fprintf(stdout, "%d", errorType);
+       }
+
+       return errorType;
 }
 
-void
-InstallerManager::PrintError(int errorType)
+int
+InstallerManager::RequestMove(const PackageId& packageId, int moveType)
 {
-       const char* pError = null;
+       result r = E_SUCCESS;
+       int res = 0;
+       InstallerError errorType = INSTALLER_ERROR_NONE;
+       app2ext_handle* pHandle = null;
+       app2ext_move_type location = APP2EXT_MOVE_TO_EXT;
+       GList* pDirectoryList = null;
+       Directory* pDir = null;
+       DirEnumerator* pDirEnum = null;
+       PackageInfo* pPackageInfo = null;
+       _PackageInfoImpl* pPackageInfoImpl = null;
+       String rootPath;
 
-       switch (errorType)
-       {
-       case INSTALLER_ERROR_NONE:
-               pError = "Success";
-               break;
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, INSTALLER_ERROR_OUT_OF_MEMORY, "pPackageId is null");
 
-       case INSTALLER_ERROR_PACKAGE_NOT_FOUND:
-               pError = "[PACKAGE_NOT_FOUND] Thrown when package file is not found.";
-               break;
+       if (moveType == PM_MOVE_TO_INTERNAL)
+       {
+               location = APP2EXT_MOVE_TO_PHONE;
+       }
 
-       case INSTALLER_ERROR_PACKAGE_INVALID:
-               pError = "[PACKAGE_INVALID] Thrown when package file is not valid due to file operation or directory hierarchy.";
-               break;
+       pPackageInfo = _PackageManagerImpl::GetInstance()->GetPackageInfoN(packageId);
+       TryCatch(pPackageInfo != null, errorType = INSTALLER_ERROR_INTERNAL_STATE, "GetPackageInfoN() failed");
 
-       case INSTALLER_ERROR_PACKAGE_LOWER_VERSION:
-               pError = "[PACKAGE_LOWER_VERSION] Thrown when the lower version package is tried to install.";
-               break;
+       pPackageInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo);
+       TryCatch(pPackageInfoImpl, errorType = INSTALLER_ERROR_INTERNAL_STATE, "GetInstance() failed");
 
-       case INSTALLER_ERROR_EXECUTABLE_NOT_FOUND:
-               pError = "[EXECUTABLE_NOT_FOUND] Thrown when executable file is not found in the package.";
-               break;
+       rootPath = pPackageInfoImpl->GetAppRootPath();
 
-       case INSTALLER_ERROR_MANIFEST_NOT_FOUND:
-               pError = "[MANIFEST_NOT_FOUND] Thrown when manifest.xml is not found in the package.";
-               break;
+       pHandle = app2ext_init(APP2EXT_SD_CARD);
+       TryCatch(pHandle, errorType = INSTALLER_ERROR_INTERNAL_STATE, "app2ext_init() failed");
 
-       case INSTALLER_ERROR_MANIFEST_INVALID:
-               pError = "[MANIFEST_INVALID] Thrown when manifest.xml is not valid due to schema or parsing failure.";
-               break;
+       if (location == APP2EXT_MOVE_TO_PHONE)
+       {
+               res = pHandle->interface.enable(pPackageId.get());
+       }
 
-       case INSTALLER_ERROR_SIGNATURE_NOT_FOUND:
-               pError = "[SIGNATURE_NOT_FOUND] Thrown when the signature files are not found in the package.";
-               break;
+       pDir = new (std::nothrow) Directory;
+       TryCatch(pDir, errorType = INSTALLER_ERROR_OUT_OF_MEMORY, "pDir is null");
 
-       case INSTALLER_ERROR_SIGNATURE_INVALID:
-               pError = "[SIGNATURE_INVALID] Thrown when the signature files are not valid due to schema or parsing failure.";
-               break;
+       r = pDir->Construct(rootPath);
+       TryCatch(!IsFailed(r), errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDir->Construct() failed, path = [%ls]", rootPath.GetPointer());
 
-       case INSTALLER_ERROR_SIGNATURE_VERIFICATION_FAILED:
-               pError = "[SIGNATURE_VERIFICATION_FAILED] Thrown when the signature verification has failed due to be modified illegally.";
-               break;
+       pDirEnum = pDir->ReadN();
+       TryCatch(pDirEnum, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDirEnum is null");
 
-       case INSTALLER_ERROR_ROOT_CERTIFICATE_NOT_FOUND:
-               pError = "[ROOT_CERTIFICATE_NOT_FOUND] Thrown when the root certificate is not found.";
-               break;
+       while (pDirEnum->MoveNext() == E_SUCCESS)
+       {
+               DirEntry entry = pDirEnum->GetCurrentDirEntry();
 
-       case INSTALLER_ERROR_CERTIFICATE_INVALID:
-               pError = "[CERTIFICATE_INVALID] Thrown when the certificate verification has failed.";
-               break;
+               String entryName = entry.GetName();
+               //String rootDirectory = rootPath;
+               //rootDirectory += L"/";
+               //rootDirectory += entryName;
 
-       case INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED:
-               pError = "[CERTIFICATE_CHAIN_VERIFICATION_FAILED] Thrown when the certificate chain verification has failed.";
-               break;
+               if (entryName == L"." || entryName == L"..")
+               {
+                       continue;
+               }
 
-       case INSTALLER_ERROR_CERTIFICATE_EXPIRED:
-               pError = "[CERTIFICATE_EXPIRED] Thrown when the used certificates have expired.";
-               break;
+               int length = 0;
+               app2ext_dir_details* pDirDetails = null;
 
-       case INSTALLER_ERROR_PRIVILEGE_INVALID:
-               pError = "[PRIVILEGE_INVALID] Thrown when unsupported privilege strings are detected.";
-               break;
+               pDirDetails = (app2ext_dir_details*) calloc(1, sizeof(app2ext_dir_details));
+               TryCatch(pDirDetails, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pDirDetails is null");
 
-       case INSTALLER_ERROR_MENU_ICON_NOT_FOUND:
-               pError = "[MENU_ICON_NOT_FOUND] Thrown when an icon for menu is not found. This icon is mandatory.";
-               break;
+               length = entryName.GetLength();
+               pDirDetails->name = (char*) calloc(1, (sizeof(char) * length) + 1);
+               snprintf(pDirDetails->name, length + 1, "%ls", entryName.GetPointer());
 
-       case INSTALLER_ERROR_FATAL_ERROR:
-               pError = "[FATAL_ERROR] Thrown when an icon for menu is not found. This icon is mandatory.";
-               break;
+               String bin(L"bin");
+               String res(L"res");
+               String icons(L"icons");
 
-       case INSTALLER_ERROR_OUT_OF_STORAGE:
-               pError = "[OUT_OF_STORAGE] Thrown when the storage is full.";
-               break;
+               if (entryName.Contains(bin) || entryName.Contains(res) || entryName.Contains(icons))
+               {
+                       pDirDetails->type = APP2EXT_DIR_RO;
+               }
+               else
+               {
+                       pDirDetails->type = APP2EXT_DIR_RW;
+               }
 
-       case INSTALLER_ERROR_OUT_OF_MEMORY:
-               pError = "[OUT_OF_MEMORY] Thrown when the memory is not sufficient to perform the requested installation or uninstallation.";
-               break;
+               AppLog("------------------------------------------");
+               AppLog("# Root Directory = [%s], Type = [%d]", pDirDetails->name, pDirDetails->type);
 
-       default:
-               pError = "fatal error";
-               break;
+               pDirectoryList = g_list_append(pDirectoryList, pDirDetails);
        }
 
-       AppLogTag(OSP_INSTALLER, " # Error     = %s(%d)", pError, errorType);
-}
+       res = pHandle->interface.move(pPackageId.get(), pDirectoryList, location);
+       TryCatch(res == 0, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pHandle->interface.move() failed [%d]", res);
 
-const PackageId&
-InstallerManager::GetId(void) const
-{
-       return __packageId;
-}
+       app2ext_deinit(pHandle);
 
-void
-InstallerManager::SetId(const PackageId& packageId)
-{
-       __packageId = packageId;
-}
+CATCH:
+       if (pDirectoryList)
+       {
+               GList* pList = null;
+               app2ext_dir_details* pDirDetails = null;
 
-int
-InstallerManager::GetErrorType(void) const
-{
-       return __errorType;
-}
+               pList = g_list_first(pDirectoryList);
+               while (pList)
+               {
+                       pDirDetails = (app2ext_dir_details*)pList->data;
+                       if (pDirDetails && pDirDetails->name)
+                       {
+                               free(pDirDetails->name);
+                       }
+                       pList = g_list_next(pList);
+               }
+               g_list_free(pDirectoryList);
+       }
 
-void
-InstallerManager::SetErrorType(int errorType)
-{
-       __errorType = errorType;
-}
+       delete pDirEnum;
+       delete pDir;
+       delete pPackageInfo;
 
-void
-InstallerManager::SetInstallerOperation(InstallerOperation op)
-{
-       __operation = op;
+       return errorType;
 }
 
-InstallerOperation
-InstallerManager::GetInstallerOperation(void) const
-{
-       return __operation;
-}
index 9076d65..3c62391 100755 (executable)
@@ -38,22 +38,14 @@ class InstallerManager
 {
 public:
        InstallerManager(void);
-       InstallerError Construct(const Tizen::Base::String& path, InstallerOperation op, RequesterType requesterType, bool hybridService = false);
+       InstallerError Construct(const Tizen::Base::String& path, InstallerOperation op, InstallerOption option);
        virtual ~InstallerManager(void);
 
        static InstallerManager* GetInstance(void);
        void Release(void);
 
-       int Request(const Tizen::Base::String& path, InstallerOperation op, RequesterType requesterType, bool hybridService = false);
-       int RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType);
-
        bool RemoveGarbage(const Tizen::Base::String& filePath);
 
-       int RequestByCommand(int argc, char **argv);
-       int ReqeustByTest(void);
-       int RequestMove(const Tizen::App::PackageId& packageId, int moveType);
-
-       void PrintPackageInfo(const char* appId);
        void PrintResult(void);
        void PrintError(int errorType);
 
@@ -66,6 +58,15 @@ public:
        void SetInstallerOperation(InstallerOperation op);
        InstallerOperation GetInstallerOperation(void) const;
 
+       Tizen::Base::String GetLogFilePath() const;
+       bool IsFileLogOn() const;
+
+       static int Request(const Tizen::Base::String& path, InstallerOperation operation, InstallerOption option, Tizen::Base::String& packageId);
+       static int RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType);
+       static int RequestByCommand(int argc, char **argv);
+       static int ReqeustByTest(void);
+       static int RequestMove(const Tizen::App::PackageId& packageId, int moveType);
+
 private:
        InstallerManager(const InstallerManager& value);
        InstallerManager& operator =(const InstallerManager& source);
@@ -86,7 +87,7 @@ private:
        Installer* CreateInstaller(InstallerType installerType);
        InstallationContext* GetContext(void);
 
-       int ParseCommandArg(int argc, char **argv, int *mode, char *buf, bool *output);
+       static int ParseCommandArg(int argc, char **argv, int *mode, char *buf, bool *output);
 
 private:
        static InstallerManager* __pInstallerManager;
@@ -99,6 +100,8 @@ private:
 
        long long __startTick;
        long long __endTick;
+       Tizen::Base::String __logFilePath;
+       bool __isFileLogOn;
 
 }; // InstallerManager
 
index cf1c9b2..d251232 100755 (executable)
 #include <FIoDirectory.h>
 #include <FBase_StringConverter.h>
 #include <FIo_FileImpl.h>
-#include <FAppPkg_PackageManagerImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
-#include <FAppPkg_PackageAppInfoImpl.h>
 
 #include "PermissionManager.h"
 #include "InstallerUtil.h"
+#include "SmackManager.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
 using namespace Tizen::Io;
-using namespace Tizen::App::Package;
+using namespace Tizen::App;
 
 PermissionManager::PermissionManager(void)
 {
@@ -57,41 +55,48 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
 
        String destPath;
        String appRootPath;
-       _PackageInfoImpl *pPackageInfoImpl = null;
        FileAttributes attribute;
+       SmackManager smackManager;
 
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       appRootPath = pPackageInfoImpl->GetAppRootPath();
+       appRootPath = pContext->__rootPath;
+       PackageId packageId = pContext->__packageId;
 
        // appRoot
        // InstallerUtil::ChangeOwner(appRootPath);
        InstallerUtil::ChangeMode(appRootPath, PERM_BASE | PERM_EXECUTE);
+       smackManager.AddLabelDir(packageId, appRootPath, true);
 
        // appRoot/bin
        destPath = appRootPath + DIR_BIN;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/info
        destPath = appRootPath + DIR_INFO;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/res
        destPath = appRootPath + DIR_RES;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/lib
        destPath = appRootPath + DIR_LIB;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_EXECUTE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/shared
        destPath = appRootPath + DIR_SHARED;
        if (File::IsFileExist(destPath) == false)
        {
                r = Directory::Create(destPath, false);
-               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
+               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed");
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
+       // appRoot/shared/res
        destPath = appRootPath + DIR_SHARED_RES;
        if (File::IsFileExist(destPath) == false)
        {
@@ -99,17 +104,29 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                InstallerUtil::CreateSymlink(iconPath, destPath);
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
+       smackManager.AddLabelSharedDir(packageId, destPath, pContext);
+
+       // appRoot/shared/data
+       destPath = appRootPath + DIR_SHARED_DATA;
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
+       smackManager.AddLabelSharedDir(packageId, destPath, pContext);
+
+       // appRoot/shared/trusted
+       destPath = appRootPath + DIR_SHARED_TRUSTED;
+       InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
+       smackManager.AddLabelSharedDir(packageId, destPath, pContext);
 
        // appRoot/contents
        destPath = appRootPath + DIR_CONTENTS;
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
+       smackManager.AddLabelDir(packageId, destPath);
 
        // appRoot/setting
        destPath = appRootPath + DIR_SETTING;
        r = File::GetAttributes(destPath, attribute);
        if (r == E_SUCCESS)
        {
-               String appVersion = pPackageInfoImpl->GetVersion();
+               String appVersion = pContext->__version;
                String srcPath;
                String settingXmlPath;
 
@@ -120,6 +137,7 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
                InstallerUtil::CreateSymlink(srcPath, settingXmlPath);
 
                InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE | PERM_WRITE, false);
+               smackManager.AddLabelDir(packageId, destPath);
        }
 
        // appRoot/data
@@ -127,25 +145,25 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        if (File::IsFileExist(destPath) == false)
        {
                r = Directory::Create(destPath, false);
-               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
+               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed");
        }
        InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
+       smackManager.AddLabelDir(packageId, destPath);
 
-       String appId = pContext->GetId();
-       String apiVersion = pPackageInfoImpl->GetAppApiVersion();
+       String apiVersion = pContext->__apiVersion;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "[Tizen::Io] # path = [%ls]", appRootPath.GetPointer());
-       AppLogTag(OSP_INSTALLER, "[Tizen::Io] # appId = [%ls]", appId.GetPointer());
-       AppLogTag(OSP_INSTALLER, "[Tizen::Io] # apiVersion = [%ls]", apiVersion.GetPointer());
+       AppLog("------------------------------------------");
+       AppLog("[Tizen::Io] # path = [%ls]", appRootPath.GetPointer());
+       AppLog("[Tizen::Io] # packageId = [%ls]", packageId.GetPointer());
+       AppLog("[Tizen::Io] # apiVersion = [%ls]", apiVersion.GetPointer());
 
        if (pContext->__isOspCompat == true)
        {
-               AppLogTag(OSP_INSTALLER, "[Tizen::Io] OSP 2.0 application");
+               AppLog("[Tizen::Io] OSP 2.0 application");
 
-               if (_FileImpl::PrepareDataCaging(appRootPath, appId) == false)
+               if (_FileImpl::PrepareDataCaging(appRootPath, packageId) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "[Tizen::Io] _FileImpl::PrepareDataCaging() failed");
+                       AppLog("[Tizen::Io] _FileImpl::PrepareDataCaging() failed");
                        return false;
                }
 
@@ -153,19 +171,15 @@ PermissionManager::SetDirectory(InstallationContext* pContext)
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "[Tizen::Io] apiVersion is equal to or greater than Tizen 2.0");
+               AppLog("[Tizen::Io] apiVersion is equal to or greater than Tizen 2.0");
 
-               if (_FileImpl::CreateOspApplicationDirectories(appRootPath, appId) == false)
+               if (_FileImpl::CreateOspApplicationDirectories(appRootPath, packageId) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "[Tizen::Io] _FileImpl::CreateOspApplicationDirectories() failed");
+                       AppLog("[Tizen::Io] _FileImpl::CreateOspApplicationDirectories() failed");
                        return false;
                }
        }
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-
-       // Create AppId.ExecutableName directory
-       // This will be removed.
-       CreateSystemDirectory(pContext, appRootPath);
+       AppLog("------------------------------------------");
 
        return true;
 }
@@ -174,55 +188,22 @@ bool
 PermissionManager::SetFile(InstallationContext* pContext)
 {
        String destPath;
+       String appRootPath = pContext->__rootPath;
 
-       _PackageInfoImpl *pPackageInfoImpl = null;
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
-
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
+       IListT<AppData*>* pAppDataList = pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "pAppDataList is null");
 
-       String appRootPath;
-       appRootPath = pPackageInfoImpl->GetAppRootPath();
-
-       pAppList = pPackageInfoImpl->GetAppInfoList();
-       for (int i = 0 ; i < pAppList->GetCount(); i++)
+       for (int i = 0 ; i < pAppDataList->GetCount(); i++)
        {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
-               {
-                       // set permission(755) to bin file.
-                       destPath = appRootPath + DIR_BIN + L"/" + pAppInfoImpl->GetName() + L".exe";
-                       InstallerUtil::ChangeMode(destPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
-               }
-       }
+               AppData* pAppData = null;
+               pAppDataList->GetAt(i, pAppData);
+               TryReturn(pAppData, false, "pAppData is null");
 
-       return true;
-}
-
-bool
-PermissionManager::CreateSystemDirectory(InstallationContext* pContext, const Tizen::Base::String& rootpath)
-{
-       _PackageInfoImpl *pPackageInfoImpl = null;
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
-
-       pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, false, "[osp-installer] pPackageInfoImpl is null.");
-
-       pAppList = pPackageInfoImpl->GetAppInfoList();
-       TryReturn(pAppList, false, "[osp-installer] pAppList is null.");
-
-       for (int i = 0 ; i < pAppList->GetCount(); i++)
-       {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
+               // set permission(755) to bin file.
+               destPath = appRootPath + DIR_BIN + L"/" + pAppData->__name + L".exe";
+               if (File::IsFileExist(destPath) == true)
                {
-                       String destPath =  SLP_APP_PATH;
-                       destPath += L"/" + pAppInfoImpl->GetPackageName();
-
-                       InstallerUtil::Remove(destPath);
-                       InstallerUtil::CreateSymlink(pPackageInfoImpl->GetAppRootPath(), destPath);
+                       InstallerUtil::ChangeMode(destPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
                }
        }
 
@@ -234,9 +215,7 @@ PermissionManager::SetSymLink(InstallationContext* pContext)
 {
        String oldPath;
        String newPath;
-
-       _PackageInfoImpl* pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       String appRootPath = pPackageInfoImpl->GetAppRootPath();
+       String appRootPath = pContext->__rootPath;
 
 #if 0
        oldPath = appRootPath + DIR_RES;
old mode 100644 (file)
new mode 100755 (executable)
index 379493d..c173717
@@ -43,7 +43,6 @@ public:
        static bool SetFile(InstallationContext* pContext);
 
 private:
-       static bool CreateSystemDirectory(InstallationContext* pContext, const Tizen::Base::String& rootpath);
        static bool SetSymLink(InstallationContext* pContext);
     static bool PrepareDataCaging(InstallationContext* pContext);
 
index b69ae70..f46ec79 100755 (executable)
@@ -56,29 +56,29 @@ SignatureManager::Construct(InstallationContext* pContext)
 bool
 SignatureManager::SetSignature()
 {
-       TryReturn(__pContext, false, "[osp-installer] __pContext is null.");
+       TryReturn(__pContext, false, "__pContext is null.");
 
        bool ret = true;
        char* pSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetSignatureXmlPath());
        char* pAuthorSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetAuthorSignatureXmlPath());
 
        __pDistributorSignature = new (std::nothrow) SignatureHandler;
-       TryCatch(__pDistributorSignature, ret = false, "[osp-installer] __pDistributorSignature is null");
+       TryCatch(__pDistributorSignature, ret = false, "__pDistributorSignature is null");
 
        ret = __pDistributorSignature->Construct(__pContext);
-       TryCatch(ret == true, ret = false, "[osp-installer] __pDistributorSignature->Construct is failed.");
+       TryCatch(ret == true, ret = false, "__pDistributorSignature->Construct is failed.");
 
        ret = __pDistributorSignature->Parse(pSignaturePath);
-       TryCatch(ret == true, ret = false, "[osp-installer] __pDistributorSignature->Parse is failed.");
+       TryCatch(ret == true, ret = false, "__pDistributorSignature->Parse is failed.");
 
        __pAuthorSignature = new (std::nothrow) SignatureHandler;
-       TryCatch(__pAuthorSignature, ret = false, "[osp-installer] __pAuthorSignature is null");
+       TryCatch(__pAuthorSignature, ret = false, "__pAuthorSignature is null");
 
        ret = __pAuthorSignature->Construct(__pContext);
-       TryCatch(ret == true, ret = false, "[osp-installer] __pAuthorSignature->Construct is failed.");
+       TryCatch(ret == true, ret = false, "__pAuthorSignature->Construct is failed.");
 
        ret = __pAuthorSignature->Parse(pAuthorSignaturePath);
-       TryCatch(ret == true, ret = false, "[osp-installer] __pAuthorSignature->Parse is failed.");
+       TryCatch(ret == true, ret = false, "__pAuthorSignature->Parse is failed.");
 
 CATCH:
        delete[] pSignaturePath;
@@ -89,8 +89,8 @@ CATCH:
 bool
 SignatureManager::AddCert()
 {
-       TryReturn(__pAuthorSignature, false, "[osp-installer] __pAuthorSignature is null.");
-       TryReturn(__pDistributorSignature, false, "[osp-installer] __pDistributorSignature is null.");
+       TryReturn(__pAuthorSignature, false, "__pAuthorSignature is null.");
+       TryReturn(__pDistributorSignature, false, "__pDistributorSignature is null.");
 
        bool ret = true;
        IList* pAuthorCertChain = __pAuthorSignature->GetAuthorCertChain();
@@ -98,30 +98,30 @@ SignatureManager::AddCert()
 
        if (pAuthorCertChain)
        {
-               AppLogTag(OSP_INSTALLER, "AddCertificate - AuthorCertChain");
+               AppLog("AddCertificate - AuthorCertChain");
 
                __pAuthorCertPath = new (std::nothrow) X509CertificatePath();
-               TryCatch(__pAuthorCertPath, ret = false, "[osp-installer] __pAuthorCertPath is null.");
+               TryCatch(__pAuthorCertPath, ret = false, "__pAuthorCertPath is null.");
 
                ret = AddCertificate(__pAuthorCertPath, pAuthorCertChain);
-               TryCatch(ret == true, ret = false, "[osp-installer] AddCertificate(AuthorCert) is failed.");
+               TryCatch(ret == true, ret = false, "AddCertificate(AuthorCert) is failed.");
 
                ret = AddAuthorRootCert(__pAuthorCertPath);
-               TryCatch(ret == true, ret = false, "[osp-installer] AddAuthorRootCert(AuthorCertPath) is failed.");
+               TryCatch(ret == true, ret = false, "AddAuthorRootCert(AuthorCertPath) is failed.");
        }
 
        if (pDistributorCertChain)
        {
-               AppLogTag(OSP_INSTALLER, "AddCertificate - DistributorCert");
+               AppLog("AddCertificate - DistributorCert");
 
                __pDistributorCertPath = new (std::nothrow) X509CertificatePath();
-               TryCatch(__pDistributorCertPath, ret = false, "[osp-installer] __pDistributorCertPath is null.");
+               TryCatch(__pDistributorCertPath, ret = false, "__pDistributorCertPath is null.");
 
                ret = AddCertificate(__pDistributorCertPath, pDistributorCertChain);
-               TryCatch(ret == true, ret = false, "[osp-installer] AddCertificate(DistributorCert) is failed.");
+               TryCatch(ret == true, ret = false, "AddCertificate(DistributorCert) is failed.");
 
                ret = AddDistributorRootCert(__pDistributorCertPath);
-               TryCatch(ret == true, ret = false, "[osp-installer] AddDistributorRootCert(DistributorCert) is failed.");
+               TryCatch(ret == true, ret = false, "AddDistributorRootCert(DistributorCert) is failed.");
        }
 
 CATCH:
@@ -131,23 +131,23 @@ CATCH:
 bool
 SignatureManager::VerifyChain()
 {
-       TryReturn(__pAuthorCertPath, false, "[osp-installer] __pAuthorCertPath is null.");
-       TryReturn(__pDistributorCertPath, false, "[osp-installer] __pDistributorCertPath is null.");
+       TryReturn(__pAuthorCertPath, false, "__pAuthorCertPath is null.");
+       TryReturn(__pDistributorCertPath, false, "__pDistributorCertPath is null.");
 
        bool ret = true;
 
-       AppLogTag(OSP_INSTALLER, "AuthorCert Validate - START");
+       AppLog("AuthorCert Validate - START");
        ret = Validate(__pAuthorCertPath);
-       AppLogTag(OSP_INSTALLER, "AuthorCert Validate - END");
-       TryCatch(ret == true, ret = false, "[osp-installer] Validate(AuthorCert) is failed.");
+       AppLog("AuthorCert Validate - END");
+       TryCatch(ret == true, ret = false, "Validate(AuthorCert) is failed.");
 
        __pContext->SetAuthorCertPath(__pAuthorCertPath);
        __pAuthorCertPath = null;
 
-       AppLogTag(OSP_INSTALLER, "DistributorCert Validate - START");
+       AppLog("DistributorCert Validate - START");
        ret = Validate(__pDistributorCertPath);
-       AppLogTag(OSP_INSTALLER, "DistributorCert Validate - END");
-       TryCatch(ret == true, ret = false, "[osp-installer] Validate(DistributorCert) is failed.");
+       AppLog("DistributorCert Validate - END");
+       TryCatch(ret == true, ret = false, "Validate(DistributorCert) is failed.");
 
        __pContext->SetDistributorCertPath(__pDistributorCertPath);
        __pDistributorCertPath = null;
@@ -164,17 +164,17 @@ CATCH:
 bool
 SignatureManager::Validate(X509CertificatePath* pCertPath)
 {
-       TryReturn(pCertPath, false, "[osp-installer] pCertPath is null.");
+       TryReturn(pCertPath, false, "pCertPath is null.");
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "# signature.xml");
+       AppLog("------------------------------------------");
+       AppLog("# signature.xml");
        ValidationResult valResult = VALIDATION_SUCCESS;
        valResult = pCertPath->Validate();
 
        if (valResult != VALIDATION_SUCCESS)
        {
-               AppLogTag(OSP_INSTALLER, "Validate() fail! - ValidationResult = [%d]", valResult);
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
+               AppLog("Validate() fail! - ValidationResult = [%d]", valResult);
+               AppLog("------------------------------------------");
                return false;
        }
        else
@@ -182,12 +182,12 @@ SignatureManager::Validate(X509CertificatePath* pCertPath)
                int depth = pCertPath->GetLength();
                if (depth == 0)
                {
-                       AppLogTag(OSP_INSTALLER, "depth = 0");
+                       AppLog("depth = 0");
                        return false;
                }
 
-               AppLogTag(OSP_INSTALLER, "Validate() success!");
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
+               AppLog("Validate() success!");
+               AppLog("------------------------------------------");
        }
 
        return true;
@@ -196,7 +196,7 @@ SignatureManager::Validate(X509CertificatePath* pCertPath)
 bool
 SignatureManager::AddCertificate(X509CertificatePath* pCertPath, IList* pCertChain)
 {
-       TryReturn(pCertChain, false, "[osp-installer] pCertChain is null.");
+       TryReturn(pCertChain, false, "pCertChain is null.");
 
        bool ret = true;
        result r = E_SUCCESS;
@@ -208,16 +208,16 @@ SignatureManager::AddCertificate(X509CertificatePath* pCertPath, IList* pCertCha
 
                if (pByteBuffer)
                {
-                       AppLogTag(OSP_INSTALLER, "[cert][%d]", i);
+                       AppLog("[cert][%d]", i);
 
                        pCertificate = new (std::nothrow) X509Certificate;
-                       TryCatch(pCertificate, ret = false, "[osp-installer] pCertificate is null.");
+                       TryCatch(pCertificate, ret = false, "pCertificate is null.");
 
                        r = pCertificate->Construct(*pByteBuffer);
-                       TryCatch(!IsFailed(r), ret = false, "[osp-installer] pCertificate->Construct() is failed.");
+                       TryCatch(!IsFailed(r), ret = false, "pCertificate->Construct() is failed.");
 
                        r = pCertPath->AddCertificate(*pCertificate);
-                       TryCatch(!IsFailed(r), ret = false, "[osp-installer] AddCertificate is failed.");
+                       TryCatch(!IsFailed(r), ret = false, "AddCertificate is failed.");
 
                        delete pCertificate;
                        pCertificate = null;
@@ -232,7 +232,7 @@ CATCH:
 bool
 SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
 {
-       TryReturn(pCertPath, false, "[osp-installer] pCertPath is null.");
+       TryReturn(pCertPath, false, "pCertPath is null.");
 
        result r = E_SUCCESS;
        bool ret = true;
@@ -240,7 +240,7 @@ SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
        String issuer;
 
        pIntermediateCA = pCertPath->GetCertificateN(1);
-       TryCatch(pIntermediateCA, ret = false, "[osp-installer] pIntermediateCA is null.");
+       TryCatch(pIntermediateCA, ret = false, "pIntermediateCA is null.");
 
        issuer = pIntermediateCA->GetIssuer();
 
@@ -329,28 +329,28 @@ SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
                byteBuffer.Construct(length);
 
                r = byteBuffer.SetArray((byte*)pRootCert, 0, length);
-               TryCatch(!IsFailed(r), ret = false, "[osp-installer] SetArray() is failed.");
+               TryCatch(!IsFailed(r), ret = false, "SetArray() is failed.");
 
                byteBuffer.Flip();
 
                r = rootCert.Construct(byteBuffer);
-               TryCatch(!IsFailed(r), ret = false, "[osp-installer] rootCert.Construct() is failed.");
+               TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed.");
 
                String subject = rootCert.GetSubject();
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "Issuer  = [%ls]", issuer.GetPointer());
-               AppLogTag(OSP_INSTALLER, "Subject = [%ls]", subject.GetPointer());
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
+               AppLog("------------------------------------------");
+               AppLog("Issuer  = [%ls]", issuer.GetPointer());
+               AppLog("Subject = [%ls]", subject.GetPointer());
+               AppLog("------------------------------------------");
 
                if (subject == issuer)
                {
-                       AppLogTag(OSP_INSTALLER, "subject, issuer is matched.");
+                       AppLog("subject, issuer is matched.");
 
                        r = pCertPath->AddCertificate(rootCert);
-                       TryCatch(!IsFailed(r), ret = false, "[osp-installer] AddCertificate(DistributorRootCert) is failed.");
+                       TryCatch(!IsFailed(r), ret = false, "AddCertificate(DistributorRootCert) is failed.");
 
-                       AppLogTag(OSP_INSTALLER, "AddCertificate() RootCert = [%d]", certType);
-                       __pContext->SetRootCertType((RootCertificateType)certType);
+                       AppLog("AddCertificate() RootCert = [%d]", certType);
+                       __pContext->__rootCertType = (RootCertificateType)certType;
 
                        ret = true;
 
@@ -358,7 +358,7 @@ SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
                }
                else
                {
-                       AppLogTag(OSP_INSTALLER, "subject, issuer is not matched.");
+                       AppLog("subject, issuer is not matched.");
                        ret = false;
                }
        }
@@ -371,7 +371,7 @@ CATCH:
 bool
 SignatureManager::AddAuthorRootCert(X509CertificatePath* pCertPath)
 {
-       TryReturn(pCertPath, false, "[osp-installer] pCertPath is null.");
+       TryReturn(pCertPath, false, "pCertPath is null.");
 
        result r = E_SUCCESS;
        bool ret = true;
@@ -398,15 +398,15 @@ SignatureManager::AddAuthorRootCert(X509CertificatePath* pCertPath)
        byteBuffer.Construct(length);
 
        r = byteBuffer.SetArray((byte*)pAuthorRootCert, 0, length);
-       TryCatch(!IsFailed(r), ret = false, "[osp-installer] SetArray() is failed.");
+       TryCatch(!IsFailed(r), ret = false, "SetArray() is failed.");
 
        byteBuffer.Flip();
 
        r = rootCert.Construct(byteBuffer);
-       TryCatch(!IsFailed(r), ret = false, "[osp-installer] rootCert.Construct() is failed.");
+       TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed.");
 
        r = pCertPath->AddCertificate(rootCert);
-       TryCatch(!IsFailed(r), ret = false, "[osp-installer] AddCertificate(AuthorRootCert) is failed.");
+       TryCatch(!IsFailed(r), ret = false, "AddCertificate(AuthorRootCert) is failed.");
 
 CATCH:
        return ret;
diff --git a/src/Manager/SmackManager.cpp b/src/Manager/SmackManager.cpp
new file mode 100755 (executable)
index 0000000..e68035e
--- /dev/null
@@ -0,0 +1,376 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file       SmackManager.cpp
+ * @brief      This is the implementation file for %SmackManager class.
+ */
+
+#include <dlfcn.h>
+#include <unique_ptr.h>
+
+#include <FIoFile.h>
+#include <FIoRegistry.h>
+#include <FSecCryptoSha1Hash.h>
+#include <FBase_StringConverter.h>
+
+#include "SmackManager.h"
+#include "InstallerDefs.h"
+#include "InstallerUtil.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
+using namespace Tizen::Security::Cert;
+using namespace Tizen::Security::Crypto;
+using namespace Tizen::Io;
+
+SmackManager::SmackManager(void)
+:__isSmackEnable(false)
+{
+       if (IsSmackEnable() == true)
+       {
+               __isSmackEnable = true;
+       }
+}
+
+SmackManager::~SmackManager(void)
+{
+}
+
+bool
+SmackManager::AddLabelDir(const String& label, const String& dirPath, bool rootDirectory)
+{
+       if (__isSmackEnable == false)
+       {
+               return true;
+       }
+
+       int res = 0;
+       String realPath;
+
+       std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(dirPath));
+       TryReturn(pPath, false, "pPath is null.");
+
+       if (InstallerUtil::IsSymlink(dirPath) == true)
+       {
+               res = AddLabelDir("_", pPath.get());
+               InstallerUtil::GetRealPath(dirPath, realPath);
+       }
+       else
+       {
+               realPath = dirPath;
+       }
+
+       std::unique_ptr<char[]> pRealPath(_StringConverter::CopyToCharArrayN(realPath));
+       TryReturn(pRealPath, false, "pRealPath is null");
+
+       if (rootDirectory == true)
+       {
+               res = AddLabelDir("_", pRealPath.get());
+       }
+       else if (dirPath.Contains(L"shared") == true)
+       {
+               res = AddLabelDir("*", pRealPath.get());
+       }
+       else
+       {
+               std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(label));
+               TryReturn(pPackageId, false, "pPackageId is null");
+
+               res = AddLabelDir(pPackageId.get(), pRealPath.get());
+       }
+
+       return true;
+}
+
+bool
+SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPath, InstallationContext* pContext)
+{
+       if (__isSmackEnable == false)
+       {
+               return true;
+       }
+
+       if (pContext->__isVerificationMode == false)
+       {
+               AppLog("VerificationMode is off.");
+               return true;
+       }
+
+       int res = 0;
+       String label = packageId;
+
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null.");
+
+       std::unique_ptr<char[]> pPath(_StringConverter::CopyToCharArrayN(dirPath));
+       TryReturn(pPath, false, "pPath is null.");
+
+       if (dirPath.Contains(L"shared/data") == true)
+       {
+               label.Append("_shareddata");
+       }
+       else if (dirPath.Contains(L"shared/res") == true)
+       {
+               label.Append("_sharedres");
+       }
+       else if (dirPath.Contains(L"shared/trusted") == true)
+       {
+               Sha1Hash hash;
+               String base64Value;
+
+               X509CertificatePath* pAuthorCertPath = pContext->GetAuthorCertPath();
+               TryReturn(pAuthorCertPath, false, "pAuthorCertPath is null.");
+
+               std::unique_ptr<ICertificate> pEntity(pAuthorCertPath->GetCertificateN(0));
+               TryReturn(pEntity, false, "pEntity is null.");
+
+               std::unique_ptr<ByteBuffer> pEncodedData(pEntity->GetEncodedDataN());
+               TryReturn(pEncodedData, false, "pEncodedData is null.");
+
+               std::unique_ptr<ByteBuffer> pHashValue(hash.GetHashN(*pEncodedData.get()));
+               TryReturn(pHashValue, false, "pHashValue is null.");
+
+               StringUtil::EncodeToBase64String(*pHashValue, base64Value);
+
+               std::unique_ptr<char[]> pHashEncodedValue(_StringConverter::CopyToCharArrayN(base64Value));
+               TryReturn(pHashEncodedValue, false, "pHashEncodedValue is null.");
+
+               label = pHashEncodedValue.get();
+               AppLog("pHashEncodedValue = [%s]", pHashEncodedValue.get());
+       }
+       else
+       {
+               AppLog("Invalid Directory = [%ls]", dirPath.GetPointer());
+               return false;
+       }
+
+       std::unique_ptr<char[]> pLabel(_StringConverter::CopyToCharArrayN(label));
+       TryReturn(pLabel, false, "pLabel is null.");
+
+       res = AddLabelSharedDir(pPackageId.get(), pLabel.get(), pPath.get());
+
+       return true;
+}
+
+bool
+SmackManager::AddPermissions(const PackageId& packageId)
+{
+       if (__isSmackEnable == false)
+       {
+               return true;
+       }
+
+       int res = 0;
+       const char* pList[] = {"OSP", null};
+       String script("/usr/bin/smackload-app.sh");
+       bool exist = File::IsFileExist(script);
+
+       script.Append(L" ");
+       script.Append(packageId);
+
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null.");
+
+       std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(script));
+       TryReturn(pScript, false, "pScript is null.");
+
+       res = AddPermissions(pPackageId.get(), pList);
+
+       if (exist == true)
+       {
+               res = system(pScript.get());
+               AppLog("[smack] system(%s), result = [%d]", pScript.get(), res);
+       }
+       else
+       {
+               AppLog("[%ls] not found", script.GetPointer());
+       }
+
+       return true;
+}
+
+bool
+SmackManager::RevokePermissions(const PackageId& packageId)
+{
+       if (__isSmackEnable == false)
+       {
+               return true;
+       }
+
+       int res = 0;
+
+       std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+       TryReturn(pPackageId, false, "pPackageId is null.");
+
+       res = RevokePermissions(pPackageId.get());
+
+       return true;
+}
+
+bool
+SmackManager::IsSmackEnable()
+{
+       result r;
+       Registry reg;
+       String section(L"feature");
+       String entry(L"smack");
+       String value;
+
+       r = reg.Construct(CONFIG_PATH, "r");
+       TryReturn(!IsFailed(r), false, "CONFIG file is not found.");
+
+       r = reg.GetValue(section, entry, value);
+       TryReturn(!IsFailed(r), false, "GetValue is failed. entry = [%ls]", entry.GetPointer());
+
+       AppLog("[%ls is %ls.]", entry.GetPointer(), value.GetPointer());
+
+       if (value == L"on")
+       {
+               return true;
+       }
+
+       return false;
+}
+
+int
+SmackManager::AddLabelDir(const char* pLabel, const char* pDirPath)
+{
+       int ret = 0;
+       void* pHandle = null;
+       char* pErrorMsg = null;
+       int (*app_label_dir)(const char*, const char*) = null;
+
+       pHandle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_GLOBAL);
+       if (!pHandle)
+       {
+               AppLog("AddLabelDir(): dlopen() failed. [%s]", dlerror());
+               return -1;
+       }
+
+       app_label_dir = reinterpret_cast <int (*)(const char*, const char*)>(dlsym(pHandle, "app_label_dir"));
+       pErrorMsg = dlerror();
+       if (pErrorMsg != null)
+       {
+               AppLog("AddLabelDir(): dlsym() failed. [%s]", pErrorMsg);
+               dlclose(pHandle);
+               return -1;
+       }
+
+       ret = app_label_dir(pLabel, pDirPath);
+       AppLog("[smack] app_label_dir(%s, %s), result = [%d]", pLabel, pDirPath, ret);
+
+       dlclose(pHandle);
+
+       return 0;
+}
+
+int
+SmackManager::AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath)
+{
+       int ret = 0;
+       void* pHandle = null;
+       char* pErrorMsg = null;
+       int (*app_label_shared_dir)(const char*, const char*, const char*) = null;
+
+       pHandle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_GLOBAL);
+       if (!pHandle)
+       {
+               AppLog("AddLabelSharedDir(): dlopen() failed. [%s]", dlerror());
+               return -1;
+       }
+
+       app_label_shared_dir = reinterpret_cast <int (*)(const char*, const char*, const char*)>(dlsym(pHandle, "app_label_shared_dir"));
+       pErrorMsg = dlerror();
+       if (pErrorMsg != null)
+       {
+               AppLog("AddLabelSharedDir(): dlsym() failed. [%s]", pErrorMsg);
+               dlclose(pHandle);
+               return -1;
+       }
+
+       ret = app_label_shared_dir(pLabel, pSharedLabel, pDirPath);
+       AppLog("[smack] app_label_shared_dir(%s, %s, %s), result = [%d]", pLabel, pSharedLabel, pDirPath, ret);
+
+       dlclose(pHandle);
+
+       return 0;
+}
+
+int
+SmackManager::AddPermissions(const char* pPackageId, const char** ppPermissions)
+{
+       int ret = 0;
+       void* pHandle = null;
+       char* pErrorMsg = null;
+       int (*app_add_permissions)(const char*, const char**) = null;
+
+       pHandle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_GLOBAL);
+       if (!pHandle)
+       {
+               AppLog("AddPermissions(): dlopen() failed. [%s][%s]", pPackageId, dlerror());
+               return -1;
+       }
+
+       app_add_permissions = reinterpret_cast <int (*)(const char*, const char**)>(dlsym(pHandle, "app_add_permissions"));
+       pErrorMsg = dlerror();
+       if (pErrorMsg != null)
+       {
+               AppLog("AddPermissions(): dlsym() failed. [%s][%s]", pPackageId, pErrorMsg);
+               dlclose(pHandle);
+               return -1;
+       }
+
+       ret = app_add_permissions(pPackageId, ppPermissions);
+       AppLog("[smack] app_add_permissions(%s), result = [%d]", pPackageId, ret);
+
+       dlclose(pHandle);
+
+       return 0;
+}
+
+int
+SmackManager::RevokePermissions(const char* pPackageId)
+{
+       int ret = 0;
+       void* pHandle = null;
+       char* pErrorMsg = null;
+       int (*app_revoke_permissions)(const char*) = null;
+
+       pHandle = dlopen("libprivilege-control.so.0", RTLD_LAZY | RTLD_GLOBAL);
+       if (!pHandle)
+       {
+               AppLog("RevokePermissions(): dlopen() failed. [%s][%s]", pPackageId, dlerror());
+               return -1;
+       }
+
+       app_revoke_permissions = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "app_revoke_permissions"));
+       pErrorMsg = dlerror();
+       if (pErrorMsg != null)
+       {
+               AppLog("RevokePermissions(): dlsym() failed. [%s][%s]", pPackageId, pErrorMsg);
+               dlclose(pHandle);
+               return -1;
+       }
+
+       ret = app_revoke_permissions(pPackageId);
+       AppLog("[smack] app_revoke_permissions(%s), result = [%d]", pPackageId, ret);
+
+       dlclose(pHandle);
+
+       return 0;
+}
diff --git a/src/Manager/SmackManager.h b/src/Manager/SmackManager.h
new file mode 100755 (executable)
index 0000000..6ee90e3
--- /dev/null
@@ -0,0 +1,55 @@
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+/**
+ * @file       SmackManager.h
+ * @brief      This is the header file for the %SmackManager class.
+ *
+ * This header file contains the declarations of the %SmackManager class.
+ */
+#ifndef _SMACK_MANAGER_H_
+#define _SMACK_MANAGER_H_
+
+#include <FAppTypes.h>
+
+#include "InstallationContext.h"
+
+class SmackManager
+{
+public:
+       SmackManager(void);
+       virtual ~SmackManager(void);
+
+       bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false);
+       bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath, InstallationContext* pContext);
+       bool AddPermissions(const Tizen::App::PackageId& packageId);
+       bool RevokePermissions(const Tizen::App::PackageId& packageId);
+
+private:
+       bool IsSmackEnable();
+
+       int AddLabelDir(const char* pLabel, const char* pDirPath);
+       int AddLabelSharedDir(const char* pLabel, const char* pSharedLabel, const char* pDirPath);
+       int AddPermissions(const char* pPackageId, const char** ppPermissions);
+       int RevokePermissions(const char* pPackageId);
+
+private:
+       bool __isSmackEnable;
+
+
+}; // SmackManager
+
+#endif // _SMACK_MANAGER_H_
index 9be5f1b..c6c1fe9 100755 (executable)
@@ -36,10 +36,6 @@ InstallerError
 DrmStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " DrmStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-
        __pContext = pContext;
 
        while (true)
@@ -47,32 +43,27 @@ DrmStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_DRM_CHECKING:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DRM_CHECKING]");
                        error = OnDrmChecking();
                        break;
 
                case STATE_DRM_PURCHASE_REQUEST:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DRM_PURCHASE_REQUEST]");
                        error = OnPurchaseRequest();
                        break;
 
                case STATE_DRM_LICENSE_REQUEST:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DRM_LICENSE_REQUEST]");
                        error = OnLicenseRequest();
                        break;
 
                case STATE_DRM_LICENSE_RESPONSE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DRM_LICENSE_RESPONSE]");
                        error = OnLicenseResponse();
                        break;
 
                case STATE_DRM_DECRYPT:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DRM_DECRYPT]");
                        error = OnDecryptPackage();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -87,9 +78,6 @@ DrmStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " DrmStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
                        break;
                }
        }
index 6d76c99..822561d 100755 (executable)
@@ -36,9 +36,7 @@ InstallerError
 LicenseStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " LicenseStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog(" LicenseStep - START");
 
        __pContext = pContext;
 
@@ -47,12 +45,12 @@ LicenseStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_LICENSE_VERIFICATION:
-                       AppLogTag(OSP_INSTALLER, "[STATE_LICENSE_VERIFICATION]");
+                       AppLog("[STATE_LICENSE_VERIFICATION]");
                        error = OnStateLicenseVerification();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -67,9 +65,7 @@ LicenseStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " LicenseStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog(" LicenseStep - END");
                        break;
                }
        }
index d055799..e6131d3 100755 (executable)
 #include <FIoFile.h>
 
 #include <FBase_StringConverter.h>
-#include <FAppPkg_PackageInfoImpl.h>
 
 #include "InstallationContext.h"
 #include "ManifestHandler.h"
 #include "ManifestXmlStep.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
 ManifestXmlStep::ManifestXmlStep(void)
@@ -48,9 +47,9 @@ InstallerError
 ManifestXmlStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " ManifestXmlStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
+       AppLog(" ManifestXmlStep - START");
+       AppLog("------------------------------------------");
 
        __pContext = pContext;
 
@@ -59,12 +58,12 @@ ManifestXmlStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_MANIFEST_XML:
-                       AppLogTag(OSP_INSTALLER, "[STATE_MANIFEST]");
+                       AppLog("[STATE_MANIFEST]");
                        error = OnStateManifestXml();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -79,9 +78,9 @@ ManifestXmlStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " ManifestXmlStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog("------------------------------------------");
+                       AppLog(" ManifestXmlStep - END");
+                       AppLog("------------------------------------------");
 
                        break;
                }
@@ -101,29 +100,39 @@ ManifestXmlStep::OnStateManifestXml(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
        bool ret = false;
-       _PackageInfoImpl *pPackageInfoImpl = null;
        String manifestXmlPath;
        result r = E_SUCCESS;
 
-       manifestXmlPath = __pContext->GetManifestXmlPath();
+       if (__pContext->__isPreloaded == true)
+       {
+               PackageId packageId;
+               String preloadedAppPath(PATH_USR_APPS);
+               preloadedAppPath += L"/";
+               String path = __pContext->__installDir;
+
+               path.SubString(preloadedAppPath.GetLength(), PACKAGE_ID_LENGTH, packageId);
+               preloadedAppPath += packageId;
+
+               manifestXmlPath = preloadedAppPath + PACKAGE_XML_FILE;
+       }
+       else
+       {
+               manifestXmlPath = __pContext->__installDir + PACKAGE_XML_FILE;
+       }
+
+       AppLog("manifest file=[%ls]", manifestXmlPath.GetPointer());
 
        FileAttributes attr;
        r = File::GetAttributes(manifestXmlPath, attr);
-       TryReturn(!IsFailed(r), INSTALLER_ERROR_MANIFEST_NOT_FOUND, "[osp-installer] File::GetAttributes() failed");
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_MANIFEST_NOT_FOUND, "File::GetAttributes() failed");
 
        std::unique_ptr<char[]> pFilepath(_StringConverter::CopyToCharArrayN(manifestXmlPath));
-       TryReturn(pFilepath, INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] pFilepath is null");
-
-       AppLogTag(OSP_INSTALLER, "manifest file=[%ls]", manifestXmlPath.GetPointer());
+       TryReturn(pFilepath, INSTALLER_ERROR_OUT_OF_MEMORY, "pFilepath is null");
 
        ManifestHandler manifestHandler;
        manifestHandler.Construct(__pContext);
        ret = manifestHandler.Parse(pFilepath.get());
-       TryReturn(ret == true, INSTALLER_ERROR_MANIFEST_INVALID, "[osp-installer] manifestHandler.Parse() failed");
-
-       pPackageInfoImpl = __pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pPackageInfoImpl is null");
-       __pContext->SetId(pPackageInfoImpl->GetId());
+       TryReturn(ret == true, INSTALLER_ERROR_MANIFEST_INVALID, "manifestHandler.Parse() failed");
 
        GoNextState();
 
index 5c5813a..839be4c 100755 (executable)
@@ -44,9 +44,7 @@ InstallerError
 PackageCheckStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " PackageCheckStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog(" PackageCheckStep - START");
 
        __pContext = pContext;
 
@@ -55,12 +53,12 @@ PackageCheckStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_PACKAGE_CHECK:
-                       AppLogTag(OSP_INSTALLER, "[STATE_PACKAGE_CHECK]");
+                       AppLog("[STATE_PACKAGE_CHECK]");
                        error = OnStatePackageCheck();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -75,9 +73,7 @@ PackageCheckStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " PackageCheckStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog(" PackageCheckStep - END");
                        break;
                }
        }
@@ -97,7 +93,7 @@ PackageCheckStep::OnStatePackageCheck(void)
        InstallerError error = INSTALLER_ERROR_NONE;
        String tempDir;
 
-       if (__pContext->GetInstallationStorage() == InstallationContext::INSTALLATION_STORAGE_INTERNAL)
+       if (__pContext->__storage == INSTALLATION_STORAGE_INTERNAL)
        {
                tempDir = DIR_OSP_APPLICATIONS_TEMP;
        }
@@ -106,38 +102,37 @@ PackageCheckStep::OnStatePackageCheck(void)
                tempDir = DIR_MEMORYCARD_OSP_APPLICATIONS_TEMP;
        }
 
-       __pContext->SetTemporaryDir(tempDir);
-       __pContext->SetInstallDir(tempDir);
+       __pContext->__installDir = tempDir;
 
        if (File::IsFileExist(DIR_OSP_APPLICATIONS_TEMP) == false)
        {
                result r = E_SUCCESS;
                r = Directory::Create(DIR_OSP_APPLICATIONS_TEMP, false);
-               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed");
+               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed");
        }
 
-       String packagePath = __pContext->GetPackagePath();
+       String packagePath = __pContext->__packagePath;
        if (InstallerUtil::IsDrmFile(packagePath) == true)
        {
                bool res = false;
                res = InstallerUtil::DecryptPackage(packagePath);
-               TryReturn(res == true, INSTALLER_ERROR_DRM, "[osp-installer] InstallerUtil::DecryptPackage() failed");
+               TryReturn(res == true, INSTALLER_ERROR_DRM, "InstallerUtil::DecryptPackage() failed");
        }
 
        FileUnzipper unzipper;
        unzipper.Construct(packagePath);
 
-       AppLogTag(OSP_INSTALLER, "UnzipTo(manifest.xml) - START");
+       AppLog("UnzipTo(manifest.xml) - START");
        unzipper.UnzipTo(tempDir, L"info/manifest.xml");
        unzipper.UnzipTo(tempDir, L"signature1.xml");
        unzipper.UnzipTo(tempDir, L"author-signature.xml");
-       AppLogTag(OSP_INSTALLER, "UnzipTo(manifest.xml) - END");
+       AppLog("UnzipTo(manifest.xml) - END");
 
        if ((File::IsFileExist(__pContext->GetSignatureXmlPath()) == true) &&
                        (File::IsFileExist(__pContext->GetAuthorSignatureXmlPath()) == true))
        {
-               AppLogTag(OSP_INSTALLER, "[VerifySignature] VerificationMode ON");
-               __pContext->SetVerificationMode(true);
+               AppLog("[VerifySignature] VerificationMode ON");
+               __pContext->__isVerificationMode = true;
        }
 
        GoNextState();
index fab780f..3d83b16 100755 (executable)
@@ -20,7 +20,6 @@
  */
 
 #include <FIoFile.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "InstallationContext.h"
@@ -28,7 +27,7 @@
 #include "SignatureHandler.h"
 #include "SignatureStep.h"
 
-using namespace Tizen::App::Package;
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Io;
@@ -49,15 +48,13 @@ InstallerError
 SignatureStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " SignatureStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog(" SignatureStep - START");
 
        __pContext = pContext;
 
-       if (__pContext->IsVerificationMode() == false)
+       if (__pContext->__isVerificationMode == false)
        {
-               AppLogTag(OSP_INSTALLER, "no signature file[%ls]", __pContext->GetSignatureXmlPath().GetPointer());
+               AppLog("no signature file[%ls]", __pContext->GetSignatureXmlPath().GetPointer());
                return INSTALLER_ERROR_NONE;
        }
 
@@ -66,22 +63,22 @@ SignatureStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_SIGNER_CERT:
-                       AppLogTag(OSP_INSTALLER, "[STATE_SIGNER_CERT]");
+                       AppLog("[STATE_SIGNER_CERT]");
                        error = OnStateSignerCert();
                        break;
 
                case STATE_CERT_CHAIN:
-                       AppLogTag(OSP_INSTALLER, "[STATE_CERT_CHAIN]");
+                       AppLog("[STATE_CERT_CHAIN]");
                        error = OnStateCertChain();
                        break;
 
                case STATE_ROOT_CERT:
-                       AppLogTag(OSP_INSTALLER, "[STATE_ROOT_CERT]");
+                       AppLog("[STATE_ROOT_CERT]");
                        error = OnStateRootCert();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -96,9 +93,7 @@ SignatureStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " SignatureStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog(" SignatureStep - END");
                        break;
                }
        }
@@ -119,13 +114,13 @@ SignatureStep::OnStateSignerCert(void)
        bool ret = true;
 
        __pSignatureManager = new (std::nothrow) SignatureManager();
-       TryCatch(__pSignatureManager, error = INSTALLER_ERROR_OUT_OF_MEMORY, "[osp-installer] __pSignatureManager is null.");
+       TryCatch(__pSignatureManager, error = INSTALLER_ERROR_OUT_OF_MEMORY, "__pSignatureManager is null.");
 
        ret = __pSignatureManager->Construct(__pContext);
-       TryCatch(ret == true, error = INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Construct() failed");
+       TryCatch(ret == true, error = INSTALLER_ERROR_INTERNAL_STATE, "Construct() failed");
 
        ret = __pSignatureManager->SetSignature();
-       TryCatch(ret == true, error = INSTALLER_ERROR_SIGNATURE_INVALID, "[osp-installer] SetSignature() failed");
+       TryCatch(ret == true, error = INSTALLER_ERROR_SIGNATURE_INVALID, "SetSignature() failed");
 
 CATCH:
        GoNextState();
@@ -139,10 +134,10 @@ SignatureStep::OnStateCertChain(void)
        bool ret = true;
 
        ret = __pSignatureManager->AddCert();
-       TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "[osp-installer] AddCert(DEVELOPER_ROOT_CERTIFICATE) failed");
+       TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "AddCert(DEVELOPER_ROOT_CERTIFICATE) failed");
 
        ret = __pSignatureManager->VerifyChain();
-       TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "[osp-installer] VerifyChain() failed");
+       TryCatch(ret == true, error = INSTALLER_ERROR_CERTIFICATE_CHAIN_VERIFICATION_FAILED, "VerifyChain() failed");
 
 CATCH:
        GoNextState();
@@ -156,20 +151,24 @@ SignatureStep::OnStateRootCert(void)
        result r = E_SUCCESS;
        String privileges;
        String hmacPrivileges;
+       ArrayList stringPrivilegeList;
+       stringPrivilegeList.Construct();
 
        const ArrayList* pPrivilegeList = __pContext->GetPrivilegeList();
-       RootCertificateType certType = __pContext->GetRootCertType();
-       _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
-       String appId = pPackageInfoImpl->GetId();
+       RootCertificateType certType = __pContext->__rootCertType;
+       PackageId packageId = __pContext->__packageId;
        int apiVisibility = GetApiVisibility(certType);
 
-       AppLogTag(OSP_INSTALLER, "AppId = [%ls], CertType = [%d], ApiVisibility = [%d]", appId.GetPointer(), certType, apiVisibility);
+       AppLog("PackageId = [%ls], CertType = [%d], ApiVisibility = [%d]", packageId.GetPointer(), certType, apiVisibility);
 
-       r = PrivilegeHandler::GenerateCipherPrivilege(appId, *pPrivilegeList, apiVisibility, privileges, hmacPrivileges);
-       TryCatch(!IsFailed(r), error = INSTALLER_ERROR_PRIVILEGE_INVALID, "[osp-installer] privMgr.GeneratePrivilegeString() failed");
+       r = PrivilegeHandler::GenerateCipherPrivilege(packageId, *pPrivilegeList, apiVisibility, privileges, hmacPrivileges, stringPrivilegeList);
+       TryCatch(!IsFailed(r), error = INSTALLER_ERROR_PRIVILEGE_INVALID, "privMgr.GeneratePrivilegeString() failed");
 
-       pPackageInfoImpl->SetPrivilegesValue(privileges, hmacPrivileges);
-       pPackageInfoImpl->SetCertType(apiVisibility);
+       __pContext->__privileges = privileges;
+       __pContext->__hmacPrivileges = hmacPrivileges;
+       __pContext->__certType = apiVisibility;
+       __pContext->__pStringPrivilegeList = new ArrayList;
+       __pContext->__pStringPrivilegeList->Construct(stringPrivilegeList);
 
 CATCH:
        GoNextState();
index fb9c9be..5e7fe19 100755 (executable)
  * @brief      This is the implementation file for %SystemCheckStep class.
  */
 
+#include <FAppPkgPackageInfo.h>
+#include <FAppPkgPackageAppInfo.h>
+#include <FAppPkg_PackageInfoImpl.h>
+#include <FAppPkg_PackageManagerImpl.h>
+#include <FApp_Aul.h>
+
 #include "InstallationContext.h"
 #include "SystemCheckStep.h"
 
+using namespace Tizen::App;
+using namespace Tizen::App::Package;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
 SystemCheckStep::SystemCheckStep(void)
-:__state(STATE_SYSTEM_CHECK)
+:__state(STATE_VERSION_CHECK)
 ,__pContext(null)
 {
 }
@@ -37,33 +48,25 @@ SystemCheckStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " SystemCheckStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-
        __pContext = pContext;
 
        while (true)
        {
                switch (__state)
                {
-               case STATE_SYSTEM_CHECK:
-                       AppLogTag(OSP_INSTALLER, "[STATE_SYSTEM_CHECK]");
-                       error = OnStateSystemCheck();
+               case STATE_VERSION_CHECK:
+                       error = OnStateVersionCheck();
                        break;
 
                case STATE_AGENT_CHECK:
-                       AppLogTag(OSP_INSTALLER, "[STATE_AGENT_CHECK]");
                        error = OnStateAgentCheck();
                        break;
 
                case STATE_AGENT_TIMER:
-                       AppLogTag(OSP_INSTALLER, "[STATE_AGENT_TIMER]");
                        error = OnStateAgentTimer();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -78,9 +81,6 @@ SystemCheckStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " SystemCheckStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
                        break;
                }
        }
@@ -95,12 +95,61 @@ SystemCheckStep::GoNextState(void)
 }
 
 InstallerError
-SystemCheckStep::OnStateSystemCheck(void)
+SystemCheckStep::OnStateVersionCheck(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
+       int res = 0;
+
+       std::unique_ptr< PackageInfo > pPackageInfo(_PackageManagerImpl::GetInstance()->GetPackageInfoN(__pContext->__packageId));
+       if (pPackageInfo)
+       {
+               String oldVersion = pPackageInfo->GetVersion();
+               String newVersion = __pContext->__version;
+
+               res = CompareVersion(oldVersion, newVersion);
+
+               if (res == VERSION_SAME)
+               {
+                       AppLog("Same version: packageId = [%ls], version = [%ls]", __pContext->__packageId.GetPointer(), oldVersion.GetPointer());
+               }
+               else if (res == VERSION_NEW)
+               {
+                       __pContext->__isUpdated = true;
+
+                       AppLog("Update version: packageId = [%ls]", __pContext->__packageId.GetPointer());
+                       AppLog("Update version: oldVersion = [%ls] -> newVersion = [%ls]", oldVersion.GetPointer(), newVersion.GetPointer());
+
+                       _PackageInfoImpl* pPackageInfoImpl = _PackageInfoImpl::GetInstance(pPackageInfo.get());
+                       TryReturn(pPackageInfoImpl, INSTALLER_ERROR_INTERNAL_STATE, "GetInstance() failed.");
+
+                       std::unique_ptr< IList > pPackageAppList(pPackageInfoImpl->GetPackageAppInfoListN());
+                       TryReturn(pPackageAppList, INSTALLER_ERROR_INTERNAL_STATE, "GetPackageAppInfoListN() failed.");
+
+                       for (int i = 0; i < pPackageAppList->GetCount(); i++)
+                       {
+                               PackageAppInfo* pPackageAppInfo = dynamic_cast <PackageAppInfo*>(pPackageAppList->GetAt(i));
+                               TryReturn(pPackageAppInfo, INSTALLER_ERROR_INTERNAL_STATE, "pPackageAppList->GetAt(%d) failed.", i);
+
+                               AppId appId = pPackageAppInfo->GetAppId();
+
+                               res = CheckAppStatus(appId);
+                               TryReturn(res, INSTALLER_ERROR_FATAL_ERROR, "CheckAppStatus(%ls) failed.", appId.GetPointer());
+                       }
+               }
+               else if (res == VERSION_OLD)
+               {
+                       AppLog("Lower version: oldVersion = [%ls] -> newVersion = [%ls]", oldVersion.GetPointer(), newVersion.GetPointer());
+                       return INSTALLER_ERROR_PACKAGE_LOWER_VERSION;
+               }
+               else
+               {
+                       AppLog("Invalid version: oldVersion = [%ls] -> newVersion = [%ls]", oldVersion.GetPointer(), newVersion.GetPointer());
+                       return INSTALLER_ERROR_MANIFEST_INVALID;
+               }
+       }
 
        // Check preferred storage
-       __pContext->SetInstallationStorage(InstallationContext::INSTALLATION_STORAGE_INTERNAL);
+       __pContext->__storage = INSTALLATION_STORAGE_INTERNAL;
 
        GoNextState();
        return error;
@@ -132,3 +181,124 @@ SystemCheckStep::OnStateDone(void)
        GoNextState();
        return error;
 }
+
+int
+SystemCheckStep::CompareVersion(const String& oldVersion, const String& newVersion)
+{
+       bool res = true;
+       int oldVersionMajor = 0;
+       int oldVersionMinor = 0;
+       int oldVersionMacro = 0;
+       int newVersionMajor = 0;
+       int newVersionMinor = 0;
+       int newVersionMacro = 0;
+
+       res = ExtractVersion(oldVersion, oldVersionMajor, oldVersionMinor, oldVersionMacro);
+       TryReturn(res, VERSION_ERROR, "ExtractVersion() failed. [%ls]", oldVersion.GetPointer());
+
+       res = ExtractVersion(newVersion, newVersionMajor, newVersionMinor, newVersionMacro);
+       TryReturn(res, VERSION_ERROR, "ExtractVersion() failed. [%ls]", newVersion.GetPointer());
+
+       if (newVersionMajor > oldVersionMajor)
+       {
+               return VERSION_NEW;
+       }
+       else if (newVersionMajor < oldVersionMajor)
+       {
+               return VERSION_OLD;
+       }
+
+       if (newVersionMinor > oldVersionMinor)
+       {
+               return VERSION_NEW;
+       }
+       else if (newVersionMinor < oldVersionMinor)
+       {
+               return VERSION_OLD;
+       }
+
+       if (newVersionMacro > oldVersionMacro)
+       {
+               return VERSION_NEW;
+       }
+       else if (newVersionMacro < oldVersionMacro)
+       {
+               return VERSION_OLD;
+       }
+
+       return VERSION_SAME;
+}
+
+bool
+SystemCheckStep::ExtractVersion(const String& version, int& major, int& minor, int& macro)
+{
+       result r = E_SUCCESS;
+       int indexOf = 0;
+       int startIndex = 0;
+       String majorStr;
+       String minorStr;
+       String macroStr;
+
+       r = version.IndexOf(L'.', startIndex, indexOf);
+       TryReturn(r == E_SUCCESS, false, "version.IndexOf() failed. [%ls]", version.GetPointer());
+
+       version.SubString(startIndex, indexOf - startIndex, majorStr);
+       startIndex = indexOf + 1;
+
+       r = version.IndexOf(L'.', startIndex, indexOf);
+       TryReturn(r == E_SUCCESS, false, "version.IndexOf() failed. [%ls]", version.GetPointer());
+
+       version.SubString(startIndex, indexOf - startIndex, minorStr);
+       startIndex = indexOf + 1;
+
+       version.SubString(startIndex, macroStr);
+
+       Integer::Decode(majorStr, major);
+       Integer::Decode(minorStr, minor);
+       Integer::Decode(macroStr, macro);
+
+       AppLog("version = [%ls] -> major = [%d], minor = [%d], macro = [%d]", version.GetPointer(), major, minor, macro);
+
+       return true;
+}
+
+bool
+SystemCheckStep::CheckAppStatus(const AppId& appId)
+{
+       bool res = true;
+
+       if (_Aul::IsRunning(appId) == true)
+       {
+               AppLog("App(%ls) is running.", appId.GetPointer());
+
+               result r = _Aul::TerminateApplication(appId);
+               TryReturn(r == E_SUCCESS, false, "TerminateApplication() failed. [%ls]", appId.GetPointer());
+
+               for (int j = 0; j < TERMINATE_RETRY_COUNT; j++)
+               {
+                       res = _Aul::IsRunning(appId);
+                       if (res == false)
+                       {
+                               AppLog("App(%ls) is terminated.", appId.GetPointer());
+                               break;
+                       }
+                       else
+                       {
+                               AppLog("App(%ls) is not terminated yet. wait count = [%d]", appId.GetPointer(), j);
+                               usleep(100000);
+                       }
+               }
+
+               if (res == true)
+               {
+                       AppLog("App(%ls) can't be terminated.", appId.GetPointer());
+                       return false;
+               }
+       }
+       else
+       {
+               AppLog("App(%ls) is not running.", appId.GetPointer());
+       }
+
+       return true;
+}
old mode 100644 (file)
new mode 100755 (executable)
index 506f587..0585f73
@@ -45,18 +45,30 @@ public:
 private:
        enum
        {
-               STATE_SYSTEM_CHECK,
+               STATE_VERSION_CHECK,
                STATE_AGENT_CHECK,
                STATE_AGENT_TIMER,
                STATE_DONE
        };
 
+       enum
+       {
+               VERSION_ERROR,
+               VERSION_OLD,
+               VERSION_SAME,
+               VERSION_NEW
+       };
+
        void GoNextState(void);
-       InstallerError OnStateSystemCheck(void);
+       InstallerError OnStateVersionCheck(void);
        InstallerError OnStateAgentCheck(void);
        InstallerError OnStateAgentTimer(void);
        InstallerError OnStateDone(void);
 
+       int CompareVersion(const Tizen::Base::String& oldVersion, const Tizen::Base::String& newVersion);
+       bool ExtractVersion(const Tizen::Base::String& version, int& major, int& minor, int& macro);
+       bool CheckAppStatus(const Tizen::App::AppId& appId);
+
 private:
        int __state;
        InstallationContext* __pContext;
index 27209e0..236ddec 100755 (executable)
@@ -21,6 +21,8 @@
 
 #include <unique_ptr.h>
 
+#include <app2ext_interface.h>
+
 #include <FIoDirectory.h>
 #include <FIo_FileImpl.h>
 #include <FBase_StringConverter.h>
@@ -34,6 +36,7 @@
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::App;
 using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
@@ -51,9 +54,7 @@ InstallerError
 UninstallStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " UninstallStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog(" UninstallStep - START");
 
        __pContext = pContext;
 
@@ -62,32 +63,32 @@ UninstallStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_GET_PACKAGEINFO:
-                       AppLogTag(OSP_INSTALLER, "[STATE_GET_PACKAGEINFO]");
+                       AppLog("[STATE_GET_PACKAGEINFO]");
                        error = OnStateGetPackageInfo();
                        break;
 
                case STATE_CHECK_APP_RUNNING:
-                       AppLogTag(OSP_INSTALLER, "[STATE_CHECK_APP_RUNNING]");
+                       AppLog("[STATE_CHECK_APP_RUNNING]");
                        error = OnStateCheckAppRunning();
                        break;
 
                case STATE_TERMINATE_APP:
-                       AppLogTag(OSP_INSTALLER, "[STATE_TERMINATE_APP]");
+                       AppLog("[STATE_TERMINATE_APP]");
                        error = OnStateTerminateApp();
                        break;
 
                case STATE_START_TIMER:
-                       AppLogTag(OSP_INSTALLER, "[STATE_START_TIMER]");
+                       AppLog("[STATE_START_TIMER]");
                        error = OnStateStartTimer();
                        break;
 
                case STATE_DELETE_DIR:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DELETE_DIR]");
+                       AppLog("[STATE_DELETE_DIR]");
                        error = OnStateRemoveDir();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -102,9 +103,7 @@ UninstallStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " UninstallStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog(" UninstallStep - END");
                        break;
                }
        }
@@ -122,17 +121,23 @@ InstallerError
 UninstallStep::OnStateGetPackageInfo(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       String appId = __pContext->GetId();
+       PackageId packageId = __pContext->__packageId;
+
+       std::unique_ptr< _PackageInfoImpl > pPackageInfoImpl(new (std::nothrow) _PackageInfoImpl());
+       TryReturn(pPackageInfoImpl, INSTALLER_ERROR_OUT_OF_MEMORY, "pPackageInfoImpl is null.");
 
-       _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pPackageInfoImpl is null");
+       AppLog("packageId = %ls", packageId.GetPointer());
+       pPackageInfoImpl->Construct(packageId);
 
-       AppLogTag(OSP_INSTALLER, "appId = %S", appId.GetPointer());
-       pPackageInfoImpl->Construct(appId);
+       __pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
+       if (__pContext->__rootPath.StartsWith(PATH_USR_APPS, 0) == true)
+       {
+               __pContext->__isPreloaded = true;
+       }
 
-       if (__pContext->IsHybridService() == true)
+       if (__pContext->__isHybridService == true)
        {
-               AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService");
+               AppLog("Uninstallation for HybridService");
                __state = STATE_DELETE_DIR;
                return error;
        }
@@ -142,32 +147,41 @@ UninstallStep::OnStateGetPackageInfo(void)
                int res = 0;
                app2ext_handle* pHandle = null;
 
-               std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-               TryReturn(pAppId, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pAppId is null");
+               std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+               TryReturn(pPackageId, INSTALLER_ERROR_INTERNAL_STATE, "pAppId is null");
 
                pHandle = app2ext_init(APP2EXT_SD_CARD);
-               TryReturn(pHandle, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] app2ext_init() failed");
+               TryReturn(pHandle, INSTALLER_ERROR_INTERNAL_STATE, "app2ext_init() failed");
 
-               res = pHandle->interface.pre_uninstall(pAppId.get());
-               TryReturn(res == 0, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pHandle->interface.pre_uninstall() failed [%d]", res);
+               res = pHandle->interface.pre_uninstall(pPackageId.get());
+               TryReturn(res == 0, INSTALLER_ERROR_INTERNAL_STATE, "pHandle->interface.pre_uninstall() failed [%d]", res);
 
-               __pContext->SetApp2ExtHandle(pHandle);
+               __pContext->__pApp2ExtHandle = (void*)pHandle;
 
-               AppLogTag(OSP_INSTALLER, "[app2sd] pre_uninstall(%s)", pAppId.get());
+               AppLog("[app2sd] pre_uninstall(%s)", pPackageId.get());
        }
 
        ArrayList* pList = pPackageInfoImpl->GetAppInfoListN();
-       TryReturn(pList, INSTALLER_ERROR_DATABASE, "[osp-installer] pList is null.");
+       TryReturn(pList, INSTALLER_ERROR_DATABASE, "pList is null.");
 
        for (int i = 0; i < pList->GetCount(); i++)
        {
                _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pList->GetAt(i));
                if (pAppInfoImpl)
                {
-                       pPackageInfoImpl->AddAppInfo(*pAppInfoImpl);
-                       pAppInfoImpl = null;
+                       AppData* pAppData = new (std::nothrow) AppData;
+                       TryReturn(pAppData, INSTALLER_ERROR_OUT_OF_MEMORY, "pAppData is null");
+
+                       error = pAppData->Construct();
+                       TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "pAppData->Construct() failed.");
+
+                       pAppData->__appId = pAppInfoImpl->GetPackageName();
+                       pAppData->__feature = pAppInfoImpl->GetAppFeature();
+
+                       __pContext->__pAppDataList->Add(pAppData);
                }
        }
+       delete pList;
 
        __state = STATE_DELETE_DIR;
 
@@ -207,12 +221,9 @@ UninstallStep::OnStateRemoveDir(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
 
-       _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
-       TryReturn(pPackageInfoImpl, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pPackageInfoImpl is null");
-
        String rootPath;
-       rootPath = pPackageInfoImpl->GetAppRootPath();
-       AppLogTag(OSP_INSTALLER, "rootPath[%ls]", rootPath.GetPointer());
+       rootPath = __pContext->__rootPath;
+       AppLog("rootPath = [%ls]", rootPath.GetPointer());
 
        String compatPath(rootPath);
        compatPath.Append(L"/info/compat.info");
@@ -222,22 +233,22 @@ UninstallStep::OnStateRemoveDir(void)
        {
                if (_FileImpl::FinalizeDataCaging(rootPath) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "[Tizen::Io] Failed to unmount directories for 2.0 application, appRootPath: %ls",
+                       AppLog("[Tizen::Io] Failed to unmount directories for 2.0 application, appRootPath: %ls",
                                        rootPath.GetPointer());
                        return INSTALLER_ERROR_UNMOUNT_FAILED;
                }
        }
        else if (r != E_SUCCESS)
        {
-               AppLogTag(OSP_INSTALLER, "[Tizen::Io] Failed to access %ls", compatPath.GetPointer());
+               AppLog("[Tizen::Io] Failed to access %ls", compatPath.GetPointer());
                return INSTALLER_ERROR_UNMOUNT_FAILED;
        }
 
-       AppLogTag(OSP_INSTALLER, "Directory::Remove - START");
+       AppLog("Directory::Remove - START");
 
-       if (__pContext->IsHybridService() == true)
+       if (__pContext->__isHybridService == true)
        {
-               AppLogTag(OSP_INSTALLER, "Uninstallation for HybridService - skip Remove");
+               AppLog("Uninstallation for HybridService - skip Remove");
 
        }
        else
@@ -254,29 +265,27 @@ UninstallStep::OnStateRemoveDir(void)
                InstallerUtil::Remove(rootPath);
        }
 
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
+       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+       TryReturn(pAppDataList, INSTALLER_ERROR_INTERNAL_STATE, "pAppDataList is null");
 
-       pAppList = pPackageInfoImpl->GetAppInfoList();
-       for (int i = 0 ; i < pAppList->GetCount(); i++)
+       int count = pAppDataList->GetCount();
+       for (int i = 0; i < count; i++)
        {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
-               {
-                       String packageName = pAppInfoImpl->GetPackageName();
-                       String destPath;
-                       destPath.Format(1024, L"%S/%S", SLP_APP_PATH, packageName.GetPointer());
-                       InstallerUtil::Remove(destPath);
+               AppData* pAppData = null;
+               pAppDataList->GetAt(i, pAppData);
 
-                       if (pAppInfoImpl->GetAppFeature() == CATEGORY_TYPE_IME)
+               if (pAppData)
+               {
+                       if (pAppData->__feature == CATEGORY_TYPE_IME)
                        {
                                String symlinkPath;
-                               symlinkPath.Format(1024, L"%s/%ls.so", IME_PATH, packageName.GetPointer());
+                               symlinkPath.Format(1024, L"%s/%ls.so", IME_PATH, pAppData->__appId.GetPointer());
                                InstallerUtil::Remove(symlinkPath);
                        }
                }
        }
-       AppLogTag(OSP_INSTALLER, "Directory::Remove - END");
+
+       AppLog("Directory::Remove - END");
 
        GoNextState();
        return error;
index 2fbfc46..31e3aaa 100755 (executable)
 
 #include <unique_ptr.h>
 
+#include <app2ext_interface.h>
+
 #include <FIoFile.h>
 #include <FIoDirectory.h>
-#include <FBaseResult.h>
 #include <FBaseUtilFileUnzipper.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "InstallationContext.h"
 #include "UnpackStep.h"
 #include "InstallerUtil.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 
 UnpackStep::UnpackStep(void)
@@ -71,9 +71,7 @@ InstallerError
 UnpackStep::Run(InstallationContext* pContext)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, " UnpackStep - START");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog(" UnpackStep - START");
 
        __pContext = pContext;
 
@@ -82,27 +80,22 @@ UnpackStep::Run(InstallationContext* pContext)
                switch (__state)
                {
                case STATE_UNZIP:
-                       AppLogTag(OSP_INSTALLER, "[STATE_UNZIP]");
+                       AppLog("[STATE_UNZIP]");
                        error = OnUnzip();
                        break;
 
-               case STATE_VERSION_CHECK:
-                       AppLogTag(OSP_INSTALLER, "[STATE_VERSION_CHECK]");
-                       error = OnStateVersionCheck();
-                       break;
-
                case STATE_FILE_MOVE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_FILE_MOVE]");
+                       AppLog("[STATE_FILE_MOVE]");
                        error = OnStateFileMove();
                        break;
 
                case STATE_CREATE_DIR:
-                       AppLogTag(OSP_INSTALLER, "[STATE_CREATE_DIR]");
+                       AppLog("[STATE_CREATE_DIR]");
                        error = OnCreateDir();
                        break;
 
                case STATE_DONE:
-                       AppLogTag(OSP_INSTALLER, "[STATE_DONE]");
+                       AppLog("[STATE_DONE]");
                        error = OnStateDone();
                        break;
 
@@ -117,9 +110,7 @@ UnpackStep::Run(InstallationContext* pContext)
 
                if (__state > STATE_DONE)
                {
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-                       AppLogTag(OSP_INSTALLER, " UnpackStep - END");
-                       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+                       AppLog(" UnpackStep - END");
                        break;
                }
        }
@@ -137,63 +128,59 @@ InstallerError
 UnpackStep::OnUnzip(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
-       _PackageInfoImpl *pPackageInfoImpl = null;
        String newInstallPath;
        app2ext_handle* pHandle = null;
 
        String installPath;
        installPath = PATH_OPT_USR_APPS;
        installPath += "/";
-
-       if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG)
-       {
-               installPath += PACKAGE_NAME_PREFIX_ORG;
-       }
-
-       installPath += __pContext->GetId();
+       installPath += __pContext->__packageId;
 
        result r = E_SUCCESS;
        FileUnzipper unzipper;
-       r = unzipper.Construct(__pContext->GetPackagePath());
-       TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] unzipper.Construct() failed");
+       r = unzipper.Construct(__pContext->__packagePath);
+       TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "unzipper.Construct() failed");
 
-       if (__pContext->GetInstallationStorage() == InstallationContext::INSTALLATION_STORAGE_EXTERNAL)
+       if (__pContext->__storage == INSTALLATION_STORAGE_EXTERNAL)
        {
                int res = 0;
-               String appId = __pContext->GetId();
+               PackageId packageId = __pContext->__packageId;
 
-               std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
-               TryReturn(pAppId, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pAppId is null");
+               std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+               TryReturn(pPackageId, INSTALLER_ERROR_INTERNAL_STATE, "pPackageId is null");
 
                GetUncompressedInfo(unzipper);
-               TryReturn((__pDirectoryList && (__uncompressedSize > 0)), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] GetUncompressedInfo() failed");
+               TryReturn((__pDirectoryList && (__uncompressedSize > 0)), INSTALLER_ERROR_INTERNAL_STATE, "GetUncompressedInfo() failed");
 
                pHandle = app2ext_init(APP2EXT_SD_CARD);
-               TryReturn(pHandle, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] app2ext_init() failed");
+               TryReturn(pHandle, INSTALLER_ERROR_INTERNAL_STATE, "app2ext_init() failed");
 
-               __pContext->SetApp2ExtHandle(pHandle);
+               __pContext->__pApp2ExtHandle = (void*)pHandle;
 
-               res = pHandle->interface.pre_install(pAppId.get(), __pDirectoryList, __uncompressedSize);
-               TryReturn(res == 0, INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] pHandle->interface.pre_install() failed [%d]", res);
+               res = pHandle->interface.pre_install(pPackageId.get(), __pDirectoryList, __uncompressedSize);
+               TryReturn(res == 0, INSTALLER_ERROR_INTERNAL_STATE, "pHandle->interface.pre_install() failed [%d]", res);
 
-               AppLogTag(OSP_INSTALLER, "[app2sd] pre_install(%s)", pAppId.get());
+               AppLog("[app2sd] pre_install(%s)", pPackageId.get());
        }
 
        if (File::IsFileExist(installPath) == false)
        {
                r = Directory::Create(installPath, false);
-               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "[osp-installer] Directory::Create() failed, installPath=%ls", installPath.GetPointer());
+               TryReturn(!IsFailed(r), INSTALLER_ERROR_INTERNAL_STATE, "Directory::Create() failed, installPath=%ls", installPath.GetPointer());
        }
 
        InstallerUtil::CreateSymlinkForAppDirectory(installPath, newInstallPath);
-       __pContext->SetInstallDir(newInstallPath);
+       __pContext->__installDir = newInstallPath;
+       __pContext->__rootPath = newInstallPath;
 
-       pPackageInfoImpl = __pContext->GetPackageInfoImpl();
-       pPackageInfoImpl->SetAppRootPath(newInstallPath);
+       if (__pContext->__isUpdated == true)
+       {
+               RemoveRoDirectory(installPath);
+       }
 
-       AppLogTag(OSP_INSTALLER, "UnzipTo - START");
+       AppLog("UnzipTo - START");
        unzipper.UnzipTo(newInstallPath);
-       AppLogTag(OSP_INSTALLER, "UnzipTo - END");
+       AppLog("UnzipTo - END");
 
        // GoNextState();
        __state = STATE_DONE;
@@ -201,15 +188,6 @@ UnpackStep::OnUnzip(void)
 }
 
 InstallerError
-UnpackStep::OnStateVersionCheck(void)
-{
-       InstallerError error = INSTALLER_ERROR_NONE;
-
-       GoNextState();
-       return error;
-}
-
-InstallerError
 UnpackStep::OnStateFileMove(void)
 {
        InstallerError error = INSTALLER_ERROR_NONE;
@@ -270,7 +248,7 @@ UnpackStep::GetUncompressedInfo(const FileUnzipper& unzipper)
                while((r = entryName.IndexOf(L'/', startIndex, indexOf)) == E_SUCCESS)
                {
                        String* pCurDirectory = new (std::nothrow) String;
-                       TryReturn(pCurDirectory, false, "[osp-installer] pCurDirectory is null.");
+                       TryReturn(pCurDirectory, false, "pCurDirectory is null.");
 
                        entryName.SubString(0, indexOf, *pCurDirectory);
 
@@ -281,7 +259,7 @@ UnpackStep::GetUncompressedInfo(const FileUnzipper& unzipper)
                                        AddDirectory(*pCurDirectory);
                                }
 
-                               AppLogTag(OSP_INSTALLER, "Folder[%ls], Size[%d]", pCurDirectory->GetPointer(), BLOCK_SIZE);
+                               AppLog("Folder[%ls], Size[%d]", pCurDirectory->GetPointer(), BLOCK_SIZE);
                                totalSize += BLOCK_SIZE;
 
                                directoryList.Add(*pCurDirectory);
@@ -311,17 +289,17 @@ UnpackStep::GetUncompressedInfo(const FileUnzipper& unzipper)
                        }
 
                        totalSize += uncompressedSize;
-                       AppLogTag(OSP_INSTALLER, " -File[%ls], UncompressedSize[%d]", entryName.GetPointer(), (int)uncompressedSize);
+                       AppLog(" -File[%ls], UncompressedSize[%d]", entryName.GetPointer(), (int)uncompressedSize);
                }
        }
 
        directoryList.RemoveAll(true);
        __uncompressedSize = (int)(totalSize / (1024 * 1024)) + 1;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "TotalSize = [%d]B", (int)totalSize);
-       AppLogTag(OSP_INSTALLER, "TotalSize = [%d]MB", __uncompressedSize);
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
+       AppLog("TotalSize = [%d]B", (int)totalSize);
+       AppLog("TotalSize = [%d]MB", __uncompressedSize);
+       AppLog("------------------------------------------");
 
 
        return true;
@@ -334,7 +312,7 @@ UnpackStep::AddDirectory(const String& rootDirectory)
        app2ext_dir_details* pDirDetails = null;
 
        pDirDetails = (app2ext_dir_details*) calloc(1, sizeof(app2ext_dir_details));
-       TryReturn(pDirDetails, false, "[osp-installer] pDirDetails is null");
+       TryReturn(pDirDetails, false, "pDirDetails is null");
 
        length = rootDirectory.GetLength();
        pDirDetails->name = (char*) calloc(1, (sizeof(char) * length) + 1);
@@ -349,10 +327,89 @@ UnpackStep::AddDirectory(const String& rootDirectory)
                pDirDetails->type = APP2EXT_DIR_RW;
        }
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "# Root Directory = [%s], Type = [%d]", pDirDetails->name, pDirDetails->type);
+       AppLog("------------------------------------------");
+       AppLog("# Root Directory = [%s], Type = [%d]", pDirDetails->name, pDirDetails->type);
 
        __pDirectoryList = g_list_append(__pDirectoryList, pDirDetails);
 
        return true;
 }
+
+bool
+UnpackStep::RemoveRoDirectory(const String& rootPath)
+{
+       std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
+       TryReturn(pDir, false, "pDir is null.");
+
+       result r = pDir->Construct(rootPath);
+       TryReturn(!IsFailed(r), false, "pDir->Construct() failed. rootPath = [%ls]", rootPath.GetPointer());
+
+       std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
+       TryReturn(pDirEnum, false, "pDirEnum is null.");
+
+       while (pDirEnum->MoveNext() == E_SUCCESS)
+       {
+               DirEntry entry = pDirEnum->GetCurrentDirEntry();
+
+               String entryName = entry.GetName();
+               String srcEntryDir = rootPath;
+               srcEntryDir += L"/";
+               srcEntryDir += entryName;
+
+               if (entryName == L"." || entryName == L"..")
+               {
+                       continue;
+               }
+               else if (entryName == L"data")
+               {
+                       AppLog("skip - directory[%ls]", srcEntryDir.GetPointer());
+                       continue;
+               }
+               else if (entryName == L"shared")
+               {
+                       RemoveSharedDirectory(srcEntryDir);
+                       continue;
+               }
+
+               InstallerUtil::Remove(srcEntryDir);
+       }
+
+       return true;
+}
+
+bool
+UnpackStep::RemoveSharedDirectory(const String& sharedPath)
+{
+       std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
+       TryReturn(pDir, false, "pDir is null.");
+
+       result r = pDir->Construct(sharedPath);
+       TryReturn(!IsFailed(r), false, "pDir->Construct() failed. sharedPath = [%ls]", sharedPath.GetPointer());
+
+       std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
+       TryReturn(pDirEnum, false, "pDirEnum is null.");
+
+       while (pDirEnum->MoveNext() == E_SUCCESS)
+       {
+               DirEntry entry = pDirEnum->GetCurrentDirEntry();
+
+               String entryName = entry.GetName();
+               String srcEntryDir = sharedPath;
+               srcEntryDir += L"/";
+               srcEntryDir += entryName;
+
+               if (entryName == L"." || entryName == L"..")
+               {
+                       continue;
+               }
+               else if (entryName == L"data" || entryName == L"trusted")
+               {
+                       AppLog("skip - directory[%ls]", srcEntryDir.GetPointer());
+                       continue;
+               }
+
+               InstallerUtil::Remove(srcEntryDir);
+       }
+
+       return true;
+}
old mode 100644 (file)
new mode 100755 (executable)
index db7feff..08c5d02
@@ -25,8 +25,6 @@
 
 #include <glib.h>
 
-#include <FBaseUtilFileUnzipper.h>
-
 #include "IInstallationStep.h"
 
 /**
@@ -50,7 +48,6 @@ private:
        enum
        {
                STATE_UNZIP,
-               STATE_VERSION_CHECK,
                STATE_FILE_MOVE,
                STATE_CREATE_DIR,
                STATE_DONE
@@ -58,7 +55,6 @@ private:
 
        void GoNextState(void);
        InstallerError OnUnzip(void);
-       InstallerError OnStateVersionCheck(void);
        InstallerError OnStateFileMove(void);
        InstallerError OnCreateDir(void);
        InstallerError OnStateDone(void);
@@ -67,6 +63,9 @@ private:
        bool GetUncompressedInfo(const Tizen::Base::Utility::FileUnzipper& unzipper);
        bool AddDirectory(const Tizen::Base::String& directory);
 
+       bool RemoveRoDirectory(const Tizen::Base::String& rootPath);
+       bool RemoveSharedDirectory(const Tizen::Base::String& sharedPath);
+
 private:
        int __state;
        InstallationContext* __pContext;
index b706c0d..5afc9c9 100755 (executable)
@@ -24,6 +24,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <unique_ptr.h>
+#include <drm-oem-intel.h>
 
 #include <FBaseErrorDefine.h>
 #include <FIoFile.h>
@@ -32,8 +33,8 @@
 
 #include "InstallerDefs.h"
 #include "InstallerUtil.h"
-
-#include <drm-oem-intel.h>
+#include "InstallerManager.h"
+#include "SmackManager.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -55,35 +56,33 @@ InstallerUtil::Remove(const Tizen::Base::String& filePath)
        result r = E_SUCCESS;
        struct stat fileinfo;
 
-       AppLogTag(OSP_INSTALLER, "+ Remove(): path=[%ls]", filePath.GetPointer());
-
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
-       TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+       TryReturn(pFilePath, false, "pFilePath is null");
 
        err = lstat(pFilePath.get(), &fileinfo);
        if (err < 0)
        {
-               AppLogTag(OSP_INSTALLER, "Remove(): lstat(%s): %s[errno:%d]: skip", pFilePath.get(), strerror(errno), errno);
+               AppLog("Remove(): [%s] - %s[errno(%d)]: skip", pFilePath.get(), strerror(errno), errno);
                return true;
        }
 
        if (S_ISLNK(fileinfo.st_mode))
        {
-               AppLogTag(OSP_INSTALLER, "Remove(): symlink, path=[%s]", pFilePath.get());
+               AppLog("Remove(): symlink, path=[%s]", pFilePath.get());
                err = unlink(pFilePath.get());
-               TryReturn(err >= 0, false, "[osp-installer] unlink() failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
+               TryReturn(err >= 0, false, "unlink() failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
        }
        else if (S_ISDIR(fileinfo.st_mode))
        {
-               AppLogTag(OSP_INSTALLER, "Remove(): directory, path=[%ls]", filePath.GetPointer());
+               AppLog("Remove(): directory, path=[%ls]", filePath.GetPointer());
                r = Directory::Remove(filePath, true);
-               TryReturn(!IsFailed(r), false, "[osp-installer] Directory::Remove() failed, filePath=%ls", filePath.GetPointer());
+               TryReturn(!IsFailed(r), false, "Directory::Remove() failed, filePath=%ls", filePath.GetPointer());
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "Remove(): file, path=[%ls]", filePath.GetPointer());
+               AppLog("Remove(): file, path=[%ls]", filePath.GetPointer());
                r = File::Remove(filePath);
-               TryReturn(!IsFailed(r), false, "[osp-installer] File::Remove() failed, filePath=%ls", filePath.GetPointer());
+               TryReturn(!IsFailed(r), false, "File::Remove() failed, filePath=%ls", filePath.GetPointer());
        }
 
        return true;
@@ -96,19 +95,19 @@ InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath)
        int readBytes = 0;
        result r = E_SUCCESS;
 
-       // AppLogTag(OSP_INSTALLER, "+ Copy(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
+       // AppLog("+ Copy(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
 
        File srcFile;
        File destFile;
 
        std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]);
-       TryReturn(pBuf, false, "[osp-installer] pBuf is null");
+       TryReturn(pBuf, false, "pBuf is null");
 
        r = srcFile.Construct(srcFilePath, L"r");
-       TryReturn(!IsFailed(r), false, "[osp-installer] srcFile.Construct is failed");
+       TryReturn(!IsFailed(r), false, "srcFile.Construct is failed");
 
        r = destFile.Construct(destFilePath, L"w");
-       TryReturn(!IsFailed(r), false, "[osp-installer] destFile.Construct is failed");
+       TryReturn(!IsFailed(r), false, "destFile.Construct is failed");
 
        do
        {
@@ -116,7 +115,7 @@ InstallerUtil::Copy(const String& srcFilePath, const String& destFilePath)
                if (readBytes > 0)
                {
                        r = destFile.Write(pBuf.get(), readBytes);
-                       TryReturn(!IsFailed(r), false, "[osp-installer] destFile.Write is failed");
+                       TryReturn(!IsFailed(r), false, "destFile.Write is failed");
                }
        }
        while (readBytes > 0);
@@ -128,17 +127,23 @@ bool
 InstallerUtil::CopyDirectory(const String& srcFilePath, const String& destFilePath)
 {
        result r = E_SUCCESS;
+       bool res = false;
 
-       AppLogTag(OSP_INSTALLER, "+ CopyDirectory(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
+       res = File::IsFileExist(srcFilePath);
+       if (res == false)
+       {
+               AppLog("CopyDirectory(): src=[%ls]: skip", srcFilePath.GetPointer());
+               return true;
+       }
 
        std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
-       TryReturn(pDir, false, "[osp-installer] pDir is null.");
+       TryReturn(pDir, false, "pDir is null.");
 
        r = pDir->Construct(srcFilePath);
-       TryReturn(!IsFailed(r), false, "[osp-installer] pDir->Construct() failed, srcFilePath=[%ls].", srcFilePath.GetPointer());
+       TryReturn(!IsFailed(r), false, "pDir->Construct() failed, srcFilePath=[%ls].", srcFilePath.GetPointer());
 
        std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
-       TryReturn(pDirEnum, false, "[osp-installer] pDirEnum is null.");
+       TryReturn(pDirEnum, false, "pDirEnum is null.");
 
        while (pDirEnum->MoveNext() == E_SUCCESS)
        {
@@ -177,6 +182,7 @@ InstallerUtil::CopyDirectory(const String& srcFilePath, const String& destFilePa
                }
        }
 
+       AppLog("CopyDirectory(): src=[%ls], dest=[%ls]", srcFilePath.GetPointer(), destFilePath.GetPointer());
        return true;
 }
 
@@ -187,10 +193,10 @@ InstallerUtil::IsSymlink(const Tizen::Base::String& filePath)
        struct stat fileinfo;
 
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
-       TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+       TryReturn(pFilePath, false, "pFilePath is null");
 
        err = lstat(pFilePath.get(), &fileinfo);
-       TryReturn(err >= 0, false, "[osp-installer] lstat() failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
+       TryReturn(err >= 0, false, "lstat() failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
 
        if (S_ISLNK(fileinfo.st_mode))
        {
@@ -205,17 +211,17 @@ InstallerUtil::GetRealPath(const String& filePath, String& realPath)
 {
        char* pRealPath = null;
 
-       AppLogTag(OSP_INSTALLER, "+ GetRealPath(): path=[%ls], realPath=[%ls]", filePath.GetPointer(), realPath.GetPointer());
-
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
-       TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+       TryReturn(pFilePath, false, "pFilePath is null");
 
        char tmpPath[PATH_MAX] = {0};
        pRealPath = realpath(pFilePath.get(), tmpPath);
-       TryReturn(pRealPath, false, "[osp-installer] pRealPath is null");
+       TryReturn(pRealPath, false, "pRealPath is null");
 
        realPath = tmpPath;
 
+       AppLog("GetRealPath(): path=[%ls], realPath=[%ls]", filePath.GetPointer(), realPath.GetPointer());
+
        return true;
 }
 
@@ -225,21 +231,27 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
        int err = -1;
        bool res = false;
 
-       AppLogTag(OSP_INSTALLER, "+ CreateSymlink(): oldPath=[%ls], newPath=[%ls]", oldPath.GetPointer(), newPath.GetPointer());
-
        res = File::IsFileExist(oldPath);
-       TryReturn(res == true, false, "[osp-installer] file not found, oldPath=[%ls]", oldPath.GetPointer());
+       if (res == false)
+       {
+               AppLog("CreateSymlink(): oldPath=[%ls] not found", oldPath.GetPointer());
+               return true;
+       }
 
        std::unique_ptr<char[]> pOldPath(_StringConverter::CopyToCharArrayN(oldPath));
-       TryReturn(pOldPath, false, "[osp-installer] pOldPath is null");
+       TryReturn(pOldPath, false, "pOldPath is null");
 
        std::unique_ptr<char[]> pNewPath(_StringConverter::CopyToCharArrayN(newPath));
-       TryReturn(pNewPath, false, "[osp-installer] pNewPath is null");
+       TryReturn(pNewPath, false, "pNewPath is null");
 
        err = symlink(pOldPath.get(), pNewPath.get());
-       TryReturn(err == 0, false, "[osp-installer] symlink() is failed(%s), oldpath=[%s], newpath=[%s]", strerror(errno), pOldPath.get(), pNewPath.get());
+       TryReturn(err == 0, false, "symlink() is failed(%s), oldpath=[%s], newpath=[%s]", strerror(errno), pOldPath.get(), pNewPath.get());
 
-       AppLogTag(OSP_INSTALLER, "CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
+       SmackManager smackManager;
+       String label("_");
+       smackManager.AddLabelDir(label, newPath);
+
+       AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
 
        return true;
 }
@@ -250,10 +262,10 @@ InstallerUtil::ChangeMode(const String& filePath, int mode)
        int err = -1;
 
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
-       TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+       TryReturn(pFilePath, false, "pFilePath is null");
 
        err = chmod(pFilePath.get(), mode);
-       TryReturn(err == 0, false, "[osp-installer] chmod() is failed(%s), filepath=[%s], mode=[%o]", strerror(errno), pFilePath.get(), mode);
+       TryReturn(err == 0, false, "chmod() is failed(%s), filepath=[%s], mode=[%o]", strerror(errno), pFilePath.get(), mode);
 
        return true;
 }
@@ -264,10 +276,10 @@ InstallerUtil::ChangeOwner(const String& filePath)
        int err = -1;
 
        std::unique_ptr<char[]> pFilePath(_StringConverter::CopyToCharArrayN(filePath));
-       TryReturn(pFilePath, false, "[osp-installer] pFilePath is null");
+       TryReturn(pFilePath, false, "pFilePath is null");
 
        err = chown(pFilePath.get(), APP_OWNER_ID, APP_GROUP_ID);
-       TryReturn(err == 0, false, "[osp-installer] chown() is failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
+       TryReturn(err == 0, false, "chown() is failed(%s), filepath=[%s]", strerror(errno), pFilePath.get());
 
        return true;
 }
@@ -278,30 +290,32 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool
        result r = E_SUCCESS;
        bool res = false;
 
-       AppLogTag(OSP_INSTALLER, "+ ChangeDirectoryPermission(): path=[%ls], mode=[%04o], appOwner=[%s]",
-                       filePath.GetPointer(), mode, appOwner?"true":"false");
-
        res = File::IsFileExist(filePath);
        if (res == false)
        {
-               AppLogTag(OSP_INSTALLER, "ChangeDirectoryPermission(): path=[%ls]: skip", filePath.GetPointer());
+               AppLog("path=[%ls]: skip", filePath.GetPointer());
                return true;
        }
 
        std::unique_ptr<Directory> pDir(new (std::nothrow) Directory);
-       TryReturn(pDir, false, "[osp-installer] pDir is null.");
+       TryReturn(pDir, false, "pDir is null.");
 
        r = pDir->Construct(filePath);
-       TryReturn(!IsFailed(r), false, "[osp-installer] pDir->Construct() failed, filePath=[%ls]", filePath.GetPointer());
+       TryReturn(!IsFailed(r), false, "pDir->Construct() failed, filePath=[%ls]", filePath.GetPointer());
 
        std::unique_ptr<DirEnumerator> pDirEnum(pDir->ReadN());
-       TryReturn(pDirEnum, false, "[osp-installer] pDirEnum is null.");
+       TryReturn(pDirEnum, false, "pDirEnum is null.");
 
        while (pDirEnum->MoveNext() == E_SUCCESS)
        {
                DirEntry entry = pDirEnum->GetCurrentDirEntry();
-
                String entryName = entry.GetName();
+               if (entryName.IsEmpty() == true)
+               {
+                       AppLog("entryName is empty.", entryName.GetPointer());
+                       continue;
+               }
+
                String entryDir = filePath;
                entryDir += L"/";
                entryDir += entryName;
@@ -339,34 +353,36 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool
                }
        }
 
+       AppLog("path=[%ls], mode=[%04o], appOwner=[%s]",
+                       filePath.GetPointer(), mode, appOwner?"true":"false");
+
        return true;
 }
 
 bool
 InstallerUtil::IsDrmFile(const Tizen::Base::String& path)
 {
-           bool res = true;
-           char* pFilePath = null;
-           result r = E_SUCCESS;
-           int isDrm = 0;
+       bool res = true;
+       char* pFilePath = null;
+       result r = E_SUCCESS;
+       int isDrm = 0;
 
-           pFilePath = _StringConverter::CopyToCharArrayN(path);
-           TryCatch(pFilePath, r = GetLastResult(), "[osp-installer] pFilePath is null");
+       pFilePath = _StringConverter::CopyToCharArrayN(path);
+       TryCatch(pFilePath, r = GetLastResult(), "pFilePath is null");
 
-           isDrm = drm_oem_intel_isDrmFile(pFilePath);
-               if(isDrm == 1)
-           {
-                       AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls is drm file", path.GetPointer());
-               }
-           else
-               {
-               res = false;
-                       AppLogTag(OSP_INSTALLER, "IsDrmFile() called, packagePath=%ls isn't  drm file", path.GetPointer());
-           }
+       isDrm = drm_oem_intel_isDrmFile(pFilePath);
+       if(isDrm == 1)
+       {
+               AppLog("IsDrmFile() called, packagePath=[%ls] is a drm file", path.GetPointer());
+       }
+       else
+       {
+               res = false;
+       }
 
-               CATCH:
-                   delete [] pFilePath;
-                   return res;
+CATCH:
+       delete [] pFilePath;
+       return res;
 }
 
 bool
@@ -378,16 +394,16 @@ InstallerUtil::DecryptPackage(const Tizen::Base::String& packagePath)
            int result = 0;
 
            pFilePath = _StringConverter::CopyToCharArrayN(packagePath);
-           TryCatch(pFilePath, r = GetLastResult(), "[osp-installer] pFilePath is null");
+           TryCatch(pFilePath, r = GetLastResult(), "pFilePath is null");
 
            result = drm_oem_intel_decrypt_package(pFilePath, pFilePath);
            if(result  == 1)
            {
-               AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls, decrpyt success", packagePath.GetPointer());
+               AppLog("DecryptPackage() called, packagePath=%ls, decrpyt success", packagePath.GetPointer());
            }
            else
            {
-               AppLogTag(OSP_INSTALLER, "DecryptPackage() called, packagePath=%ls, decrypt failed", packagePath.GetPointer());
+               AppLog("DecryptPackage() called, packagePath=%ls, decrypt failed", packagePath.GetPointer());
                res = false;
            }
 
@@ -417,7 +433,7 @@ InstallerUtil::GetCategory(int categoryType)
        return category;
 }
 
-CategoryType
+int
 InstallerUtil::GetCategoryType(char* pCategory)
 {
        CategoryType category = CATEGORY_TYPE_NONE;
@@ -443,10 +459,8 @@ InstallerUtil::CreateSymlinkForAppDirectory(const String& inPath, String& outPat
 {
        String appId;
 
-       AppLogTag(OSP_INSTALLER, "+ CreateSymlinkForAppDirectory(): path=[%ls]", inPath.GetPointer());
-
        int length = inPath.GetLength();
-       inPath.SubString(length - APPID_LENGTH, APPID_LENGTH, appId);
+       inPath.SubString(length - PACKAGE_ID_LENGTH, PACKAGE_ID_LENGTH, appId);
 
        String newPath;
        newPath = PATH_OPT_APPS;
@@ -459,7 +473,7 @@ InstallerUtil::CreateSymlinkForAppDirectory(const String& inPath, String& outPat
        }
 
        outPath = newPath;
-       AppLogTag(OSP_INSTALLER, "CreateSymlinkForAppDirectory(): output path=[%ls]", outPath.GetPointer());
+       AppLog("CreateSymlinkForAppDirectory(): output path=[%ls]", outPath.GetPointer());
 
        return true;
 }
@@ -468,7 +482,7 @@ bool
 InstallerUtil::DumpLog(const char* pBuf)
 {
        char temp[4096] = {0};
-       TryReturn(pBuf, false, "[osp-installer] pBuf is null");
+       TryReturn(pBuf, false, "pBuf is null");
 
        int bufLen = strlen(pBuf);
        strncpy(temp, pBuf, sizeof(temp));
@@ -480,7 +494,7 @@ InstallerUtil::DumpLog(const char* pBuf)
                if (temp[i] == '\n')
                {
                        temp[i] = 0;
-                       AppLogTag(OSP_INSTALLER, "%s", pStart);
+                       AppLog("%s", pStart);
                        pStart = temp + i + 1;
                }
        }
@@ -511,7 +525,7 @@ InstallerUtil::DumpLogData(char *pData, int dataLen)
 //     if (dataLen > 16*20)
 //             dataLen = 16*20;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        while (i < (int)dataLen)
        {
@@ -546,7 +560,7 @@ InstallerUtil::DumpLogData(char *pData, int dataLen)
                        idx             = 0;
                        idx2    = 0;
 
-                       AppLogTag(OSP_INSTALLER, "%s\n", buf_out);
+                       AppLog("%s\n", buf_out);
                }
 
                i++;
@@ -569,10 +583,10 @@ InstallerUtil::DumpLogData(char *pData, int dataLen)
                memcpy(buf_out+idx2, buf, idx);
                buf_out[idx2+idx]       = '\0';
 
-               AppLogTag(OSP_INSTALLER, "%s\n", buf_out);
+               AppLog("%s\n", buf_out);
        }
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        return TRUE;
 }
@@ -591,10 +605,124 @@ InstallerUtil::LogChangeHexToStr(int hex)
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "LogChangeHexToStr: Error! [Hex Val: %d]\n", hex);
+               AppLog("LogChangeHexToStr: Error! [Hex Val: %d]\n", hex);
        }
 
        return ch;
 }
 
+bool
+InstallerUtil::CreateLog(const String& logFile)
+{
+       File file;
 
+       result r = file.Construct(logFile, "w");
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       return true;
+}
+
+bool
+InstallerUtil::AppendLog(const char* pFunction, int lineNumber, bool fatal, const char* pFormat, ...)
+{
+       File file;
+
+       InstallerManager *pManager = InstallerManager::GetInstance();
+       if (pManager == null)
+       {
+               return false;
+       }
+
+       if (pManager->IsFileLogOn() == false)
+       {
+               return true;
+       }
+
+       String logFile = pManager->GetLogFilePath();
+       result r = file.Construct(logFile, "a");
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       va_list args;
+       va_start(args, pFormat);
+       const int bufSize = 1024;
+       char logs[bufSize+1] = {0};
+       char logs2[bufSize+1] = {0};
+       if (fatal == false)
+       {
+               snprintf(logs, bufSize, "     | %s (%d). > %s", (char*)pFunction, lineNumber, pFormat);
+       }
+       else
+       {
+               snprintf(logs, bufSize, "[TRY]| %s (%d). > %s", (char*)pFunction, lineNumber, pFormat);
+       }
+
+       vsnprintf(logs2, bufSize, logs, args);
+       int length = strlen(logs2);
+       logs2[length] = '\n';
+
+       r = file.Write(logs2, length+1);
+       if (IsFailed(r))
+       {
+               return false;
+       }
+       va_end(args);
+
+       return true;
+}
+
+bool
+InstallerUtil::PrintLog(const String& logFile)
+{
+       InstallerManager *pManager = InstallerManager::GetInstance();
+       if (pManager == null)
+       {
+               return false;
+       }
+
+       if (pManager->IsFileLogOn() == false)
+       {
+               return true;
+       }
+
+       File file;
+       FileAttributes attribute;
+
+       result r = File::GetAttributes(logFile, attribute);
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       int bufSize = 4096;
+       std::unique_ptr<char[]> pBuf(new (std::nothrow) char[bufSize]);
+       if (pBuf == null)
+       {
+               return false;
+       }
+
+       r = file.Construct(logFile, "r");
+       if (IsFailed(r))
+       {
+               return false;
+       }
+
+       int readBytes = 0;
+       do
+       {
+               memset(pBuf.get(), 0, bufSize);
+               readBytes = file.Read(pBuf.get(), bufSize);
+               if (readBytes > 0)
+               {
+                       fprintf(stderr, "%s", pBuf.get());
+               }
+       }
+       while (readBytes > 0);
+
+       return true;
+}
index 4fac08a..a5521a0 100755 (executable)
@@ -57,13 +57,17 @@ public:
        static bool DecryptPackage(const Tizen::Base::String& packagePath);
 
        static Tizen::Base::String GetCategory(int categoryType);
-       static CategoryType GetCategoryType(char* pCategory);
+       static int GetCategoryType(char* pCategory);
 
        static bool CreateSymlinkForAppDirectory(const Tizen::Base::String& inPath, Tizen::Base::String& outPath);
 
        static bool DumpLog(const char* pBuf);
        static bool DumpLogData(char *pData, int dataLen);
 
+       static bool CreateLog(const Tizen::Base::String& logFile);
+       static bool AppendLog(const char* pFunction, int lineNumber, bool fatal, const char* pFormat, ...);
+       static bool PrintLog(const Tizen::Base::String& logFile);
+
 private:
        static char LogChangeHexToStr(int hex);
        InstallerUtil(const InstallerUtil& value);
index 1213492..9013a9f 100755 (executable)
  * @brief      This is the implementation file for %ManifestGenerator class.
  */
 
+#include <unique_ptr.h>
 #include <sys/stat.h>
 
 #include <FLclLocale.h>
 #include <FApp_Aul.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FIoFile.h>
 
 #include "ManifestGenerator.h"
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::App;
-using namespace Tizen::App::Package;
 using namespace Tizen::Locales;
 using namespace Tizen::Io;
 
 ManifestGenerator::ManifestGenerator(void)
 :__pContext(null)
-,__pPackageInfoImpl(null)
 ,__pWriter(null)
 {
 }
@@ -53,11 +51,9 @@ bool
 ManifestGenerator::Construct(InstallationContext* pContext)
 {
        __pContext = pContext;
-       __pPackageInfoImpl = pContext->GetPackageInfoImpl();
-       TryReturn(__pPackageInfoImpl, false, "[osp-installer] __pPackageInfoImpl is null.");
 
        __pWriter = new (std::nothrow) XmlWriter;
-       TryReturn(__pWriter, false, "[osp-installer] __pWriter is null.");
+       TryReturn(__pWriter, false, "__pWriter is null.");
 
        return true;
 }
@@ -65,118 +61,90 @@ ManifestGenerator::Construct(InstallationContext* pContext)
 bool
 ManifestGenerator::Write()
 {
-       //bool preload = false; //__pContext->IsPreloaded();
-       String xmlPath;
-       String package;
        String location;
 
-       //if (preload == true)
-       //{
-       //      xmlPath.Format(1024, DIR_RO_PACKAGE_SYSTEM_MANIFEST, __pContext->GetId().GetPointer());
-       //      location = L"internal-only";
-       //}
-       //else
-       //{
-       xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetId().GetPointer());
-       location = L"auto";
-       //}
-
-       package = __pContext->GetId();
+       if (__pContext->__isPreloaded == true)
+       {
+               location = L"internal-only";
+       }
+       else
+       {
+               location = L"auto";
+       }
 
-       __pWriter->Construct(xmlPath);
+       __pWriter->Construct(__pContext->__coreXmlPath);
 
        __pWriter->StartElement("manifest");
        __pWriter->WriteAttribute("xmlns", "http://tizen.org/ns/packages");
-       __pWriter->WriteAttribute("package", package);
+       __pWriter->WriteAttribute("package", __pContext->__packageId);
        __pWriter->WriteAttribute("type", "tpk");
-       __pWriter->WriteAttribute("version", __pPackageInfoImpl->GetVersion());
+       __pWriter->WriteAttribute("version", __pContext->__version);
        __pWriter->WriteAttribute("install-location", location);
+       __pWriter->WriteAttribute("root_path", __pContext->__rootPath);
 
        __pWriter->StartElement("label");
-       __pWriter->WriteString(__pPackageInfoImpl->GetDisplayName());
+       __pWriter->WriteString(__pContext->__displayName);
        __pWriter->EndElement();
 
        __pWriter->StartElement("author");
        __pWriter->EndElement();
 
        __pWriter->StartElement("description");
-       __pWriter->WriteString(__pPackageInfoImpl->GetDescription());
+       __pWriter->WriteString(__pContext->__description);
        __pWriter->EndElement();
 
-       _PackageAppInfoImpl* pAppInfoImpl = null;
-       ArrayList* pAppList = null;
-       pAppList = __pPackageInfoImpl->GetAppInfoList();
-       int appCount = pAppList->GetCount();
-       AppLogTag(OSP_INSTALLER, "Write(): appCount=%d", appCount);
+       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "pAppDataList is null");
+
+       int appCount = pAppDataList->GetCount();
+       AppLog("Write(): appCount=%d", appCount);
 
        for (int i = 0 ; i < appCount; i++)
        {
-               pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
-               if (pAppInfoImpl)
+               AppData* pAppData = null;
+               pAppDataList->GetAt(i, pAppData);
+               TryReturn(pAppData, false, "pAppData is null");
+
+               WriteApp(i, pAppData);
+
+               if (pAppData->__isSubMode == true)
                {
-                       WriteApp(i, pAppInfoImpl);
+                       AppLog("Write(): pAppData->__isSubMode is detected");
+                       WriteSubModeApp(i, pAppData);
                }
        }
 
-       if (__pContext->__isSubMode == true)
-       {
-               AppLogTag(OSP_INSTALLER, "Write(): __pContext->__isSubMode is detected");
-               WriteSubModeApp(appCount);
-       }
-
        __pWriter->EndElement();
 
        return true;
 }
 
-bool
-ManifestGenerator::FindFeatureValue(ArrayList* pFeatureList, const String& feature, const String& value) const
-{
-       TryReturn(pFeatureList, false, "[osp-installer] pFeatureList is null.");
-
-       _AppFeatureInfoImpl* pFeature = null;
-
-       for (int i = 0 ; i < pFeatureList->GetCount(); i++)
-       {
-               pFeature = dynamic_cast<_AppFeatureInfoImpl*>(pFeatureList->GetAt(i));
-               if (pFeature)
-               {
-                       if ((pFeature->GetName() == feature) && (pFeature->GetValue() == value))
-                       {
-                               AppLogTag(OSP_INSTALLER, "Find - feature=[%ls], value=[%ls]", feature.GetPointer(), value.GetPointer());
-                               return true;
-                       }
-               }
-       }
-
-       return false;
-}
-
 String
-ManifestGenerator::GetGlFrameValue(ArrayList* pFeatureList) const
+ManifestGenerator::GetGlFrameValue(HashMap* pFeatureList) const
 {
        if (pFeatureList == null)
        {
                return "use-system-setting";
        }
 
-       _AppFeatureInfoImpl* pFeature = null;
-       for (int i = 0 ; i < pFeatureList->GetCount(); i++)
+       std::unique_ptr< IMapEnumerator > pEnum(pFeatureList->GetMapEnumeratorN());
+       TryReturn(pEnum, "use-system-setting", "GetMapEnumeratorN() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+       while (pEnum->MoveNext() == E_SUCCESS)
        {
-               pFeature = dynamic_cast<_AppFeatureInfoImpl*>(pFeatureList->GetAt(i));
-               if (pFeature == null)
-               {
-                       return "use-system-setting";
-               }
+               String* pKey = static_cast< String* > (pEnum->GetKey());
+               TryReturn(pEnum, "use-system-setting", "GetKey() failed. [%s]", GetErrorMessage(GetLastResult()));
 
-               if (pFeature->GetName() == L"HwAcceleration" || pFeature->GetName() == L"GlFrame")
+               if ((*pKey) == L"HwAcceleration" || (*pKey) == L"GlFrame")
                {
-                       String value = pFeature->GetValue();
-                       if (value == L"On")
+                       String* pValue = static_cast< String* > (pEnum->GetValue());
+                       TryReturn(pEnum, "use-system-setting", "GetValue() failed. [%s]", GetErrorMessage(GetLastResult()));
+
+                       if ((*pValue) == L"On")
                        {
                                return "use-GL";
                        }
-                       else if (value == L"Off")
+                       else if ((*pValue) == L"Off")
                        {
                                return "not-use-GL";
                        }
@@ -189,7 +157,7 @@ ManifestGenerator::GetGlFrameValue(ArrayList* pFeatureList) const
 bool
 ManifestGenerator::WriteLanguageValue(IMap* pList, const String& element) const
 {
-       TryReturn(pList, false, "[osp-installer] pNameList is null.");
+       TryReturn(pList, false, "pNameList is null.");
 
        IMapEnumerator*         pMapEnum = pList->GetMapEnumeratorN();
        while (pMapEnum->MoveNext() == E_SUCCESS)
@@ -230,10 +198,10 @@ ManifestGenerator::WriteLanguageValue(IMap* pList, const String& element) const
 }
 
 bool
-ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
+ManifestGenerator::WriteLiveboxes(AppData* pAppData) const
 {
-       TryReturn(__pContext, false, "[osp-installer] __pContext is null.");
-       TryReturn(__pWriter, false, "[osp-installer] __pWriter is null.");
+       TryReturn(__pContext, false, "__pContext is null.");
+       TryReturn(__pWriter, false, "__pWriter is null.");
 
        ArrayList* pLiveboxDataList = __pContext->GetLiveboxDataList();
        String label("label");
@@ -248,20 +216,20 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
                LiveboxData* pLiveboxData = dynamic_cast<LiveboxData*>(pLiveboxDataList->GetAt(j));
                if (pLiveboxData == null)
                {
-                       AppLogTag(OSP_INSTALLER, "pLiveboxData is null [%d]", j);
+                       AppLog("pLiveboxData is null [%d]", j);
                        continue;
                }
 
                long long updatePeriod = pLiveboxData->GetUpdatePeriod();
                String period = LongLong::ToString(updatePeriod/1000);
                IMap* pLiveboxNameList = pLiveboxData->GetNameList();
-               ArrayList* pSizeList = pLiveboxData->GetSizeList();
+               IMap* pSizeList = pLiveboxData->GetSizeList();
                String popupEnabled = pLiveboxData->GetPopupEnabled();
-               String primary = pLiveboxData->__main;
+               String primary = pLiveboxData->__default;
 
                __pWriter->StartElement("livebox");
 
-               __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName() + "." + pLiveboxData->GetProviderName());
+               __pWriter->WriteAttribute("appid", pAppData->__appId + "." + pLiveboxData->GetProviderName());
                __pWriter->WriteAttribute("period", period);
                __pWriter->WriteAttribute("pinup", "false");
 
@@ -276,11 +244,11 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
 
                WriteLanguageValue(pLiveboxNameList, label);
 
-               String menuIcon = pAppInfoImpl->GetMainmenuIcon();
+               String menuIcon = pAppData->__mainmenuIcon;
                if (menuIcon.IsEmpty() == false)
                {
                        String menuIconPath;
-                       menuIconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, menuIcon.GetPointer());
+                       menuIconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, menuIcon.GetPointer());
 
                        __pWriter->StartElement("icon");
                        __pWriter->WriteString(menuIconPath);
@@ -289,22 +257,14 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
 
                if (pSizeList)
                {
+                       String previewDir;
+
                        __pWriter->StartElement("box");
                        __pWriter->WriteAttribute("type", "buffer");
 
-                       for (int k = 0 ; k < pSizeList->GetCount(); k++)
-                       {
-                               String* pSize  = dynamic_cast<String*>(pSizeList->GetAt(k));
-                               if (pSize == null)
-                               {
-                                       AppLogTag(OSP_INSTALLER, "pSize is null [%d]", k);
-                                       continue;
-                               }
-
-                               __pWriter->StartElement("size");
-                               __pWriter->WriteString(*pSize);
-                               __pWriter->EndElement();
-                       }
+                       previewDir.Format(1024, L"%ls%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES);
+                       WriteLiveboxSizeValue(pSizeList, "size", previewDir);
+
                        __pWriter->EndElement();
                }
 
@@ -334,23 +294,52 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
 }
 
 bool
-ManifestGenerator::WriteAppControl(_PackageAppInfoImpl* pAppInfoImpl) const
+ManifestGenerator::WriteLiveboxSizeValue(IMap* pList, const String& element, const String& previewDir) const
+{
+       TryReturn(pList, false, "pList is null.");
+
+       IMapEnumerator* pMapEnum = pList->GetMapEnumeratorN();
+       TryReturn(pMapEnum, true, "pMapEnum is null.");
+
+       while (pMapEnum->MoveNext() == E_SUCCESS)
+       {
+               String* pSize = static_cast<String*> (pMapEnum->GetKey());
+               String* pPriviewImage = static_cast<String*> (pMapEnum->GetValue());
+
+               __pWriter->StartElement(element);
+               if (pPriviewImage && (pPriviewImage->IsEmpty() == false))
+               {
+                       String previewImagePath;
+                       previewImagePath.Format(1024, L"%ls/%ls", previewDir.GetPointer(), pPriviewImage->GetPointer());
+                       __pWriter->WriteAttribute("preview", previewImagePath);
+               }
+               __pWriter->WriteString(*pSize);
+               __pWriter->EndElement();
+       }
+
+       delete pMapEnum;
+       return true;
+}
+
+bool
+ManifestGenerator::WriteAppControl(AppData* pAppData) const
 {
-       TryReturn(pAppInfoImpl, false, "[osp-installer] pAppInfoImpl is null.");
+       TryReturn(pAppData, false, "pAppData is null.");
 
-       ArrayList* pAppControlImplList = pAppInfoImpl->GetAppControlList();
-       TryReturn(pAppControlImplList, false, "[osp-installer] pAppControlImplList is null.");
+       IListT<_AppControlInfo*>* pAppControlImplList = pAppData->__pAppControlImplList;
+       TryReturn(pAppControlImplList, false, "pAppControlImplList is null.");
 
-       _AppControlInfoImpl* pAppControl = dynamic_cast<_AppControlInfoImpl*>(pAppControlImplList->GetAt(0));
-       TryReturn(pAppControl, false, "[osp-installer] pAppControl is null.");
+       _AppControlInfo* pAppControl = null;
+       pAppControlImplList->GetAt(0, pAppControl);
+       TryReturn(pAppControl, false, "pAppControl is null.");
 
        ArrayList* pCapabilityList = pAppControl->GetCapabilityList();
-       TryReturn(pCapabilityList, false, "[osp-installer] pCapabilityList is null.");
+       TryReturn(pCapabilityList, false, "pCapabilityList is null.");
 
        int capaCount = pCapabilityList->GetCount();
        for (int capaIndex = 0 ; capaIndex < capaCount; capaIndex++)
        {
-               _AppControlCapabilityInfoImpl* pCapability = dynamic_cast<_AppControlCapabilityInfoImpl*>(pCapabilityList->GetAt(capaIndex));
+               _AppControlCapabilityInfo* pCapability = dynamic_cast<_AppControlCapabilityInfo*>(pCapabilityList->GetAt(capaIndex));
                if (pCapability == null) continue;
 
                String operationId = pCapability->GetOperationId();
@@ -375,7 +364,7 @@ ManifestGenerator::WriteAppControl(_PackageAppInfoImpl* pAppInfoImpl) const
                        __pWriter->WriteAttribute("name", operationId);
                        __pWriter->EndElement();
 
-                       _AppControlResolutionInfoImpl* pResolution = dynamic_cast <_AppControlResolutionInfoImpl*>(pResolutionList->GetAt(resIndex));
+                       _AppControlResolutionInfo* pResolution = dynamic_cast <_AppControlResolutionInfo*>(pResolutionList->GetAt(resIndex));
                        if (pResolution == null) continue;
 
                        String* pUriScheme = pResolution->GetUriScheme();
@@ -405,22 +394,22 @@ bool
 ManifestGenerator::WriteCategory(int index) const
 {
        IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, true, "[osp-installer] pAppDataList is null");
+       TryReturn(pAppDataList, true, "pAppDataList is null");
 
        AppData* pAppData = null;
        pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, true, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, true, "pAppData is null");
 
        IListT<String*>* pCategoryList = pAppData->__pCategoryList;
-       TryReturn(pCategoryList, true, "[osp-installer] pCategoryList is null");
+       TryReturn(pCategoryList, true, "pCategoryList is null");
 
        for (int i = 0; i < pCategoryList->GetCount(); i++)
        {
                String *pStr = null;
                pCategoryList->GetAt(i, pStr);
-               TryReturn(pStr, false, "[osp-installer] pStr is null");
+               TryReturn(pStr, false, "pStr is null");
 
-               AppLogTag(OSP_INSTALLER, "WriteCategory(): Category String=[%ls]", pStr->GetPointer());
+               AppLog("WriteCategory(): Category String=[%ls]", pStr->GetPointer());
 
                __pWriter->StartElement("category");
                __pWriter->WriteAttribute("name", *pStr);
@@ -436,24 +425,24 @@ ManifestGenerator::FindCategory(int index, const String& category) const
        result r = E_SUCCESS;
 
        IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+       TryReturn(pAppDataList, false, "pAppDataList is null");
 
        AppData* pAppData = null;
        r = pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
        IListT<String*>* pCategoryList = pAppData->__pCategoryList;
-       TryReturn(pCategoryList, false, "[osp-installer] pCategoryList is null");
+       TryReturn(pCategoryList, false, "pCategoryList is null");
 
        for (int i = 0; i < pCategoryList->GetCount(); i++)
        {
                String *pStr = null;
                pCategoryList->GetAt(i, pStr);
-               TryReturn(pStr, false, "[osp-installer] pStr is null");
+               TryReturn(pStr, false, "pStr is null");
 
                if (*pStr == category)
                {
-                       AppLogTag(OSP_INSTALLER, "FindCategory(): Category is found=[%ls]", pStr->GetPointer());
+                       AppLog("FindCategory(): Category is found=[%ls]", pStr->GetPointer());
                        return true;
                }
 
@@ -463,22 +452,22 @@ ManifestGenerator::FindCategory(int index, const String& category) const
 }
 
 bool
-ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl)
+ManifestGenerator::WriteApp(int index, AppData* pAppData)
 {
-       IMap* pNameList = pAppInfoImpl->GetNameList();
+       IMap* pNameList = pAppData->__pNameList;
        String label("label");
        String type("c++app");
        String binaryPath;
-       binaryPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, pAppInfoImpl->GetName().GetPointer());
+       binaryPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_BIN, pAppData->__name.GetPointer());
 
-       if (pAppInfoImpl->GetDefault() == L"True")
+       if (pAppData->__main == L"True")
        {
                WriteLanguageValue(pNameList, label);
 
-               if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
+               if (pAppData->__mainmenuIcon.IsEmpty() == false)
                {
                        String iconPath;
-                       iconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+                       iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
 
                        __pWriter->StartElement("icon");
                        __pWriter->WriteString(iconPath);
@@ -491,26 +480,40 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
        String category;
        String mainapp("true");
 
-       if (pAppInfoImpl->GetType() == L"UiApp")
+       if (pAppData->__type == L"UiApp")
        {
-               taskmanage = L"true";
+               if (pAppData->__launchingHistoryVisible.IsEmpty() == true)
+               {
+                       if (pAppData->__mainmenuVisible == true)
+                       {
+                               taskmanage = L"true";
+                       }
+                       else
+                       {
+                               taskmanage = L"false";
+                       }
+               }
+               else
+               {
+                       String history;
+                       pAppData->__launchingHistoryVisible.ToLowerCase(history);
+                       taskmanage = history;
+               }
 
-               if (pAppInfoImpl->IsMainmenuVisible() == true)
+               if (pAppData->__mainmenuVisible == true)
                {
                        nodisplay = L"false";
-                       taskmanage = L"true";
                }
                else
                {
                        nodisplay = L"true";
-                       taskmanage = L"false";
                }
 
                const char* pCategory = null;
                pCategory = TIZEN_CATEGORY_IME;
                if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false, nodisplay=true", pCategory);
+                       AppLog("Write(): [%s] is detected. taskmanage=false, nodisplay=true", pCategory);
                        taskmanage = L"false";
                        nodisplay = L"true";
                }
@@ -518,35 +521,35 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
                pCategory = TIZEN_CATEGORY_HOMESCREEN;
                if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
+                       AppLog("Write(): [%s] is detected. taskmanage=false", pCategory);
                        taskmanage = L"false";
                }
 
                pCategory = TIZEN_CATEGORY_LOCKSCREEN;
                if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
+                       AppLog("Write(): [%s] is detected. taskmanage=false", pCategory);
                        taskmanage = L"false";
                }
 
                pCategory = TIZEN_CATEGORY_MENUSCREEN;
                if (FindCategory(index, pCategory) == true)
                {
-                       AppLogTag(OSP_INSTALLER, "Write(): [%s] is detected. taskmanage=false", pCategory);
+                       AppLog("Write(): [%s] is detected. taskmanage=false", pCategory);
                        taskmanage = L"false";
                }
        }
 
-       if (pAppInfoImpl->GetDefault() != L"True")
+       if (pAppData->__main != L"True")
        {
                mainapp = L"false";
        }
 
-       ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
+       HashMap* pFeatureList = pAppData->__pFeatureList;
        String glFrame = GetGlFrameValue(pFeatureList);
 
        __pWriter->StartElement("ui-application");
-       __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
+       __pWriter->WriteAttribute("appid", pAppData->__appId);
        __pWriter->WriteAttribute("exec", binaryPath);
        __pWriter->WriteAttribute("nodisplay", nodisplay);
        __pWriter->WriteAttribute("taskmanage", taskmanage);
@@ -555,6 +558,16 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
        __pWriter->WriteAttribute("hw-acceleration", glFrame);
        __pWriter->WriteAttribute("mainapp", mainapp);
 
+       if (pAppData->__permissionType.IsEmpty() == false)
+       {
+               String type = pAppData->__permissionType;
+               type.ToLowerCase();
+
+               __pWriter->StartElement("permission");
+               __pWriter->WriteAttribute("type", type);
+               __pWriter->EndElement();
+       }
+
        WriteCategory(index);
 
 #if 0
@@ -604,61 +617,77 @@ ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl*
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "Type is invalid! [%ls]", pAppInfoImpl->GetType().GetPointer());
+               AppLog("Type is invalid! [%ls]", pAppInfoImpl->GetType().GetPointer());
                return false;
        }
        #endif
 
        WriteLanguageValue(pNameList, label);
 
-       if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
+       if (pAppData->__mainmenuIcon.IsEmpty() == false)
        {
                String iconPath;
-               iconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+               iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
 
                __pWriter->StartElement("icon");
                __pWriter->WriteString(iconPath);
                __pWriter->EndElement();
        }
 
-       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+       if (pAppData->__settingIcon.IsEmpty() == false)
+       {
+               String iconPath;
+               iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__settingIcon.GetPointer());
 
-       AppData* pAppData = null;
-       pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+               __pWriter->StartElement("icon");
+               __pWriter->WriteAttribute("section", "setting");
+               __pWriter->WriteString(iconPath);
+               __pWriter->EndElement();
+       }
+
+       if (pAppData->__notificationIcon.IsEmpty() == false)
+       {
+               String iconPath;
+               iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__notificationIcon.GetPointer());
+
+               __pWriter->StartElement("icon");
+               __pWriter->WriteAttribute("section", "notification");
+               __pWriter->WriteString(iconPath);
+               __pWriter->EndElement();
+       }
 
        if (pAppData->__legacyAppControls == true)
        {
-               AppLogTag(OSP_INSTALLER, "Write(): AppControls spec is legacy");
-               WriteAppControl(pAppInfoImpl);
+               AppLog("Write(): AppControls spec is legacy");
+               WriteAppControl(pAppData);
        }
        else
        {
                WriteAppControl(index);
        }
 
-       __pWriter->EndElement();
+       __pWriter->EndElement(); // end of "ui-application"
 
-       if (pAppInfoImpl->GetType() == L"ServiceApp")
+       if (pAppData->__type == L"ServiceApp")
        {
-               WriteLiveboxes(pAppInfoImpl);
+               WriteLiveboxes(pAppData);
        }
 
        WriteAccounts(index);
+       WriteNotifications(index);
 
        return true;
 }
 
 bool
-ManifestGenerator::WriteSubModeApp(int index)
+ManifestGenerator::WriteSubModeApp(int index, AppData* pAppData)
 {
        // SUB_MODE_APPCONTROL_NAME -> AppName
        String subBinaryPath;
-       subBinaryPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, SUB_MODE_APPCONTROL_NAME);
+       subBinaryPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_BIN, SUB_MODE_APPCONTROL_NAME);
 
        String binaryPath;
-       binaryPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, __pContext->__subModeAppName.GetPointer());
+       binaryPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_BIN, pAppData->__subModeAppName.GetPointer());
 
        if (File::IsFileExist(subBinaryPath) == true)
        {
@@ -676,16 +705,7 @@ ManifestGenerator::WriteSubModeApp(int index)
        }
        InstallerUtil::CreateSymlink(binaryExecPath, subBinaryExecPath);
 
-       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
-
-       AppLogTag(OSP_INSTALLER, "WriteSubModeApp(): appCount=%d", pAppDataList->GetCount());
-
-       AppData* pAppData = null;
-       pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
-
-       PackageId packageId = __pContext->GetId();
+       PackageId packageId = __pContext->__packageId;
        AppId appId = packageId + L"." + SUB_MODE_APPCONTROL_NAME;
 
        __pWriter->StartElement("ui-application");
@@ -697,25 +717,20 @@ ManifestGenerator::WriteSubModeApp(int index)
        __pWriter->WriteAttribute("type", "c++app");
 
        __pWriter->StartElement("label");
-       __pWriter->WriteString(__pPackageInfoImpl->GetDisplayName());
+       __pWriter->WriteString(__pContext->__displayName);
        __pWriter->EndElement();
 
-       ArrayList* pAppList = __pPackageInfoImpl->GetAppInfoList();
-       _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(0));
-       if (pAppInfoImpl)
+       if (pAppData->__mainmenuIcon.IsEmpty() == false)
        {
-               if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
-               {
-                       String iconPath;
-                       iconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+               String iconPath;
+               iconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, pAppData->__mainmenuIcon.GetPointer());
 
-                       __pWriter->StartElement("icon");
-                       __pWriter->WriteString(iconPath);
-                       __pWriter->EndElement();
-               }
+               __pWriter->StartElement("icon");
+               __pWriter->WriteString(iconPath);
+               __pWriter->EndElement();
        }
 
-       WriteAppControl(index);
+       WriteAppControl(index, true);
 
        __pWriter->EndElement();        // end of "ui-application"
 
@@ -723,17 +738,27 @@ ManifestGenerator::WriteSubModeApp(int index)
 }
 
 bool
-ManifestGenerator::WriteAppControl(int index)
+ManifestGenerator::WriteAppControl(int index, bool subMode)
 {
        IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+       TryReturn(pAppDataList, false, "pAppDataList is null");
 
        AppData* pAppData = null;
        pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
-       IListT<AppControlData*>* pAppControlDataList = pAppData->__pAppControlDataList;
-       TryReturn(pAppControlDataList, false, "[osp-installer] pAppControlDataList is null");
+       IListT<AppControlData*>* pAppControlDataList = null;
+
+       if (subMode == false)
+       {
+               pAppControlDataList = pAppData->__pAppControlDataList;
+               TryReturn(pAppControlDataList, false, "pAppControlDataList is null");
+       }
+       else
+       {
+               pAppControlDataList = pAppData->__pSubModeAppControlDataList;
+               TryReturn(pAppControlDataList, false, "pAppControlDataList is null");
+       }
 
        for (int i = 0; i < pAppControlDataList->GetCount(); i++)
        {
@@ -741,15 +766,15 @@ ManifestGenerator::WriteAppControl(int index)
 
                AppControlData* pAppControlData = null;
                pAppControlDataList->GetAt(i, pAppControlData);
-               TryReturn(pAppControlData, false, "[osp-installer] pAppControlData is null");
+               TryReturn(pAppControlData, false, "pAppControlData is null");
 
                IListT<String*>* pOperationList = pAppControlData->__pOperationList;
-               TryReturn(pOperationList, false, "[osp-installer] pOperationList is null");
+               TryReturn(pOperationList, false, "pOperationList is null");
                for (int sub = 0; sub < pOperationList->GetCount(); sub++)
                {
                        String* pOperation = null;
                        pOperationList->GetAt(sub, pOperation);
-                       TryReturn(pOperation, false, "[osp-installer] pOperation is null");
+                       TryReturn(pOperation, false, "pOperation is null");
 
                        __pWriter->StartElement("operation");
                        __pWriter->WriteAttribute("name", *pOperation);
@@ -757,12 +782,12 @@ ManifestGenerator::WriteAppControl(int index)
                }
 
                IListT<String*>* pMimeTypeList = pAppControlData->__pMimeTypeList;
-               TryReturn(pMimeTypeList, false, "[osp-installer] pMimeTypeList is null");
+               TryReturn(pMimeTypeList, false, "pMimeTypeList is null");
                for (int sub = 0; sub < pMimeTypeList->GetCount(); sub++)
                {
                        String* pMimeType = null;
                        pMimeTypeList->GetAt(sub, pMimeType);
-                       TryReturn(pMimeType, false, "[osp-installer] pMimeType is null");
+                       TryReturn(pMimeType, false, "pMimeType is null");
 
                        if (pMimeType->IsEmpty() == true) continue;
 
@@ -772,12 +797,12 @@ ManifestGenerator::WriteAppControl(int index)
                }
 
                IListT<String*>* pUriList = pAppControlData->__pUriList;
-               TryReturn(pUriList, false, "[osp-installer] pUriList is null");
+               TryReturn(pUriList, false, "pUriList is null");
                for (int sub = 0; sub < pUriList->GetCount(); sub++)
                {
                        String* pUri = null;
                        pUriList->GetAt(sub, pUri);
-                       TryReturn(pUri, false, "[osp-installer] pUri is null");
+                       TryReturn(pUri, false, "pUri is null");
 
                        if (pUri->IsEmpty() == true) continue;
 
@@ -796,41 +821,46 @@ bool
 ManifestGenerator::WriteAccounts(int index)
 {
        IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
-       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+       TryReturn(pAppDataList, false, "pAppDataList is null");
 
        AppData* pAppData = null;
        pAppDataList->GetAt(index, pAppData);
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
        IListT<AccountData*>* pAccountDataList = pAppData->__pAccountDataList;
-       TryReturn(pAccountDataList, false, "[osp-installer] pAccountDataList is null");
+       TryReturn(pAccountDataList, false, "pAccountDataList is null");
 
        int accountCount = pAccountDataList->GetCount();
-       if (accountCount == 0)
+       if (accountCount <= 0)
        {
                return true;
        }
 
-       __pWriter->StartElement("Accounts");
+       __pWriter->StartElement("account");
 
        for (int i = 0; i < accountCount; i++)
        {
-               __pWriter->StartElement("AccountProvider");
+               __pWriter->StartElement("account-provider");
 
                AccountData* pAccountData = null;
                pAccountDataList->GetAt(i, pAccountData);
-               TryReturn(pAccountData, false, "[osp-installer] pAccountData is null");
+               TryReturn(pAccountData, false, "pAccountData is null");
 
-               __pWriter->WriteAttribute("ProviderId", pAccountData->__providerId);
-               __pWriter->WriteAttribute("MultipleAccountsSupport", pAccountData->__multipleAccountsSupport);
+               String multipleAccountsSupport = pAccountData->__multipleAccountsSupport;
+               multipleAccountsSupport.ToLowerCase();
+
+               __pWriter->WriteAttribute("appid", pAppData->__appId);
+               __pWriter->WriteAttribute("providerid", pAccountData->__providerId);
+               __pWriter->WriteAttribute("multiple-accounts-support", multipleAccountsSupport);
 
                String accountIcon = pAccountData->__accountIcon;
                if (accountIcon.IsEmpty() == false)
                {
                        String accountIconPath;
-                       accountIconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, accountIcon.GetPointer());
+                       accountIconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, accountIcon.GetPointer());
 
-                       __pWriter->StartElement("account-icon");
+                       __pWriter->StartElement("icon");
+                       __pWriter->WriteAttribute("section", "account");
                        __pWriter->WriteString(accountIconPath);
                        __pWriter->EndElement();
                }
@@ -839,19 +869,79 @@ ManifestGenerator::WriteAccounts(int index)
                if (accountSmallIcon.IsEmpty() == false)
                {
                        String accountSmallIconPath;
-                       accountSmallIconPath.Format(1024, L"%ls%ls/%ls", __pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_SHARED_RES, accountSmallIcon.GetPointer());
+                       accountSmallIconPath.Format(1024, L"%ls%ls/%ls", __pContext->__rootPath.GetPointer(), DIR_SHARED_RES, accountSmallIcon.GetPointer());
 
-                       __pWriter->StartElement("account-small-icon");
-                       __pWriter->WriteString(accountSmallIcon);
+                       __pWriter->StartElement("icon");
+                       __pWriter->WriteAttribute("section", "account-small");
+                       __pWriter->WriteString(accountSmallIconPath);
                        __pWriter->EndElement();
                }
 
                WriteLanguageValue(pAccountData->__pNameList, L"label");
 
-               __pWriter->EndElement();        // end of "AccountProvider"
+               IListT<String*>* pCapabilityList = pAccountData->__pCapabilityList;
+               TryReturn(pCapabilityList, false, "pCapabilityList is null");
+
+               for (int capa = 0; capa < pCapabilityList->GetCount(); capa++)
+               {
+                       String* pCapability = null;
+                       pCapabilityList->GetAt(capa, pCapability);
+                       TryReturn(pCapability, false, "pCapability is null");
+
+                       __pWriter->StartElement("capability");
+                       __pWriter->WriteString(*pCapability);
+                       __pWriter->EndElement(); // end of "capability"
+               }
+
+               __pWriter->EndElement(); // end of "account-provider"
+       }
+
+       __pWriter->EndElement(); // end of "account"
+
+       return true;
+}
+
+bool
+ManifestGenerator::WriteNotifications(int index)
+{
+       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* pNotificationMap = pAppData->__pNotificationMap;
+       TryReturn(pNotificationMap, false, "pNotificationMap is null");
+
+       int count = pNotificationMap->GetCount();
+       if (count <= 0)
+       {
+               return true;
+       }
+
+       IMapEnumerator* pMapEnum = pNotificationMap->GetMapEnumeratorN();
+       TryReturn(pMapEnum, false, "pMapEnum is null");
+
+       __pWriter->StartElement("notifications");
+       __pWriter->WriteAttribute("appid", pAppData->__appId);
+
+       while (pMapEnum->MoveNext() == E_SUCCESS)
+       {
+               String* pKey = null;
+               String* pValue = null;
+
+               pKey = static_cast<String*> (pMapEnum->GetKey());
+               pValue = static_cast<String*> (pMapEnum->GetValue());
+
+               __pWriter->StartElement("notification");
+               __pWriter->WriteAttribute("section", *pKey);
+               __pWriter->WriteString(*pValue);
+               __pWriter->EndElement(); // end of "notification"
        }
 
-       __pWriter->EndElement();        // end of "Accounts"
+       __pWriter->EndElement(); // end of "notifications"
 
+       delete pMapEnum;
        return true;
 }
index 7429dfd..0cb3878 100755 (executable)
@@ -23,9 +23,6 @@
 #ifndef _MANIFEST_GENERATOR_H_
 #define _MANIFEST_GENERATOR_H_
 
-#include <FAppPkg_PackageInfoImpl.h>
-#include <FAppPkg_PackageAppInfoImpl.h>
-
 #include "InstallationContext.h"
 #include "XmlWriter.h"
 
@@ -50,23 +47,23 @@ private:
        ManifestGenerator(const ManifestGenerator& value);
        ManifestGenerator& operator =(const ManifestGenerator& source);
 
-       bool FindFeatureValue(Tizen::Base::Collection::ArrayList* pFeatureList, const Tizen::Base::String& feature, const Tizen::Base::String& value) const;
        bool WriteLanguageValue(Tizen::Base::Collection::IMap* pList, const Tizen::Base::String& label) const;
-       bool WriteLiveboxes(Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl) const;
-       bool WriteAppControl(Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl) const;
-       Tizen::Base::String GetGlFrameValue(Tizen::Base::Collection::ArrayList* pFeatureList) const;
+       bool WriteLiveboxes(AppData* pAppData) const;
+       bool WriteLiveboxSizeValue(Tizen::Base::Collection::IMap* pList, const Tizen::Base::String& element, const Tizen::Base::String& previewDir) const;
+       bool WriteAppControl(AppData* pAppData) const;
+       Tizen::Base::String GetGlFrameValue(Tizen::Base::Collection::HashMap* pFeatureList) const;
 
        bool WriteCategory(int index) const;
        bool FindCategory(int index, const Tizen::Base::String& category) const;
 
-       bool WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl);
-       bool WriteSubModeApp(int index);
-       bool WriteAppControl(int index);
+       bool WriteApp(int index, AppData* pAppData);
+       bool WriteSubModeApp(int index, AppData* pAppData);
+       bool WriteAppControl(int index, bool subMode = false);
        bool WriteAccounts(int index);
+       bool WriteNotifications(int index);
 
 private:
        InstallationContext* __pContext;
-       Tizen::App::Package::_PackageInfoImpl* __pPackageInfoImpl;
        XmlWriter* __pWriter;
 
 }; // ManifestGenerator
index a887f73..ccfdf25 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <FIoFile.h>
 #include <FSys_SystemInfoImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ManifestHandler.h"
@@ -34,7 +33,7 @@
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
+using namespace Tizen::App;
 using namespace Tizen::Io;
 using namespace Tizen::System;
 
@@ -42,15 +41,11 @@ ManifestHandler::ManifestHandler(void)
 :__pContext(null)
 ,__pPrivilegeList(null)
 ,__pContentDataList(null)
-,__pPackageInfoImpl(null)
-,__pPackageAppInfoImpl(null)
 ,__pAppControlInfoImpl(null)
 ,__pAppControlCapabilityInfoImpl(null)
 ,__pAppControlResolutionInfoImpl(null)
-,__pDataControlInfoImpl(null)
-,__pDataControlTypeImpl(null)
-,__pLaunchConditionImpl(null)
-,__pNotificationImpl(null)
+,__pDataControlInfo(null)
+,__pDataControlType(null)
 ,__pContentData(null)
 ,__pDefaultIconType(null)
 ,__isDefaultMainmenu(false)
@@ -61,8 +56,8 @@ ManifestHandler::ManifestHandler(void)
 ,__isDefaultName(false)
 ,__isDefaultAppDetected(false)
 ,__pAppData(null)
-,__pSubModeAppControlDataList(null)
 ,__isParserMode(false)
+,__pParser(null)
 {
 }
 
@@ -70,19 +65,12 @@ ManifestHandler::~ManifestHandler(void)
 {
        delete[] __pDefaultIconType;
        __pDefaultIconType = null;
-
-       if (__pPackageAppInfoImpl)
-       {
-               delete __pPackageAppInfoImpl;
-               __pPackageAppInfoImpl = null;
-       }
 }
 
 bool
 ManifestHandler::Construct(InstallationContext* pContext)
 {
        __pContext = pContext;
-       __pPackageInfoImpl = pContext->GetPackageInfoImpl();
 
        return true;
 }
@@ -102,26 +90,26 @@ ManifestHandler::Parse(const char *pFilepath)
 bool
 ManifestHandler::OnStartElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null.");
+       TryReturn(pName, true, "pName is null.");
 
        bool status = true;
 
        if (__isParserMode == true)
        {
-               TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+               TryReturn(__pParser, false, "__pParser is null");
                return __pParser->OnStartElement(pName);
        }
 
        if (strcasecmp(pName, "Manifest") == 0)
        {
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "manifest.xml");
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "<%s>", pName);
+               AppLog("------------------------------------------");
+               AppLog("manifest.xml");
+               AppLog("------------------------------------------");
+               AppLog("<%s>", pName);
        }
        else if (strcasecmp(pName, "Apps") == 0)
        {
-               AppLogTag(OSP_INSTALLER, "<%s>", pName);
+               AppLog("<%s>", pName);
        }
        else if (strcasecmp(pName, "UiApp") == 0)
        {
@@ -171,6 +159,10 @@ ManifestHandler::OnStartElement(const char *pName)
        {
                status = OnAppControlsStartElement(pName);
        }
+       else if (strcasecmp(pName, "Permission") == 0)
+       {
+               status = OnPermissionStartElement(pName);
+       }
 
        if (!status)
        {
@@ -184,13 +176,13 @@ ManifestHandler::OnStartElement(const char *pName)
 bool
 ManifestHandler::OnEndElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null.");
+       TryReturn(pName, true, "pName is null.");
 
        bool status = true;
 
        if (__isParserMode == true)
        {
-               TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+               TryReturn(__pParser, false, "__pParser is null");
                __pParser->OnEndElement(pName);
 
                if (strcasecmp(pName, "Liveboxes") == 0)
@@ -229,21 +221,13 @@ ManifestHandler::OnEndElement(const char *pName)
        {
                status = OnDataControlTypeEndElement();
        }
-       else if (strcasecmp(pName, "Condition") == 0)
-       {
-               status = OnConditionEndElement();
-       }
-       else if (strcasecmp(pName, "Notification") == 0)
-       {
-               status = OnNotificationEndElement();
-       }
        else if (strcasecmp(pName, "Apps") == 0)
        {
                status = OnAppsEndElement();
        }
        else if (strcasecmp(pName, "UiScalability") == 0)
        {
-               AppLogTag(OSP_INSTALLER, "</%s>", pName);
+               AppLog("</%s>", pName);
        }
        else if (strcasecmp(pName, "Icons") == 0)
        {
@@ -277,12 +261,12 @@ ManifestHandler::OnCharacters(const char *pCharacters)
 
        if (__isParserMode == true)
        {
-               TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+               TryReturn(__pParser, false, "__pParser is null");
                return __pParser->OnCharacters(pCharacters);
        }
 
        char *pName = GetElementName();
-       TryReturn(pName, false, "[osp-installer] pName is null.");
+       TryReturn(pName, false, "pName is null.");
 
        if (strcasecmp(pName, "Id") == 0)
        {
@@ -361,9 +345,9 @@ bool
 ManifestHandler::OnPrivilegesStartElement(void)
 {
        __pPrivilegeList = new (std::nothrow) ArrayList;
-       TryReturn(__pPrivilegeList, false, "[osp-installer] __pPrivilegeList is null");
+       TryReturn(__pPrivilegeList, false, "__pPrivilegeList is null");
 
-       AppLogTag(OSP_INSTALLER, "<Privileges>");
+       AppLog("<Privileges>");
 
        return true;
 }
@@ -371,16 +355,16 @@ ManifestHandler::OnPrivilegesStartElement(void)
 bool
 ManifestHandler::OnUiAppStartElement(void)
 {
-       __pPackageAppInfoImpl = new (std::nothrow) _PackageAppInfoImpl;
-       TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
-
        __pAppData = new (std::nothrow) AppData;
-       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+       TryReturn(__pAppData, false, "__pAppData is null");
+
+       InstallerError error = __pAppData->Construct();
+       TryReturn(error == INSTALLER_ERROR_NONE, false, "pAppData->Construct() failed.");
 
-       AppLogTag(OSP_INSTALLER, "<UiApp>");
+       AppLog("<UiApp>");
 
        XmlAttribute *pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        ParseAppAttribute(pAttr, true);
 
@@ -390,13 +374,13 @@ ManifestHandler::OnUiAppStartElement(void)
 bool
 ManifestHandler::OnServiceAppStartElement(void)
 {
-       __pPackageAppInfoImpl = new (std::nothrow) _PackageAppInfoImpl;
-       TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
-
        __pAppData = new (std::nothrow) AppData;
-       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+       TryReturn(__pAppData, false, "__pAppData is null");
 
-       AppLogTag(OSP_INSTALLER, "<ServiceApp>");
+       InstallerError error = __pAppData->Construct();
+       TryReturn(error == INSTALLER_ERROR_NONE, false, "pAppData->Construct() failed.");
+
+       AppLog("<ServiceApp>");
 
        XmlAttribute *pAttr = GetAttribute();
        TryReturn(pAttr, true, "pAttr is null");
@@ -413,7 +397,7 @@ ManifestHandler::OnIconsStartElement(void)
        int width = 0;
        String defaultIconType;
 
-       AppLogTag(OSP_INSTALLER, "<Icons>");
+       AppLog("<Icons>");
 
        r = _SystemInfoImpl::GetSysInfo(L"ScreenWidth", width);
        if (IsFailed(r))
@@ -432,12 +416,12 @@ ManifestHandler::OnIconsStartElement(void)
                }
        }
 
-       AppLogTag(OSP_INSTALLER, "ScreenWidth = [%d]", width);
+       AppLog("ScreenWidth = [%d]", width);
 
        __pDefaultIconType = _StringConverter::CopyToCharArrayN(defaultIconType);
-       TryReturn(__pDefaultIconType, false, "[osp-installer] __pDefaultIconType is null.");
+       TryReturn(__pDefaultIconType, false, "__pDefaultIconType is null.");
 
-       AppLogTag(OSP_INSTALLER, "DefaultIconType = [%s]", __pDefaultIconType);
+       AppLog("DefaultIconType = [%s]", __pDefaultIconType);
 
        return true;
 }
@@ -446,55 +430,49 @@ bool
 ManifestHandler::OnUiScalabilityStartElement(void)
 {
        XmlAttribute *pAttr = null;
-       char *pCoordinateSystem = null;
-       char *pBaseScreenSize = null;
-       char *pLogicalCoordinate = null;
+       charpCoordinateSystem = null;
+       charpBaseScreenSize = null;
+       charpLogicalCoordinate = null;
 
-       AppLogTag(OSP_INSTALLER, "<UiScalability>");
+       AppLog("<UiScalability>");
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pCoordinateSystem = pAttr->Find("CoordinateSystem");
        if (pCoordinateSystem)
        {
-               _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-               TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
-
-               pAppFeatureInfo->SetName("CoordinateSystem");
-               pAppFeatureInfo->SetValue(pCoordinateSystem);
-
-               __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
+               String* pKey = new (std::nothrow) String("CoordinateSystem");
+               TryReturn(pKey, false, "pKey is null");
+               String* pValue = new (std::nothrow) String(pCoordinateSystem);
+               TryReturn(pValue, false, "pValue is null");
 
-               AppLogTag(OSP_INSTALLER, "<CoordinateSystem=%s>", pCoordinateSystem);
+               __pAppData->__pFeatureList->Add(pKey, pValue);
+               AppLog("<CoordinateSystem=%s>", pCoordinateSystem);
        }
 
        pBaseScreenSize = pAttr->Find("BaseScreenSize");
        if (pBaseScreenSize)
        {
-               _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-               TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
+               String* pKey = new (std::nothrow) String("BaseScreenSize");
+               TryReturn(pKey, false, "pKey is null");
+               String* pValue = new (std::nothrow) String(pBaseScreenSize);
+               TryReturn(pValue, false, "pValue is null");
 
-               pAppFeatureInfo->SetName("BaseScreenSize");
-               pAppFeatureInfo->SetValue(pBaseScreenSize);
-
-               __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
-
-               AppLogTag(OSP_INSTALLER, "<BaseScreenSize=%s>", pBaseScreenSize);
+               __pAppData->__pFeatureList->Add(pKey, pValue);
+               AppLog("<BaseScreenSize=%s>", pBaseScreenSize);
        }
 
        pLogicalCoordinate = pAttr->Find("LogicalCoordinate");
        if (pLogicalCoordinate)
        {
-               _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-               TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
-
-               pAppFeatureInfo->SetName("LogicalCoordinate");
-               pAppFeatureInfo->SetValue(pLogicalCoordinate);
+               String* pKey = new (std::nothrow) String("LogicalCoordinate");
+               TryReturn(pKey, false, "pKey is null");
+               String* pValue = new (std::nothrow) String(pLogicalCoordinate);
+               TryReturn(pValue, false, "pValue is null");
 
-               __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
-
-               AppLogTag(OSP_INSTALLER, "<LogicalCoordinate=%s>", pLogicalCoordinate);
+               __pAppData->__pFeatureList->Add(pKey, pValue);
+               AppLog("<LogicalCoordinate=%s>", pLogicalCoordinate);
        }
 
        return true;
@@ -507,61 +485,56 @@ ManifestHandler::OnUiThemeStartElement(void)
        char *pSystemTheme = null;
        char *pUserDefinedTheme = null;
 
-       AppLogTag(OSP_INSTALLER, "<UiTheme>");
+       AppLog("<UiTheme>");
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pSystemTheme = pAttr->Find("SystemTheme");
        if (pSystemTheme)
        {
-               _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-               TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
+               String* pKey = new (std::nothrow) String("SystemTheme");
+               TryReturn(pKey, false, "pKey is null");
+               String* pValue = new (std::nothrow) String(pSystemTheme);
+               TryReturn(pValue, false, "pValue is null");
 
-               pAppFeatureInfo->SetName("SystemTheme");
-               pAppFeatureInfo->SetValue(pSystemTheme);
-
-               __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
-
-               AppLogTag(OSP_INSTALLER, "<SystemTheme=%s>", pSystemTheme);
+               __pAppData->__pFeatureList->Add(pKey, pValue);
+               AppLog("<SystemTheme=%s>", pSystemTheme);
        }
 
        pUserDefinedTheme = pAttr->Find("UserDefinedTheme");
        if (pUserDefinedTheme)
        {
-               _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-               TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
-
-               pAppFeatureInfo->SetName("UserDefinedTheme");
-               pAppFeatureInfo->SetValue(pUserDefinedTheme);
+               String* pKey = new (std::nothrow) String("UserDefinedTheme");
+               TryReturn(pKey, false, "pKey is null");
+               String* pValue = new (std::nothrow) String(pUserDefinedTheme);
+               TryReturn(pValue, false, "pValue is null");
 
-               __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
-
-               AppLogTag(OSP_INSTALLER, "<UserDefinedTheme=%s>", pUserDefinedTheme);
+               __pAppData->__pFeatureList->Add(pKey, pValue);
+               AppLog("<UserDefinedTheme=%s>", pUserDefinedTheme);
        }
 
        return true;
 }
 
-
 bool
 ManifestHandler::OnDataControlStartElement(void)
 {
-       XmlAttribute *pAttr = null;
-       char *pProviderId = null;
+       XmlAttributepAttr = null;
+       charpProviderId = null;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pProviderId = pAttr->Find("ProviderId");
-       TryReturn(pProviderId, true, "[osp-installer] pProviderId is null");
+       TryReturn(pProviderId, true, "pProviderId is null");
 
-       __pDataControlInfoImpl = new (std::nothrow) _DataControlInfoImpl;
-       TryReturn(__pDataControlInfoImpl, false, "[osp-installer] __pDataControlInfoImpl is null");
+       __pDataControlInfo = new (std::nothrow) DataControlInfo;
+       TryReturn(__pDataControlInfo, false, "__pDataControlInfo is null");
 
-       __pDataControlInfoImpl->SetProviderId(pProviderId);
+       __pDataControlInfo->__providerId = pProviderId;
 
-       AppLogTag(OSP_INSTALLER, "<DataControl ProviderId=\"%s\">", pProviderId);
+       AppLog("<DataControl ProviderId=\"%s\">", pProviderId);
 
        return true;
 }
@@ -570,9 +543,9 @@ bool
 ManifestHandler::OnContentsStartElement(void)
 {
        __pContentDataList = new (std::nothrow) ArrayList;
-       TryReturn(__pContentDataList, false, "[osp-installer] __pContentDataList is null");
+       TryReturn(__pContentDataList, false, "__pContentDataList is null");
 
-       AppLogTag(OSP_INSTALLER, "<Contents>");
+       AppLog("<Contents>");
 
        return true;
 }
@@ -580,16 +553,16 @@ ManifestHandler::OnContentsStartElement(void)
 bool
 ManifestHandler::OnContentStartElement(void)
 {
-       TryReturn(__pContentData == null, false, "[osp-installer] __pContentData is not null");
+       TryReturn(__pContentData == null, false, "__pContentData is not null");
 
        XmlAttribute *pAttr = null;
        char *pDefault = null;
 
        __pContentData = new (std::nothrow) ContentData;
-       TryReturn(__pContentData, false, "[osp-installer] __pContentData is null");
+       TryReturn(__pContentData, false, "__pContentData is null");
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        char* pId = pAttr->Find("Id");
        if (pId)
@@ -612,7 +585,7 @@ ManifestHandler::OnContentStartElement(void)
                }
        }
 
-       AppLogTag(OSP_INSTALLER, "<Content Id=\"%s\" EntryName=\"%s\">", pId, pEntryName);
+       AppLog("<Content Id=\"%s\" EntryName=\"%s\">", pId, pEntryName);
 
        return true;
 }
@@ -621,10 +594,10 @@ bool
 ManifestHandler::OnLiveboxesStartElement(const char *pName)
 {
        __pParser = new (std::nothrow) ManifestLiveboxesParser;
-       TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+       TryReturn(__pParser, false, "__pParser is null");
 
        __isParserMode = true;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
        __pParser->Construct(this);
 
        return __pParser->OnStartElement(pName);
@@ -634,10 +607,10 @@ bool
 ManifestHandler::OnAccountsStartElement(const char *pName)
 {
        __pParser = new (std::nothrow) ManifestAccountsParser;
-       TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+       TryReturn(__pParser, false, "__pParser is null");
 
        __isParserMode = true;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
        __pParser->Construct(this);
 
        return __pParser->OnStartElement(pName);
@@ -647,35 +620,71 @@ bool
 ManifestHandler::OnAppControlsStartElement(const char *pName)
 {
        __pParser = new (std::nothrow) ManifestAppControlsParser;
-       TryReturn(__pParser, false, "[osp-installer] __pParser is null");
+       TryReturn(__pParser, false, "__pParser is null");
 
        __isParserMode = true;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
        __pParser->Construct(this);
 
        return __pParser->OnStartElement(pName);
 }
 
 bool
+ManifestHandler::OnPermissionStartElement(const char* pName)
+{
+       XmlAttribute* pAttr = null;
+       char* pType = null;
+
+       pAttr = GetAttribute();
+       TryReturn(pAttr, true, "pAttr is null.");
+
+       pType = pAttr->Find("Type");
+       TryReturn(pType, true, "pType is null.");
+
+       if (__pAppData->__permissionType.IsEmpty() == true)
+       {
+               __pAppData->__permissionType = pType;
+       }
+       else
+       {
+               String type = pType;
+               if (__pAppData->__permissionType.Equals(type, true) == false)
+               {
+                       AppLog("Invalid Permission Type [%ls][%ls]", __pAppData->__permissionType.GetPointer(), type.GetPointer());
+                       return false;
+               }
+       }
+
+       AppLog("<Permission Type=\"%s\">", pType);
+
+       return true;
+}
+
+bool
 ManifestHandler::OnPrivilegesEndElement(void)
 {
-       if (__pContext->IsVerificationMode() == false)
+       if (__pContext->__isVerificationMode == false)
        {
-               AppLogTag(OSP_INSTALLER, "no signature file[%ls]", __pContext->GetSignatureXmlPath().GetPointer());
+               AppLog("no signature file[%ls]", __pContext->GetSignatureXmlPath().GetPointer());
 
                result r = E_SUCCESS;
                String privileges;
                String hmacPrivileges;
-               String appId = __pPackageInfoImpl->GetId();
-               r = PrivilegeHandler::GenerateCipherPrivilege(appId, *__pPrivilegeList, privileges, hmacPrivileges);
-               TryReturn(!IsFailed(r), false, "[osp-installer] privMgr.GeneratePrivilegeString() failed");
+               ArrayList stringPrivilegeList;
+               stringPrivilegeList.Construct(125);
+               PackageId packageId = __pContext->__packageId;
+               r = PrivilegeHandler::GenerateCipherPrivilege(packageId, *__pPrivilegeList, privileges, hmacPrivileges, stringPrivilegeList);
+               TryReturn(!IsFailed(r), false, "privMgr.GeneratePrivilegeString() failed");
 
-               __pPackageInfoImpl->SetPrivilegesValue(privileges, hmacPrivileges);
+               __pContext->__privileges = privileges;
+               __pContext->__hmacPrivileges = hmacPrivileges;
+               __pContext->__pStringPrivilegeList = new ArrayList;
+               __pContext->__pStringPrivilegeList->Construct(stringPrivilegeList);
        }
 
        __pContext->SetPrivilegeList(__pPrivilegeList);
 
-       AppLogTag(OSP_INSTALLER, "</Privileges>");
+       AppLog("</Privileges>");
 
        return true;
 }
@@ -683,22 +692,19 @@ ManifestHandler::OnPrivilegesEndElement(void)
 bool
 ManifestHandler::OnUiAppEndElement(void)
 {
-       if (__pContext->__isSubMode == true)
+       if (__pAppData->__isSubMode == true)
        {
-               __pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
+               __pAppData->__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
                __pAppData->__pAppControlDataList = null;
-               __pContext->__subModeAppName = __pPackageAppInfoImpl->GetName();
+               __pAppData->__subModeAppName = __pAppData->__name;
        }
 
-       __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
-       __pPackageAppInfoImpl = null;
-
        __isDefaultName = false;
 
        __pContext->__pAppDataList->Add(__pAppData);
        __pAppData = null;
 
-       AppLogTag(OSP_INSTALLER, "</UiApp>");
+       AppLog("</UiApp>");
 
        return true;
 }
@@ -706,22 +712,19 @@ ManifestHandler::OnUiAppEndElement(void)
 bool
 ManifestHandler::OnServiceAppEndElement(void)
 {
-       if (__pContext->__isSubMode == true)
+       if (__pAppData->__isSubMode == true)
        {
-               __pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
+               __pAppData->__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
                __pAppData->__pAppControlDataList = null;
-               __pContext->__subModeAppName = __pPackageAppInfoImpl->GetName();
+               __pAppData->__subModeAppName = __pAppData->__name;
        }
 
-       __pPackageInfoImpl->AddAppInfo(*__pPackageAppInfoImpl);
-       __pPackageAppInfoImpl = null;
-
        __isDefaultName = false;
 
        __pContext->__pAppDataList->Add(__pAppData);
        __pAppData = null;
 
-       AppLogTag(OSP_INSTALLER, "</ServiceApp>");
+       AppLog("</ServiceApp>");
 
        return true;
 }
@@ -729,18 +732,7 @@ ManifestHandler::OnServiceAppEndElement(void)
 bool
 ManifestHandler::OnAppsEndElement(void)
 {
-       if (__pContext->__isSubMode == true)
-       {
-               __pAppData = new (std::nothrow) AppData;
-               TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
-
-               __pAppData->__pAppControlDataList = __pSubModeAppControlDataList;
-               __pSubModeAppControlDataList = null;
-
-               __pContext->__pAppDataList->Add(__pAppData);
-       }
-
-       AppLogTag(OSP_INSTALLER, "</Apps>");
+       AppLog("</Apps>");
 
        return true;
 }
@@ -748,7 +740,7 @@ ManifestHandler::OnAppsEndElement(void)
 bool
 ManifestHandler::OnIconsEndElement(void)
 {
-       AppLogTag(OSP_INSTALLER, "</Icons>");
+       AppLog("</Icons>");
 
        return true;
 }
@@ -756,9 +748,9 @@ ManifestHandler::OnIconsEndElement(void)
 bool
 ManifestHandler::OnDataControlEndElement(void)
 {
-       __pPackageAppInfoImpl->AddDataControl(__pDataControlInfoImpl);
-       __pDataControlInfoImpl = null;
-       AppLogTag(OSP_INSTALLER, "</DataControl>");
+       __pAppData->__pDataControlList->Add(__pDataControlInfo);
+       __pDataControlInfo = null;
+       AppLog("</DataControl>");
 
        return true;
 }
@@ -766,29 +758,9 @@ ManifestHandler::OnDataControlEndElement(void)
 bool
 ManifestHandler::OnDataControlTypeEndElement(void)
 {
-       __pDataControlInfoImpl->AddControlType(__pDataControlTypeImpl);
-       __pDataControlTypeImpl = null;
-       AppLogTag(OSP_INSTALLER, "</DataControlType>");
-
-       return true;
-}
-
-bool
-ManifestHandler::OnConditionEndElement(void)
-{
-       __pPackageAppInfoImpl->AddLaunchCondition(*__pLaunchConditionImpl);
-       __pLaunchConditionImpl = null;
-       AppLogTag(OSP_INSTALLER, "</Condition>");
-
-       return true;
-}
-
-bool
-ManifestHandler::OnNotificationEndElement(void)
-{
-       __pPackageAppInfoImpl->AddNotification(*__pNotificationImpl);
-       __pNotificationImpl = null;
-       AppLogTag(OSP_INSTALLER, "</Notification>");
+       __pDataControlInfo->__pControlTypeList->Add(__pDataControlType);
+       __pDataControlType = null;
+       AppLog("</DataControlType>");
 
        return true;
 }
@@ -798,7 +770,7 @@ ManifestHandler::OnContentsEndElement(void)
 {
        __pContext->SetContentDataList(__pContentDataList);
        __pContentDataList = null;
-       AppLogTag(OSP_INSTALLER, "</Contents>");
+       AppLog("</Contents>");
 
        return true;
 }
@@ -808,7 +780,7 @@ ManifestHandler::OnContentEndElement(void)
 {
        __pContentDataList->Add(*__pContentData);
        __pContentData = null;
-       AppLogTag(OSP_INSTALLER, "</Content>");
+       AppLog("</Content>");
 
        return true;
 }
@@ -818,7 +790,7 @@ ManifestHandler::OnLiveboxesEndElement(void)
 {
        delete __pParser;
        __isParserMode = false;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        return true;
 }
@@ -828,7 +800,7 @@ ManifestHandler::OnAccountsEndElement(void)
 {
        delete __pParser;
        __isParserMode = false;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        return true;
 }
@@ -838,7 +810,7 @@ ManifestHandler::OnAppControlsEndElement(void)
 {
        delete __pParser;
        __isParserMode = false;
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
 
        return true;
 }
@@ -847,7 +819,7 @@ bool
 ManifestHandler::OnManifestEndElement(void)
 {
        TryReturn(__isDefaultAppDetected, false, "[osp-installer][Error] Main tag is not detected...");
-       AppLogTag(OSP_INSTALLER, "</Manifest>");
+       AppLog("</Manifest>");
 
        return true;
 }
@@ -855,8 +827,8 @@ ManifestHandler::OnManifestEndElement(void)
 bool
 ManifestHandler::OnIdValue(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "<Id>%s</Id>", pCharacters);
-       __pPackageInfoImpl->SetId(pCharacters);
+       AppLog("<Id>%s</Id>", pCharacters);
+       __pContext->__packageId = pCharacters;
 
        return true;
 }
@@ -864,8 +836,8 @@ ManifestHandler::OnIdValue(const char *pCharacters)
 bool
 ManifestHandler::OnVersionValue(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "<Version>%s</Version>", pCharacters);
-       __pPackageInfoImpl->SetVersion(pCharacters);
+       AppLog("<Version>%s</Version>", pCharacters);
+       __pContext->__version = pCharacters;
 
        return true;
 }
@@ -873,12 +845,11 @@ ManifestHandler::OnVersionValue(const char *pCharacters)
 bool
 ManifestHandler::OnTypeValue(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "<Type>%s</Type>", pCharacters);
-       //__pPackageInfoImpl->SetAppType(pCharacters);
+       AppLog("<Type>%s</Type>", pCharacters);
 
        if (strcasecmp(pCharacters, "Contents") == 0)
        {
-               __pPackageInfoImpl->SetAppApiVersion("3.0");
+               __pContext->__apiVersion = L"3.0";
        }
 
        return true;
@@ -887,23 +858,8 @@ ManifestHandler::OnTypeValue(const char *pCharacters)
 bool
 ManifestHandler::OnAuthorValue(const char *pCharacters)
 {
-//     XmlAttribute *pAttr = 0;
-//     char *pAttrValue = 0;
-//
-//     pAttr = GetAttribute();
-//     TryReturn(pAttr, true, "[osp-installer] pAttr is null");
-//
-//     pAttrValue = pAttr->Find("Locale");
-//     TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
-//
-//     if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
-//     {
-//             // Set default name
-//             __pPackageInfoImpl->SetAppVendor(pCharacters);
-//     }
-
-       AppLogTag(OSP_INSTALLER, "<Author>%s</Author>", pCharacters);
-       __pPackageInfoImpl->SetAuthor(pCharacters);
+       AppLog("<Author>%s</Author>", pCharacters);
+       __pContext->__author = pCharacters;
 
        return true;
 }
@@ -911,8 +867,8 @@ ManifestHandler::OnAuthorValue(const char *pCharacters)
 bool
 ManifestHandler::OnUrlValue(const char *pCharacters)
 {
-       __pPackageInfoImpl->SetUrl(pCharacters);
-       AppLogTag(OSP_INSTALLER, "<Url>%s</Url>", pCharacters);
+       __pContext->__url = pCharacters;
+       AppLog("<Url>%s</Url>", pCharacters);
 
        return true;
 }
@@ -920,8 +876,8 @@ ManifestHandler::OnUrlValue(const char *pCharacters)
 bool
 ManifestHandler::OnApiVersionValue(const char *pCharacters)
 {
-       __pPackageInfoImpl->SetAppApiVersion(pCharacters);
-       AppLogTag(OSP_INSTALLER, "<ApiVersion>%s</ApiVersion>", pCharacters);
+       __pContext->__apiVersion = pCharacters;
+       AppLog("<ApiVersion>%s</ApiVersion>", pCharacters);
 
        XmlAttribute *pAttr = GetAttribute();
        if (pAttr)
@@ -929,7 +885,7 @@ ManifestHandler::OnApiVersionValue(const char *pCharacters)
                char* pOspCompat = pAttr->Find("OspCompat");
                if (pOspCompat)
                {
-                       AppLogTag(OSP_INSTALLER, " - OspCompat=%s", pOspCompat);
+                       AppLog(" - OspCompat=%s", pOspCompat);
                        __pContext->__isOspCompat = true;
                }
        }
@@ -941,7 +897,7 @@ bool
 ManifestHandler::OnPrivilegeValue(const char *pCharacters)
 {
        __pPrivilegeList->Add(*new (std::nothrow) String(pCharacters));
-       AppLogTag(OSP_INSTALLER, "<Privilege>%s</Privilege>", pCharacters);
+       AppLog("<Privilege>%s</Privilege>", pCharacters);
 
        return true;
 }
@@ -949,82 +905,115 @@ ManifestHandler::OnPrivilegeValue(const char *pCharacters)
 bool
 ManifestHandler::OnIconValue(const char *pCharacters)
 {
-       XmlAttribute *pAttr = 0;
-       char *pAttrValue1 = 0;
-       char *pTypeValue = 0;
-
-       pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       AppLog("<Icon>%s</Icon>", pCharacters);
 
-       pAttrValue1 = pAttr->Find("Section");
-       TryReturn(pAttrValue1, true, "[osp-installer] pAttrValue1 is null");
+       XmlAttribute* pAttr = GetAttribute();
+       TryReturn(pAttr, true, "pAttr is null");
 
-       pTypeValue = pAttr->Find("Type");
-       TryReturn(pTypeValue, true, "[osp-installer] pTypeValue is null");
+       char* pSection = pAttr->Find("Section");
+       TryReturn(pSection, true, "pSection is null");
+       AppLog(" - Section=%s", pSection);
 
-       char icon[1024] = {0,};
+       TryReturn(__pDefaultIconType, false, "__pDefaultIconType is null");
 
-       if (strcasecmp(pTypeValue, "Xhigh") == 0)
+       String iconRelPath;
+       char* pType = pAttr->Find("Type");
+       if (pType == null)
        {
-               snprintf(icon, sizeof(icon), "%s/%s", "screen-density-xhigh", pCharacters);
-       }
-       else if (strcasecmp(pTypeValue, "High") == 0)
-       {
-               snprintf(icon, sizeof(icon), "%s/%s", "screen-density-high", pCharacters);
+               AppLog("__pDefaultIconType=%s", __pDefaultIconType);
+               if (strcasecmp(__pDefaultIconType, "Xhigh") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
+               }
+               else if (strcasecmp(__pDefaultIconType, "High") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
+               }
+               else
+               {
+                       TryReturn(0, false, "Invalid __pDefaultIconType[%s]", __pDefaultIconType);
+               }
        }
-       else
+       else    // legacy
        {
-               AppLogTag(OSP_INSTALLER, "Invalid Type [%s]", __pDefaultIconType);
-               return false;
+               AppLog(" - Type=%s", pType);
+               if (strcasecmp(pType, "Xhigh") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
+               }
+               else if (strcasecmp(pType, "High") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
+               }
+               else
+               {
+                       TryReturn(0, false, "Invalid IconType [%s]", __pDefaultIconType);
+               }
        }
 
        if (FindElement("Content") == true)
        {
-               TryReturn(__pContentData, false, "[osp-installer] __pContentData is null");
-               __pContentData->SetIcon(icon);
+               TryReturn(__pContentData, false, "__pContentData is null");
+               __pContentData->SetIcon(iconRelPath);
        }
        else
        {
-               if (strcasecmp(pAttrValue1, "MainMenu") == 0)
+               if (pType == null)
                {
-                       if (__isDefaultMainmenu == false)
+                       if (strcasecmp(pSection, "MainMenu") == 0)
                        {
-                               __pPackageAppInfoImpl->SetMainmenuIcon(icon);
+                               __pAppData->__mainmenuIcon = iconRelPath;
                        }
-
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
-                       {
-                               __isDefaultMainmenu = true;
-                       }
-               }
-               else if (strcasecmp(pAttrValue1, "Setting") == 0)
-               {
-                       if (__isDefaultSetting == false)
+                       else if (strcasecmp(pSection, "Setting") == 0)
                        {
-                               __pPackageAppInfoImpl->SetSettingIcon(icon);
+                               __pAppData->__settingIcon = iconRelPath;
                        }
-
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
+                       else if (strcasecmp(pSection, "Notification") == 0)
                        {
-                               __isDefaultSetting = true;
+                               __pAppData->__notificationIcon = iconRelPath;
                        }
                }
-               else if (strcasecmp(pAttrValue1, "Notification") == 0)
+               else    // legacy
                {
-                       if (__isDefaultQuickpanel == false)
+                       if (strcasecmp(pSection, "MainMenu") == 0)
                        {
-                               __pPackageAppInfoImpl->SetQuickpanelIcon(icon);
+                               if (__isDefaultMainmenu == false)
+                               {
+                                       __pAppData->__mainmenuIcon = iconRelPath;
+                               }
+
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultMainmenu = true;
+                               }
                        }
+                       else if (strcasecmp(pSection, "Setting") == 0)
+                       {
+                               if (__isDefaultSetting == false)
+                               {
+                                       __pAppData->__settingIcon = iconRelPath;
+                               }
 
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultSetting = true;
+                               }
+                       }
+                       else if (strcasecmp(pSection, "Notification") == 0)
                        {
-                               __isDefaultQuickpanel = true;
+                               if (__isDefaultQuickpanel == false)
+                               {
+                                       __pAppData->__notificationIcon = iconRelPath;
+                               }
+
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultQuickpanel = true;
+                               }
                        }
                }
        }
 
-       AppLogTag(OSP_INSTALLER, "<Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pAttrValue1, pTypeValue, pCharacters);
-
        return true;
 }
 
@@ -1035,14 +1024,14 @@ ManifestHandler::OnNameValue(const char *pCharacters)
        char* pAttrValue = 0;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pAttrValue = pAttr->Find("Locale");
-       TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
+       TryReturn(pAttrValue, true, "pAttrValue is null");
 
        if (FindElement("Content") == true)
        {
-               TryReturn(__pContentData, false, "[osp-installer] __pContentData is null");
+               TryReturn(__pContentData, false, "__pContentData is null");
 
                String* pValue = new (std::nothrow) String;
                StringUtil::Utf8ToString(pCharacters, *pValue);
@@ -1054,19 +1043,17 @@ ManifestHandler::OnNameValue(const char *pCharacters)
                {
                        if (__isDefaultName == true)
                        {
-                               __pPackageInfoImpl->SetDisplayName(pCharacters);
+                               __pContext->__displayName = pCharacters;
                        }
                }
 
-               if (__pPackageAppInfoImpl)
-               {
-                       String* pValue = new (std::nothrow) String;
-                       StringUtil::Utf8ToString(pCharacters, *pValue);
-                       __pPackageAppInfoImpl->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue);
-               }
+               String* pValue = new (std::nothrow) String;
+               StringUtil::Utf8ToString(pCharacters, *pValue);
+
+               __pAppData->__pNameList->Add((new (std::nothrow) String(pAttrValue)), pValue);
        }
 
-       AppLogTag(OSP_INSTALLER, "<DisplayName Locale=\"%s\">%s</DisplayName>", pAttrValue, pCharacters);
+       AppLog("<DisplayName Locale=\"%s\">%s</DisplayName>", pAttrValue, pCharacters);
 
        return true;
 }
@@ -1078,18 +1065,17 @@ ManifestHandler::OnDescriptionValue(const char *pCharacters)
        char *pAttrValue = 0;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pAttrValue = pAttr->Find("Locale");
-       TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
+       TryReturn(pAttrValue, true, "pAttrValue is null");
 
        if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
        {
-               // Set default name
-               __pPackageInfoImpl->SetDescription(pCharacters);
+               __pContext->__description = pCharacters;
        }
 
-       AppLogTag(OSP_INSTALLER, "<Description Locale=\"%s\">%s</Description>", pAttrValue, pCharacters);
+       AppLog("<Description Locale=\"%s\">%s</Description>", pAttrValue, pCharacters);
 
        return true;
 }
@@ -1097,22 +1083,22 @@ ManifestHandler::OnDescriptionValue(const char *pCharacters)
 bool
 ManifestHandler::OnDataControlTypeValue(const char *pCharacters)
 {
-       XmlAttribute *pAttr = null;
-       char *pAccessValue = null;
+       XmlAttributepAttr = null;
+       charpAccessValue = null;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pAccessValue = pAttr->Find("Access");
-       TryReturn(pAccessValue, true, "[osp-installer] pAccessValue is null");
+       TryReturn(pAccessValue, true, "pAccessValue is null");
 
-       __pDataControlTypeImpl = new (std::nothrow) _DataControlTypeImpl;
-       TryReturn(__pDataControlTypeImpl, false, "[osp-installer] __pDataControlTypeImpl is null");
+       __pDataControlType = new (std::nothrow) DataControlType;
+       TryReturn(__pDataControlType, false, "__pDataControlType is null");
 
-       __pDataControlTypeImpl->SetType(pCharacters);
-       __pDataControlTypeImpl->SetAccess(pAccessValue);
+       __pDataControlType->__type = pCharacters;
+       __pDataControlType->__access = pAccessValue;
 
-       AppLogTag(OSP_INSTALLER, "<DataControlType Access=\"%s\", Type=\"%s\">", pAccessValue, pCharacters);
+       AppLog("<DataControlType Access=\"%s\", Type=\"%s\">", pAccessValue, pCharacters);
 
        return true;
 }
@@ -1124,18 +1110,18 @@ ManifestHandler::OnConditionValue(const char *pCharacters)
        char *pName = null;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pName = pAttr->Find("Name");
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
 
-       __pLaunchConditionImpl = new (std::nothrow) _LaunchConditionInfoImpl;
-       TryReturn(__pLaunchConditionImpl, false, "[osp-installer] __pLaunchConditionImpl is null");
+       String* pKey = new (std::nothrow) String(pName);
+       TryReturn(pKey, false, "pKey is null");
+       String* pValue = new (std::nothrow) String(pCharacters);
+       TryReturn(pValue, false, "pValue is null");
 
-       __pLaunchConditionImpl->SetName(pName);
-       __pLaunchConditionImpl->SetValue(pCharacters);
-
-       AppLogTag(OSP_INSTALLER, "<LaunchCondition Name=\"%s\", Value=\"%s\">", pName, pCharacters);
+       __pAppData->__pLaunchConditionList->Add(pKey, pValue);
+       AppLog("<LaunchCondition Name=\"%s\", Value=\"%s\">", pName, pCharacters);
 
        return true;
 }
@@ -1144,21 +1130,39 @@ bool
 ManifestHandler::OnNotificationValue(const char *pCharacters)
 {
        XmlAttribute *pAttr = null;
-       char *pName = null;
+       const char *pName = null;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null.");
 
        pName = pAttr->Find("Name");
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null.");
 
-       __pNotificationImpl = new (std::nothrow) _NotificationInfoImpl;
-       TryReturn(__pNotificationImpl, false, "[osp-installer] __pNotificationImpl is null");
+       if (strcasecmp(pName, "Ticker") == 0)
+       {
+               pName = "Notification";
+       }
+       else if (strcasecmp(pName, "Notification") == 0 || strcasecmp(pName, "Sounds") == 0
+                       || strcasecmp(pName, "Badge") == 0 || strcasecmp(pName, "Contents") == 0)
+       {
+               // known notification attributes
+       }
+       else
+       {
+               TryReturn(0, true, "Unknown notification attributes=%s", pCharacters);
+       }
 
-       __pNotificationImpl->SetName(pName);
-       __pNotificationImpl->SetValue(pCharacters);
+       String* pKey = new (std::nothrow) String(pName);
+       TryReturn(pKey, false, "pKey is null.");
 
-       AppLogTag(OSP_INSTALLER, "<Notification Name=\"%s\", Value=\"%s\">", pName, pCharacters);
+       String* pValue = new (std::nothrow) String(pCharacters);
+       TryReturn(pValue, false, "pValue is null.");
+
+       pKey->ToLowerCase();
+       pValue->ToLowerCase();
+
+       __pAppData->__pNotificationMap->Add(pKey, pValue);
+       AppLog("<Notification Name=\"%s\", Value=\"%s\">", pName, pCharacters);
 
        return true;
 }
@@ -1166,14 +1170,13 @@ ManifestHandler::OnNotificationValue(const char *pCharacters)
 bool
 ManifestHandler::OnInstallationLocationValue(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "<InstallationLocation>%s</InstallationLocation>", pCharacters);
+       AppLog("<InstallationLocation>%s</InstallationLocation>", pCharacters);
 
        if ((strcasecmp(pCharacters, "UserPreferred") == 0) &&
                        (File::IsFileExist(DIR_MEMORYCARD_INSTALLATION) == true))
        {
-               AppLogTag(OSP_INSTALLER, "INSTALLATION_STORAGE = [EXTERNAL]");
-               __pContext->SetInstallationStorage(InstallationContext::INSTALLATION_STORAGE_EXTERNAL);
-               __pPackageInfoImpl->SetInstalledInExternalStorage(true);
+               AppLog("INSTALLATION_STORAGE = [EXTERNAL]");
+               __pContext->__storage = INSTALLATION_STORAGE_EXTERNAL;
        }
 
        return true;
@@ -1182,13 +1185,13 @@ ManifestHandler::OnInstallationLocationValue(const char *pCharacters)
 bool
 ManifestHandler::OnCategoryValue(const char *pCharacters)
 {
-       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+       TryReturn(__pAppData, false, "__pAppData is null");
 
        __pAppData->__pCategoryList->Add(new (std::nothrow) String(pCharacters));
 
        if (strcasecmp(pCharacters, TIZEN_CATEGORY_IME) == 0)
        {
-               __pPackageAppInfoImpl->SetAppFeature(CATEGORY_TYPE_IME);
+               __pAppData->__feature = CATEGORY_TYPE_IME;
        }
 
        return true;
@@ -1209,7 +1212,7 @@ ManifestHandler::FindElement(const char *pName)
                        {
                                if (pStr->Equals(pName, false) == true)
                                {
-                                       AppLogTag(OSP_INSTALLER, "[%s] is matched.", pName);
+                                       AppLog("[%s] is matched.", pName);
                                        res = true;
                                        break;
                                }
@@ -1225,13 +1228,12 @@ ManifestHandler::FindElement(const char *pName)
 bool
 ManifestHandler::AddAppFeature(const Tizen::Base::String& name, const Tizen::Base::String& value)
 {
-       _AppFeatureInfoImpl* pAppFeatureInfo = new (std::nothrow) _AppFeatureInfoImpl;
-       TryReturn(pAppFeatureInfo, false, "[osp-installer] pAppFeatureInfo is null");
-
-       pAppFeatureInfo->SetName(name);
-       pAppFeatureInfo->SetValue(value);
-       __pPackageAppInfoImpl->AddAppFeature(*pAppFeatureInfo);
+       String* pKey = new (std::nothrow) String(name);
+       TryReturn(pKey, false, "pKey is null");
+       String* pValue = new (std::nothrow) String(value);
+       TryReturn(pValue, false, "pValue is null");
 
+       __pAppData->__pFeatureList->Add(pKey, pValue);
        return true;
 }
 
@@ -1246,8 +1248,9 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
 
        if (pName)
        {
-               AppLogTag(OSP_INSTALLER, " - Name=%s", pName);
-               __pPackageAppInfoImpl->SetName(pName);
+               AppLog(" - Name=%s", pName);
+               __pAppData->__name = pName;
+               __pAppData->__appId = __pContext->__packageId + L"." + pName;
        }
 
        char* pMain = pAttr->Find("Main");
@@ -1258,26 +1261,33 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
 
        if (pMain)
        {
-               AppLogTag(OSP_INSTALLER, " - Main=%s", pMain);
-
-               __pPackageAppInfoImpl->SetDefault(pMain);
+               AppLog(" - Main=%s", pMain);
+               __pAppData->__main = pMain;
 
                if (strcasecmp(pMain, "True") == 0)
                {
                        __isDefaultName = true;
                        __isDefaultAppDetected = true;
+                       __pContext->__mainAppName = pName;
                }
        }
        else
        {
-               __pPackageAppInfoImpl->SetDefault("False");
+               __pAppData->__main = L"False";
+       }
+
+       char* pRecent = pAttr->Find("LaunchingHistoryVisible");
+       if (pRecent)
+       {
+               AppLog(" - LaunchingHistoryVisible=%s", pRecent);
+               __pAppData->__launchingHistoryVisible = pRecent;
        }
 
        char* pHwAcceleration = pAttr->Find("HwAcceleration");
        if (pHwAcceleration)
        {
                AddAppFeature("HwAcceleration", pHwAcceleration);
-               AppLogTag(OSP_INSTALLER, " - HwAcceleration=%s", pHwAcceleration);
+               AppLog(" - HwAcceleration=%s", pHwAcceleration);
        }
        else
        {
@@ -1285,14 +1295,14 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
                if (pGlFrame)
                {
                        AddAppFeature("GlFrame", pGlFrame);
-                       AppLogTag(OSP_INSTALLER, " - GlFrame=%s", pGlFrame);
+                       AppLog(" - GlFrame=%s", pGlFrame);
                }
        }
 
        char* pCategory = pAttr->Find("Category");
        if (pCategory)
        {
-               AppLogTag(OSP_INSTALLER, " - Category=%s", pCategory);
+               AppLog(" - Category=%s", pCategory);
 
                if (strcasecmp(pCategory, "home-screen") == 0)
                {
@@ -1307,8 +1317,8 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
                        __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_IME));
                }
 
-               CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory);
-               __pPackageAppInfoImpl->SetAppFeature(categoryType);
+               int categoryType = InstallerUtil::GetCategoryType(pCategory);
+               __pAppData->__feature = categoryType;
        }
 
        char* pSubMode = pAttr->Find("SubMode");
@@ -1316,14 +1326,14 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
        {
                if (strcasecmp(pSubMode, "True") == 0)
                {
-                       __pContext->__isSubMode = true;
-                       AppLogTag(OSP_INSTALLER, " - SubMode=%s", pSubMode);
+                       __pAppData->__isSubMode = true;
+                       AppLog(" - SubMode=%s", pSubMode);
                }
        }
 
        if (isUiApp == true)
        {
-               __pPackageAppInfoImpl->SetType("UiApp");
+               __pAppData->__type = L"UiApp";
 
                char* pMenuIconVisible = pAttr->Find("MenuIconVisible");
                if (pMenuIconVisible == null)
@@ -1335,56 +1345,62 @@ ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
                {
                        if (strcasecmp(pMenuIconVisible, "True") == 0)
                        {
-                               __pPackageAppInfoImpl->SetMainmenuVisible(true);
+                               __pAppData->__mainmenuVisible = true;
                        }
                        else
                        {
-                               __pPackageAppInfoImpl->SetMainmenuVisible(false);
+                               __pAppData->__mainmenuVisible = false;
                        }
 
                        AddAppFeature("MenuIconVisible", pMenuIconVisible);
-                       AppLogTag(OSP_INSTALLER, " - MenuIconVisible=%s", pMenuIconVisible);
+                       AppLog(" - MenuIconVisible=%s", pMenuIconVisible);
                }
        }
        else
        {
-               __pPackageAppInfoImpl->SetType("ServiceApp");
-               __pPackageAppInfoImpl->SetMainmenuVisible(false);
+               __pAppData->__type = L"ServiceApp";
+               __pAppData->__mainmenuVisible = false;
 
                char *pUseUi = pAttr->Find("UseUi");
                if (pUseUi)
                {
                        AddAppFeature("UseUi", pUseUi);
-                       AppLogTag(OSP_INSTALLER, " - UseUi=%s", pUseUi);
+                       AppLog(" - UseUi=%s", pUseUi);
                }
 
                char *pLifeDuration = pAttr->Find("LifeDuration");
                if (pLifeDuration)
                {
                        AddAppFeature("LifeDuration", pLifeDuration);
-                       AppLogTag(OSP_INSTALLER, " - LifeDuration=%s", pLifeDuration);
+                       AppLog(" - LifeDuration=%s", pLifeDuration);
                }
 
                char *pLaunchOnBoot = pAttr->Find("LaunchOnBoot");
                if (pLaunchOnBoot)
                {
                        AddAppFeature("LaunchOnBoot", pLaunchOnBoot);
-                       AppLogTag(OSP_INSTALLER, " - LaunchOnBoot=%s", pLaunchOnBoot);
+                       AppLog(" - LaunchOnBoot=%s", pLaunchOnBoot);
                }
 
                char *pAutoRestart = pAttr->Find("AutoRestart");
                if (pAutoRestart)
                {
                        AddAppFeature("AutoRestart", pAutoRestart);
-                       AppLogTag(OSP_INSTALLER, " - AutoRestart=%s", pAutoRestart);
+                       AppLog(" - AutoRestart=%s", pAutoRestart);
                }
-       }
 
-       String appId;
-       appId.Format(1024, PACKAGE_NAME_RULE, __pPackageInfoImpl->GetId().GetPointer(), pName);
-       __pPackageAppInfoImpl->SetPackageName(appId);
+               char *pSystemService = pAttr->Find("SystemService");
+               if (pSystemService)
+               {
+                       if (strcasecmp(pSystemService, "True") == 0)
+                       {
+                               __pAppData->__isSystemService = true;
+                               AppLog(" - SystemService=%s", pSystemService);
+                       }
+               }
+       }
 
-       AppLogTag(OSP_INSTALLER, " - appId=%ls", appId.GetPointer());
+       AppLog(" - appId=%ls", __pAppData->__appId.GetPointer());
 
        return true;
 }
index 1a3e0a7..edbb470 100755 (executable)
@@ -23,7 +23,6 @@
 #ifndef _MANIFEST_HANDLER_H_
 #define _MANIFEST_HANDLER_H_
 
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBaseString.h>
 
 #include "XmlHandler.h"
@@ -79,9 +78,10 @@ private:
        bool OnContentStartElement(void);
 
        // Parsers
-       bool OnLiveboxesStartElement(const char *pName);
-       bool OnAccountsStartElement(const char *pName);
-       bool OnAppControlsStartElement(const char *pName);
+       bool OnLiveboxesStartElement(const char* pName);
+       bool OnAccountsStartElement(const char* pName);
+       bool OnAppControlsStartElement(const char* pName);
+       bool OnPermissionStartElement(const char* pName);
 
        // EndElement
        bool OnPrivilegesEndElement(void);
@@ -94,8 +94,6 @@ private:
 
        bool OnDataControlEndElement(void);
        bool OnDataControlTypeEndElement(void);
-       bool OnConditionEndElement(void);
-       bool OnNotificationEndElement(void);
 
        bool OnContentsEndElement(void);
        bool OnContentEndElement(void);
@@ -139,15 +137,13 @@ private:
        InstallationContext* __pContext;
        Tizen::Base::Collection::ArrayList* __pPrivilegeList;
        Tizen::Base::Collection::ArrayList* __pContentDataList;
-       Tizen::App::Package::_PackageInfoImpl* __pPackageInfoImpl;
-       Tizen::App::Package::_PackageAppInfoImpl* __pPackageAppInfoImpl;
-       Tizen::App::Package::_AppControlInfoImpl* __pAppControlInfoImpl;
-       Tizen::App::Package::_AppControlCapabilityInfoImpl* __pAppControlCapabilityInfoImpl;
-       Tizen::App::Package::_AppControlResolutionInfoImpl* __pAppControlResolutionInfoImpl;
-       Tizen::App::Package::_DataControlInfoImpl* __pDataControlInfoImpl;
-       Tizen::App::Package::_DataControlTypeImpl* __pDataControlTypeImpl;
-       Tizen::App::Package::_LaunchConditionInfoImpl* __pLaunchConditionImpl;
-       Tizen::App::Package::_NotificationInfoImpl* __pNotificationImpl;
+
+       _AppControlInfo* __pAppControlInfoImpl;
+       _AppControlCapabilityInfo* __pAppControlCapabilityInfoImpl;
+       _AppControlResolutionInfo* __pAppControlResolutionInfoImpl;
+
+       DataControlInfo* __pDataControlInfo;
+       DataControlType* __pDataControlType;
 
        ContentData* __pContentData;
        char* __pDefaultIconType;
@@ -161,7 +157,6 @@ private:
        bool __isDefaultAppDetected;
 
        AppData* __pAppData;
-       Tizen::Base::Collection::IListT<AppControlData*>* __pSubModeAppControlDataList;
 
        bool __isParserMode;
        ManifestParser* __pParser;
index a50d680..cedf7f2 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <FIoFile.h>
 #include <FSys_SystemInfoImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ManifestAccountsParser.h"
@@ -32,7 +31,6 @@
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 using namespace Tizen::System;
 
@@ -52,7 +50,7 @@ ManifestAccountsParser::~ManifestAccountsParser(void)
 bool
 ManifestAccountsParser::OnStartElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
        bool status = true;
 
        if (strcasecmp(pName, "Accounts") == 0)
@@ -70,7 +68,7 @@ ManifestAccountsParser::OnStartElement(const char *pName)
 bool
 ManifestAccountsParser::OnEndElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
        bool status = true;
 
        if (strcasecmp(pName, "Accounts") == 0)
@@ -88,14 +86,14 @@ ManifestAccountsParser::OnEndElement(const char *pName)
 bool
 ManifestAccountsParser::OnCharacters(const char *pCharacters)
 {
-       TryReturn(pCharacters, true, "[osp-installer] pCharacters is null");
+       TryReturn(pCharacters, true, "pCharacters is null");
        bool status = true;
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        char *pName = pHandler->GetElementName();
-       TryReturn(pName, false, "[osp-installer] pName is null");
+       TryReturn(pName, false, "pName is null");
 
        if (strcasecmp(pName, "DisplayName") == 0)
        {
@@ -105,6 +103,10 @@ ManifestAccountsParser::OnCharacters(const char *pCharacters)
        {
                status = OnIconValue(pCharacters);
        }
+       else if (strcasecmp(pName, "Capability") == 0)
+       {
+               status = OnCapabilityValue(pCharacters);
+       }
 
        return true;
 }
@@ -113,12 +115,12 @@ bool
 ManifestAccountsParser::OnAccountsStartElement(void)
 {
        ManifestHandler* __pHandler = GetHandler();
-       TryReturn(__pHandler, false, "[osp-installer] __pHandler is null");
+       TryReturn(__pHandler, false, "__pHandler is null");
 
        __pContext = __pHandler->GetContext();
-       TryReturn(__pContext, false, "[osp-installer] __pContext is null");
+       TryReturn(__pContext, false, "__pContext is null");
 
-       AppLogTag(OSP_INSTALLER, "  <Accounts>");
+       AppLog("  <Accounts>");
 
        return true;
 }
@@ -129,28 +131,36 @@ ManifestAccountsParser::OnAccountProviderStartElement(void)
        XmlAttribute *pAttr = null;
 
        __pAccountData = new (std::nothrow) AccountData;
-       TryReturn(__pAccountData, false, "[osp-installer] __pAccountData is null");
+       TryReturn(__pAccountData, false, "__pAccountData is null");
+
+       bool res = __pAccountData->Construct();
+       TryReturn(res, false, "__pAccountData->Construct() is failed.");
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
-       AppLogTag(OSP_INSTALLER, "  <AccountProvider>");
+       AppLog("  <AccountProvider>");
 
        char *pProviderId = pAttr->Find("ProviderId");
        if (pProviderId)
        {
                __pAccountData->__providerId = pProviderId;
-               AppLogTag(OSP_INSTALLER, "   - ProviderId=%s", pProviderId);
+               AppLog("   - ProviderId=%s", pProviderId);
+       }
+       else
+       {
+               __pAccountData->__providerId = L"none";
+               AppLog("   - ProviderId=%s", "none");
        }
 
        char *pMultipleAccountsSupport = pAttr->Find("MultipleAccountsSupport");
        if (pMultipleAccountsSupport)
        {
                __pAccountData->__multipleAccountsSupport = pMultipleAccountsSupport;
-               AppLogTag(OSP_INSTALLER, "   - MultipleAccountsSupport=%s", pMultipleAccountsSupport);
+               AppLog("   - MultipleAccountsSupport=%s", pMultipleAccountsSupport);
        }
 
        return true;
@@ -159,7 +169,7 @@ ManifestAccountsParser::OnAccountProviderStartElement(void)
 bool
 ManifestAccountsParser::OnAccountsEndElement(void)
 {
-       AppLogTag(OSP_INSTALLER, "  </Accounts>");
+       AppLog("  </Accounts>");
 
        return true;
 }
@@ -168,14 +178,14 @@ bool
 ManifestAccountsParser::OnAccountProviderEndElement(void)
 {
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        AppData* pAppData = pHandler->GetAppData();
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
        pAppData->__pAccountDataList->Add(__pAccountData);
        __pAccountData = null;
-       AppLogTag(OSP_INSTALLER, "  </AccountProvider>");
+       AppLog("  </AccountProvider>");
 
        return true;
 }
@@ -187,19 +197,19 @@ ManifestAccountsParser::OnDisplayNameValue(const char *pCharacters)
        char* pAttrValue = 0;
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pAttrValue = pAttr->Find("Locale");
-       TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
+       TryReturn(pAttrValue, true, "pAttrValue is null");
 
        String* pValue = new (std::nothrow) String;
        StringUtil::Utf8ToString(pCharacters, *pValue);
        __pAccountData->__pNameList->Add(new (std::nothrow) String(pAttrValue), pValue);
 
-       AppLogTag(OSP_INSTALLER, "  <DisplayName>%s</DisplayName>", pCharacters);
+       AppLog("  <DisplayName>%s</DisplayName>", pCharacters);
 
        return true;
 }
@@ -207,66 +217,58 @@ ManifestAccountsParser::OnDisplayNameValue(const char *pCharacters)
 bool
 ManifestAccountsParser::OnIconValue(const char *pCharacters)
 {
-       XmlAttribute* pAttr = 0;
-       char* pSectionValue = 0;
-       char* pTypeValue = 0;
+       AppLog("  <Icon>%s</Icon>", pCharacters);
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
-
-       pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
-       pSectionValue = pAttr->Find("Section");
-       TryReturn(pSectionValue, true, "[osp-installer] pSectionValue is null");
+       XmlAttribute* pAttr = pHandler->GetAttribute();
+       TryReturn(pAttr, true, "pAttr is null");
 
-       pTypeValue = pAttr->Find("Type");
-       TryReturn(pTypeValue, true, "[osp-installer] pTypeValue is null");
+       char* pSection = pAttr->Find("Section");
+       TryReturn(pSection, true, "pSection is null");
+       AppLog("   - Section=%s", pSection);
 
        char* pDefaultIconType = pHandler->GetDefaultIconType();
-       TryReturn(pDefaultIconType, false, "[osp-installer] pDefaultIconType is null");
+       TryReturn(pDefaultIconType, false, "pDefaultIconType is null");
+       AppLog("  pDefaultIconType=%s", pDefaultIconType);
 
-       String icon;
-       if (strcasecmp(pTypeValue, "Xhigh") == 0)
+       String iconRelPath;
+       if (strcasecmp(pDefaultIconType, "Xhigh") == 0)
        {
-               icon.Format(1024, L"%s/%s", "screen-density-xhigh", pCharacters);
+               iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
        }
-       else if (strcasecmp(pTypeValue, "High") == 0)
+       else if (strcasecmp(pDefaultIconType, "High") == 0)
        {
-               icon.Format(1024, L"%s/%s", "screen-density-high", pCharacters);
+               iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
        }
        else
        {
-               AppLogTag(OSP_INSTALLER, "Invalid Type [%s]", pDefaultIconType);
-               return false;
+               TryReturn(0, false, "Invalid pDefaultIconType[%s]", pDefaultIconType);
        }
 
-       if (strcasecmp(pSectionValue, "Account") == 0)
+       if (strcasecmp(pSection, "Account") == 0)
        {
-               if (__isAccountIconSelected == false)
-               {
-                       __pAccountData->__accountIcon = icon;
-               }
-
-               if (strcasecmp(pTypeValue, pDefaultIconType) == 0)
-               {
-                       __isAccountIconSelected = true;
-               }
+               __pAccountData->__accountIcon = iconRelPath;
        }
-       else if (strcasecmp(pSectionValue, "AccountSmall") == 0)
+       else if (strcasecmp(pSection, "AccountSmall") == 0)
        {
-               if (__isAccountSmallIconSelected == false)
-               {
-                       __pAccountData->__accountSmallIcon = icon;
-               }
-
-               if (strcasecmp(pTypeValue, pDefaultIconType) == 0)
-               {
-                       __isAccountSmallIconSelected = true;
-               }
+               __pAccountData->__accountSmallIcon = iconRelPath;
        }
 
-       AppLogTag(OSP_INSTALLER, "  <Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pSectionValue, pTypeValue, pCharacters);
+       return true;
+}
+
+bool
+ManifestAccountsParser::OnCapabilityValue(const char *pCharacters)
+{
+       String* pValue = new (std::nothrow) String;
+       TryReturn(pValue, false, "pValue is null.");
+
+       StringUtil::Utf8ToString(pCharacters, *pValue);
+       __pAccountData->__pCapabilityList->Add(pValue);
+
+       AppLog("  <Capability>%s</Capability>", pCharacters);
 
        return true;
 }
index 74e90cb..4209283 100755 (executable)
@@ -25,8 +25,6 @@
 
 #include <FBaseString.h>
 
-#include <FAppPkg_PackageInfoImpl.h>
-
 #include "ManifestParser.h"
 #include "InstallationContext.h"
 
@@ -45,9 +43,9 @@ public:
        ManifestAccountsParser(void);
        virtual ~ManifestAccountsParser(void);
 
-       virtual bool OnStartElement(const char *pName);
-       virtual bool OnEndElement(const char *pName);
-       virtual bool OnCharacters(const char *pCharacters);
+       virtual bool OnStartElement(const charpName);
+       virtual bool OnEndElement(const charpName);
+       virtual bool OnCharacters(const charpCharacters);
 
 private:
        bool OnAccountsStartElement(void);
@@ -55,8 +53,9 @@ private:
        bool OnAccountsEndElement(void);
        bool OnAccountProviderEndElement(void);
 
-       bool OnDisplayNameValue(const char *pCharacters);
-       bool OnIconValue(const char *pCharacters);
+       bool OnDisplayNameValue(const char* pCharacters);
+       bool OnIconValue(const char* pCharacters);
+       bool OnCapabilityValue(const char* pCharacters);
 
 private:
        InstallationContext* __pContext;
index 44ab921..3a7aed5 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <FIoFile.h>
 #include <FSys_SystemInfoImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ManifestAppControlsParser.h"
@@ -32,7 +31,6 @@
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 using namespace Tizen::System;
 
@@ -51,7 +49,7 @@ ManifestAppControlsParser::~ManifestAppControlsParser(void)
 bool
 ManifestAppControlsParser::OnStartElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
        bool status = true;
 
        if (strcasecmp(pName, "AppControls") == 0)
@@ -77,7 +75,7 @@ ManifestAppControlsParser::OnStartElement(const char *pName)
 bool
 ManifestAppControlsParser::OnEndElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
        bool status = true;
 
        if (strcasecmp(pName, "AppControls") == 0)
@@ -103,14 +101,14 @@ ManifestAppControlsParser::OnEndElement(const char *pName)
 bool
 ManifestAppControlsParser::OnCharacters(const char *pCharacters)
 {
-       TryReturn(pCharacters, true, "[osp-installer] pCharacters is null");
+       TryReturn(pCharacters, true, "pCharacters is null");
        bool status = true;
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        char *pName = pHandler->GetElementName();
-       TryReturn(pName, false, "[osp-installer] pName is null");
+       TryReturn(pName, false, "pName is null");
 
        if (strcasecmp(pName, "Operation") == 0)
        {
@@ -132,12 +130,12 @@ bool
 ManifestAppControlsParser::OnAppControlsStartElement(void)
 {
        ManifestHandler* __pHandler = GetHandler();
-       TryReturn(__pHandler, false, "[osp-installer] __pHandler is null");
+       TryReturn(__pHandler, false, "__pHandler is null");
 
        __pContext = __pHandler->GetContext();
-       TryReturn(__pContext, false, "[osp-installer] __pContext is null");
+       TryReturn(__pContext, false, "__pContext is null");
 
-       AppLogTag(OSP_INSTALLER, "  <AppControls>");
+       AppLog("  <AppControls>");
        return true;
 }
 
@@ -145,30 +143,30 @@ bool
 ManifestAppControlsParser::OnAppControlStartElement(void)
 {
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        AppData* pAppData = pHandler->GetAppData();
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
-       AppLogTag(OSP_INSTALLER, "  <AppControl>");
+       AppLog("  <AppControl>");
 
        XmlAttribute *pAttr = pHandler->GetAttribute();
        if (pAttr == null)
        {
                __pAppControlData = new (std::nothrow) AppControlData;
-               TryReturn(__pAppControlData, false, "[osp-installer] __pAppControlData is null");
+               TryReturn(__pAppControlData, false, "__pAppControlData is null");
                __legacyAppControls = false;
 
                return true;
        }
 
-       pHandler->__pAppControlInfoImpl = new (std::nothrow) _AppControlInfoImpl;
-       TryReturn(pHandler->__pAppControlInfoImpl, false, "[osp-installer] pHandler->__pAppControlInfoImpl is null");
+       pHandler->__pAppControlInfoImpl = new (std::nothrow) _AppControlInfo;
+       TryReturn(pHandler->__pAppControlInfoImpl, false, "pHandler->__pAppControlInfoImpl is null");
 
        char* pProviderId = pAttr->Find("ProviderId");
        if (pProviderId)
        {
-               AppLogTag(OSP_INSTALLER, "   - ProviderId=%s", pProviderId);
+               AppLog("   - ProviderId=%s", pProviderId);
                pHandler->__pAppControlInfoImpl->SetProviderId(pProviderId);
                __legacyAppControls = true;
        }
@@ -176,7 +174,7 @@ ManifestAppControlsParser::OnAppControlStartElement(void)
        char* pCategory = pAttr->Find("Category");
        if (pCategory)
        {
-               AppLogTag(OSP_INSTALLER, "   - Category=%s", pCategory);
+               AppLog("   - Category=%s", pCategory);
                pHandler->__pAppControlInfoImpl->SetCategory(pCategory);
        }
 
@@ -192,20 +190,20 @@ ManifestAppControlsParser::OnCapabilityStartElement(void)
        }
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        XmlAttribute *pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
-       AppLogTag(OSP_INSTALLER, "  <Capability>");
+       AppLog("  <Capability>");
 
        char* pOperationId = pAttr->Find("OperationId");
        if (pOperationId)
        {
-               AppLogTag(OSP_INSTALLER, "   - OperationId=%s", pOperationId);
+               AppLog("   - OperationId=%s", pOperationId);
 
-               pHandler->__pAppControlCapabilityInfoImpl = new (std::nothrow) _AppControlCapabilityInfoImpl;
-               TryReturn(pHandler->__pAppControlCapabilityInfoImpl, false, "[osp-installer] pHandler->__pAppControlCapabilityInfoImpl is null");
+               pHandler->__pAppControlCapabilityInfoImpl = new (std::nothrow) _AppControlCapabilityInfo;
+               TryReturn(pHandler->__pAppControlCapabilityInfoImpl, false, "pHandler->__pAppControlCapabilityInfoImpl is null");
 
                pHandler->__pAppControlCapabilityInfoImpl->SetOperationId(pOperationId);
        }
@@ -222,27 +220,27 @@ ManifestAppControlsParser::OnResolutionStartElement(void)
        }
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        XmlAttribute *pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
-       pHandler->__pAppControlResolutionInfoImpl = new (std::nothrow) _AppControlResolutionInfoImpl;
-       TryReturn(pHandler->__pAppControlResolutionInfoImpl, false, "[osp-installer] pHandler->__pAppControlResolutionInfoImpl is null");
+       pHandler->__pAppControlResolutionInfoImpl = new (std::nothrow) _AppControlResolutionInfo;
+       TryReturn(pHandler->__pAppControlResolutionInfoImpl, false, "pHandler->__pAppControlResolutionInfoImpl is null");
 
-       AppLogTag(OSP_INSTALLER, "  <Resolution>");
+       AppLog("  <Resolution>");
 
        char* pMimeType = pAttr->Find("MimeType");
        if (pMimeType)
        {
-               AppLogTag(OSP_INSTALLER, "   - MimeType=%s", pMimeType);
+               AppLog("   - MimeType=%s", pMimeType);
                pHandler->__pAppControlResolutionInfoImpl->SetMimeType(new (std::nothrow) String(pMimeType));
        }
 
        char* pUriScheme = pAttr->Find("UriScheme");
        if (pUriScheme)
        {
-               AppLogTag(OSP_INSTALLER, "   - UriScheme=%s", pUriScheme);
+               AppLog("   - UriScheme=%s", pUriScheme);
                pHandler->__pAppControlResolutionInfoImpl->SetUriScheme(new (std::nothrow) String(pUriScheme));
        }
 
@@ -253,17 +251,17 @@ bool
 ManifestAppControlsParser::OnAppControlsEndElement(void)
 {
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        AppData* pAppData = pHandler->GetAppData();
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
        pAppData->__legacyAppControls = __legacyAppControls;
-       AppLogTag(OSP_INSTALLER, "  </AppControls>");
+       AppLog("  </AppControls>");
 
        if (pAppData->__legacyAppControls == true)
        {
-               AppLogTag(OSP_INSTALLER, "  AppControls spec is legacy");
+               AppLog("  AppControls spec is legacy");
        }
 
        return true;
@@ -273,16 +271,16 @@ bool
 ManifestAppControlsParser::OnAppControlEndElement(void)
 {
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        AppData* pAppData = pHandler->GetAppData();
-       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+       TryReturn(pAppData, false, "pAppData is null");
 
-       AppLogTag(OSP_INSTALLER, "  </AppControl>");
+       AppLog("  </AppControl>");
 
        if (__legacyAppControls == true)
        {
-               pHandler->__pPackageAppInfoImpl->AddAppControl(pHandler->__pAppControlInfoImpl);
+               pAppData->__pAppControlImplList->Add(pHandler->__pAppControlInfoImpl);
                pHandler->__pAppControlInfoImpl = null;
        }
        else
@@ -303,14 +301,14 @@ ManifestAppControlsParser::OnCapabilityEndElement(void)
        }
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        if (pHandler->__pAppControlInfoImpl)
        {
                pHandler->__pAppControlInfoImpl->AddCapability(pHandler->__pAppControlCapabilityInfoImpl);
                pHandler->__pAppControlCapabilityInfoImpl = null;
        }
-       AppLogTag(OSP_INSTALLER, "  </Capability>");
+       AppLog("  </Capability>");
 
        return true;
 }
@@ -324,12 +322,12 @@ ManifestAppControlsParser::OnResolutionEndElement(void)
        }
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        pHandler->__pAppControlCapabilityInfoImpl->AddResolution(pHandler->__pAppControlResolutionInfoImpl);
        pHandler->__pAppControlResolutionInfoImpl = null;
 
-       AppLogTag(OSP_INSTALLER, "  </Resolution>");
+       AppLog("  </Resolution>");
 
        return true;
 }
@@ -347,7 +345,7 @@ ManifestAppControlsParser::OnOperationValue(const char* pCharacters)
                String* pStr = new (std::nothrow) String(pCharacters);
                if (__pAppControlData->__pOperationList->Contains(pStr) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "  <Operation>%s</Operation>", pCharacters);
+                       AppLog("  <Operation>%s</Operation>", pCharacters);
                        __pAppControlData->__pOperationList->Add(pStr);
                }
        }
@@ -368,7 +366,7 @@ ManifestAppControlsParser::OnMimeTypeValue(const char* pCharacters)
                String* pStr = new (std::nothrow) String(pCharacters);
                if (__pAppControlData->__pMimeTypeList->Contains(pStr) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "  <MimeType>%s</MimeType>", pCharacters);
+                       AppLog("  <MimeType>%s</MimeType>", pCharacters);
                        __pAppControlData->__pMimeTypeList->Add(pStr);
                }
        }
@@ -389,7 +387,7 @@ ManifestAppControlsParser::OnUriValue(const char* pCharacters)
                String* pStr = new (std::nothrow) String(pCharacters);
                if (__pAppControlData->__pUriList->Contains(pStr) == false)
                {
-                       AppLogTag(OSP_INSTALLER, "  <Uri>%s</Uri>", pCharacters);
+                       AppLog("  <Uri>%s</Uri>", pCharacters);
                        __pAppControlData->__pUriList->Add(pStr);
                }
        }
index 52ab0cd..58c8c56 100755 (executable)
@@ -25,8 +25,6 @@
 
 #include <FBaseString.h>
 
-#include <FAppPkg_PackageInfoImpl.h>
-
 #include "ManifestParser.h"
 #include "InstallationContext.h"
 
index 726c9c3..d18ecff 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <FIoFile.h>
 #include <FSys_SystemInfoImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ManifestLiveboxesParser.h"
@@ -33,7 +32,6 @@
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 using namespace Tizen::System;
 
@@ -51,7 +49,7 @@ ManifestLiveboxesParser::~ManifestLiveboxesParser(void)
 bool
 ManifestLiveboxesParser::OnStartElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
 
        bool status = true;
 
@@ -70,7 +68,7 @@ ManifestLiveboxesParser::OnStartElement(const char *pName)
 bool
 ManifestLiveboxesParser::OnEndElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null");
+       TryReturn(pName, true, "pName is null");
 
        bool status = true;
 
@@ -89,15 +87,15 @@ ManifestLiveboxesParser::OnEndElement(const char *pName)
 bool
 ManifestLiveboxesParser::OnCharacters(const char *pCharacters)
 {
-       TryReturn(pCharacters, true, "[osp-installer] pCharacters is null");
+       TryReturn(pCharacters, true, "pCharacters is null");
 
        bool status = true;
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        char *pName = pHandler->GetElementName();
-       TryReturn(pName, false, "[osp-installer] pName is null");
+       TryReturn(pName, false, "pName is null");
 
        if (strcasecmp(pName, "DisplayName") == 0)
        {
@@ -119,15 +117,15 @@ bool
 ManifestLiveboxesParser::OnLiveboxesStartElement()
 {
        ManifestHandler* __pHandler = GetHandler();
-       TryReturn(__pHandler, false, "[osp-installer] __pHandler is null");
+       TryReturn(__pHandler, false, "__pHandler is null");
 
        __pContext = __pHandler->GetContext();
-       TryReturn(__pContext, false, "[osp-installer] __pContext is null");
+       TryReturn(__pContext, false, "__pContext is null");
 
        __pLiveboxDataList = new (std::nothrow) ArrayList;
-       TryReturn(__pLiveboxDataList, false, "[osp-installer] __pLiveboxDataList is null");
+       TryReturn(__pLiveboxDataList, false, "__pLiveboxDataList is null");
 
-       AppLogTag(OSP_INSTALLER, "  <Liveboxes>");
+       AppLog("  <Liveboxes>");
 
        return true;
 }
@@ -138,21 +136,21 @@ ManifestLiveboxesParser::OnLiveboxStartElement(void)
        XmlAttribute *pAttr = null;
 
        __pLiveboxData = new (std::nothrow) LiveboxData;
-       TryReturn(__pLiveboxData, false, "[osp-installer] __pLiveboxData is null");
+       TryReturn(__pLiveboxData, false, "__pLiveboxData is null");
 
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
        pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
-       AppLogTag(OSP_INSTALLER, "  <Livebox>");
+       AppLog("  <Livebox>");
 
        char *pProviderName = pAttr->Find("ProviderName");
        if (pProviderName)
        {
                __pLiveboxData->SetProviderName(pProviderName);
-               AppLogTag(OSP_INSTALLER, "   - ProviderName=%s", pProviderName);
+               AppLog("   - ProviderName=%s", pProviderName);
        }
 
        char *pUpdatePeriod = pAttr->Find("UpdatePeriod");
@@ -160,21 +158,26 @@ ManifestLiveboxesParser::OnLiveboxStartElement(void)
        {
                long long updatePeriod = atoll(pUpdatePeriod);
                __pLiveboxData->SetUpdatePeriod(updatePeriod);
-               AppLogTag(OSP_INSTALLER, "   - UpdatePeriod=%lld", updatePeriod);
+               AppLog("   - UpdatePeriod=%lld", updatePeriod);
        }
 
        char *pLiveboxPopupEnabled = pAttr->Find("LiveboxPopupEnabled");
        if (pLiveboxPopupEnabled)
        {
                __pLiveboxData->SetPopupEnabled(pLiveboxPopupEnabled);
-               AppLogTag(OSP_INSTALLER, "   - LiveboxPopupEnabled=%s", pLiveboxPopupEnabled);
+               AppLog("   - LiveboxPopupEnabled=%s", pLiveboxPopupEnabled);
        }
 
-       char *pMain = pAttr->Find("Main");
-       if (pMain)
+       char* pDefault = pAttr->Find("Default");
+       if (pDefault == null)
        {
-               __pLiveboxData->__main = pMain;
-               AppLogTag(OSP_INSTALLER, "   - Main=%s", pMain);
+               pDefault = pAttr->Find("Main");
+       }
+
+       if (pDefault)
+       {
+               __pLiveboxData->__default = pDefault;
+               AppLog("   - Default=%s", pDefault);
        }
 
        return true;
@@ -185,7 +188,7 @@ ManifestLiveboxesParser::OnLiveboxesEndElement(void)
 {
        __pContext->SetLiveboxDataList(__pLiveboxDataList);
        __pLiveboxDataList = null;
-       AppLogTag(OSP_INSTALLER, "  </Liveboxes>");
+       AppLog("  </Liveboxes>");
 
        return true;
 }
@@ -195,7 +198,7 @@ ManifestLiveboxesParser::OnLiveboxEndElement(void)
 {
        __pLiveboxDataList->Add(*__pLiveboxData);
        __pLiveboxData = null;
-       AppLogTag(OSP_INSTALLER, "  </Livebox>");
+       AppLog("  </Livebox>");
 
        return true;
 }
@@ -203,32 +206,63 @@ ManifestLiveboxesParser::OnLiveboxEndElement(void)
 bool
 ManifestLiveboxesParser::OnSizeValue(const char *pCharacters)
 {
-       __pLiveboxData->AddSize(*(new (std::nothrow) String(pCharacters)));
+       ManifestHandler* pHandler = GetHandler();
+       TryReturn(pHandler, false, "pHandler is null");
+
+       AppLog("  <Size>%s</Size>", pCharacters);
+
+       String* pPreviewImage = new (std::nothrow) String();
+       TryReturn(pPreviewImage, false, "pPreviewImage is null");
+
+       XmlAttribute* pAttr = pHandler->GetAttribute();
+       if (pAttr)
+       {
+               char* pAttrValue = pAttr->Find("PreviewImage");
+               if (pAttrValue)
+               {
+                       char* pDefaultIconType = pHandler->GetDefaultIconType();
+                       TryReturn(pDefaultIconType, false, "pDefaultIconType is null");
+                       AppLog("  pDefaultIconType=%s", pDefaultIconType);
+
+                       if (strcasecmp(pDefaultIconType, "Xhigh") == 0)
+                       {
+                               pPreviewImage->Format(1024, L"screen-density-xhigh/%s", pAttrValue);
+                       }
+                       else if (strcasecmp(pDefaultIconType, "High") == 0)
+                       {
+                               pPreviewImage->Format(1024, L"screen-density-high/%s", pAttrValue);
+                       }
+                       else
+                       {
+                               TryReturn(0, false, "Invalid pDefaultIconType[%s]", pDefaultIconType);
+                       }
+
+                       AppLog("   - PreviewImage=%s", pAttrValue);
+               }
+       }
+
+       __pLiveboxData->AddSize(new (std::nothrow) String(pCharacters), pPreviewImage);
 
-       AppLogTag(OSP_INSTALLER, "  <Size>%s</Size>", pCharacters);
        return true;
 }
 
 bool
 ManifestLiveboxesParser::OnDisplayNameValue(const char *pCharacters)
 {
-       XmlAttribute* pAttr = 0;
-       char* pAttrValue = 0;
-
        ManifestHandler* pHandler = GetHandler();
-       TryReturn(pHandler, false, "[osp-installer] pHandler is null");
+       TryReturn(pHandler, false, "pHandler is null");
 
-       pAttr = pHandler->GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       XmlAttribute* pAttr = pHandler->GetAttribute();
+       TryReturn(pAttr, true, "pAttr is null");
 
-       pAttrValue = pAttr->Find("Locale");
-       TryReturn(pAttrValue, true, "[osp-installer] pAttrValue is null");
+       char* pAttrValue = pAttr->Find("Locale");
+       TryReturn(pAttrValue, true, "pAttrValue is null");
 
        String* pValue = new (std::nothrow) String;
        StringUtil::Utf8ToString(pCharacters, *pValue);
        __pLiveboxData->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue);
 
-       AppLogTag(OSP_INSTALLER, "  <DisplayName>%s</DisplayName>", pCharacters);
+       AppLog("  <DisplayName>%s</DisplayName>", pCharacters);
 
        return true;
 }
@@ -237,7 +271,7 @@ bool
 ManifestLiveboxesParser::OnConfigurationAppControlAppIdValue(const char* pCharacters)
 {
        __pLiveboxData->__configurationAppControlAppId = pCharacters;
-       AppLogTag(OSP_INSTALLER, "  <ConfigurationAppControlAppId>%s</ConfigurationAppControlAppId>", pCharacters);
+       AppLog("  <ConfigurationAppControlAppId>%s</ConfigurationAppControlAppId>", pCharacters);
 
        return true;
 }
index ad61c64..6dee753 100755 (executable)
@@ -25,8 +25,6 @@
 
 #include <FBaseString.h>
 
-#include <FAppPkg_PackageInfoImpl.h>
-
 #include "ManifestParser.h"
 #include "InstallationContext.h"
 
index f5be175..f7ef9b6 100755 (executable)
@@ -21,7 +21,6 @@
 
 #include <FIoFile.h>
 #include <FSys_SystemInfoImpl.h>
-#include <FAppPkg_PackageInfoImpl.h>
 #include <FBase_StringConverter.h>
 
 #include "ManifestParser.h"
@@ -30,7 +29,6 @@
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Utility;
-using namespace Tizen::App::Package;
 using namespace Tizen::Io;
 using namespace Tizen::System;
 
index 2033d6f..0b4c053 100755 (executable)
@@ -25,8 +25,6 @@
 
 #include <FBaseString.h>
 
-#include <FAppPkg_PackageInfoImpl.h>
-
 #include "InstallationContext.h"
 
 class ManifestHandler;
index c570742..c6ff2ad 100755 (executable)
 #include <stdlib.h>
 
 #include <FBaseString.h>
-#include <FBaseSysLog.h>
+#include <FBaseLog.h>
 #include <FSecCryptoAesCipher.h>
 #include <FSecCryptoSha1Hash.h>
 #include <FBase_StringConverter.h>
 #include <FBaseInternalTypes.h>
 #include <FSec_AccessControlTypes.h>
 #include <FSec_DeviceKeyGenerator.h>
+#include <FIoFile.h>
 
 #include "InstallerDefs.h"
 #include "PrivilegeHandler.h"
+#include "InstallerUtil.h"
 
 using namespace Tizen::App;
 using namespace Tizen::Base;
@@ -40,18 +42,60 @@ using namespace Tizen::Base::Utility;
 using namespace Tizen::Security;
 using namespace Tizen::Security::Crypto;
 using namespace Tizen::Text;
+using namespace Tizen::Io;
+
 
 result
-PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, String& encryptedPrivileges, String& checksum)
+PrivilegeHandler::PickExternalPrivilege(const IList& fullPrivilegeList, IList& normalPrivilegeList, IList& externalPrivilegeList)
+{
+       result r = E_SUCCESS;
+       File file;
+       String externalPrivilege;
+       ArrayList privilegeList;
+
+       r = file.Construct(EXTERNAL_PRIVILEGE_FILE_NAME, "r");
+       TryReturnResultTag(OSP_INSTALLER, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       privilegeList.Construct();
+
+       while (file.Read(externalPrivilege) == E_SUCCESS)
+       {
+               externalPrivilege.Remove(externalPrivilege.GetLength()-1, 1);
+               privilegeList.Add(new String(externalPrivilege));
+       }
+
+       IEnumerator* pEnum = fullPrivilegeList.GetEnumeratorN();
+
+       while(pEnum->MoveNext() == E_SUCCESS)
+       {
+               String* tempString = static_cast<String*>(pEnum->GetCurrent());
+
+               if (privilegeList.Contains(*tempString))
+               {
+                       externalPrivilegeList.Add(new String(*tempString));
+               }
+               else
+               {
+                       normalPrivilegeList.Add(new String(*tempString));
+               }
+       }
+
+       delete pEnum;
+       privilegeList.RemoveAll(true);
+       return r;
+}
+
+result
+PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, String& encryptedPrivileges, String& checksum, IList& stringPrivilegeList)
 {
        result r = E_SUCCESS;
        byte* pBitwisePrivilege = null;
        int count = 0;
-
-       SysLog(NID_SEC, "Enter.");
+       ArrayList normalPrivilegeList;
 
        encryptedPrivileges.Clear();
        checksum.Clear();
+       normalPrivilegeList.Construct();
 
        count = privilegeList.GetCount();
        if (count == 0)
@@ -59,14 +103,17 @@ PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privi
                goto CATCH;
        }
 
-       pBitwisePrivilege = PackPrivilegeN(privilegeList);
-       SysTryReturnResult(NID_SEC, pBitwisePrivilege != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       r = PickExternalPrivilege(privilegeList, normalPrivilegeList, stringPrivilegeList);
+       TryReturnResultTag(OSP_INSTALLER, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pBitwisePrivilege = PackPrivilegeN(normalPrivilegeList);
+       TryReturnResultTag(OSP_INSTALLER, pBitwisePrivilege != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        r = GetEncryptedBitwise(pBitwisePrivilege, encryptedPrivileges);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        r = GetChecksum(appId, pBitwisePrivilege, checksum);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        // fall through
 
@@ -77,21 +124,21 @@ CATCH:
                free(pBitwisePrivilege);
        }
 
-       SysLog(NID_SEC, "Exit.");
+       normalPrivilegeList.RemoveAll(true);
        return r;
 }
 
 result
-PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, int visibilityLevel, String& encryptedPrivileges, String& checksum)
+PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privilegeList, int visibilityLevel, String& encryptedPrivileges, String& checksum, IList& stringPrivilegeList)
 {
        result r = E_SUCCESS;
        byte* pBitwisePrivilege = null;
        int count = 0;
-
-       SysLog(NID_SEC, "Enter.");
+       ArrayList normalPrivilegeList;
 
        encryptedPrivileges.Clear();
        checksum.Clear();
+       normalPrivilegeList.Construct();
 
        count = privilegeList.GetCount();
        if (count == 0)
@@ -99,14 +146,17 @@ PrivilegeHandler::GenerateCipherPrivilege(const AppId& appId, const IList& privi
                goto CATCH;
        }
 
-       r = PackPrivilegeN(privilegeList, visibilityLevel, &pBitwisePrivilege);
-       SysTryReturnResult(NID_SEC,   r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       r = PickExternalPrivilege(privilegeList, normalPrivilegeList, stringPrivilegeList);
+       TryReturnResultTag(OSP_INSTALLER, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = PackPrivilegeN(normalPrivilegeList, visibilityLevel, &pBitwisePrivilege);
+       TryReturnResultTag(OSP_INSTALLER, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = GetEncryptedBitwise(pBitwisePrivilege, encryptedPrivileges);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        r = GetChecksum(appId, pBitwisePrivilege, checksum);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        // fall through
 
@@ -117,7 +167,7 @@ CATCH:
                free(pBitwisePrivilege);
        }
 
-       SysLog(NID_SEC, "Exit.");
+       normalPrivilegeList.RemoveAll(true);
        return r;
 }
 
@@ -135,16 +185,15 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList)
        byte* pBitwisePrivilege = null;
        IEnumerator* pEnum = null;
 
-       SysLog(NID_SEC, "Enter.");
        ClearLastResult();
 
        pResult = (byte*) malloc(sizeof(byte) * MAX_BITWISE_PRIV_SIZE);
-       SysTryReturn(NID_SEC, pResult != null, null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       TryReturnResultTag(OSP_INSTALLER, pResult != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        memset(pResult, 0, MAX_BITWISE_PRIV_SIZE);
 
        pEnum = privilegeList.GetEnumeratorN();
-       SysTryCatch(NID_SEC, pEnum != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatch(pEnum != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        while (pEnum->MoveNext() == E_SUCCESS)
        {
@@ -155,8 +204,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList)
 
                if ((pTempString->GetLength()) < (privilegeURI.GetLength()))
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(1): length error[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (Length error): [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                        continue;
                }
@@ -166,8 +214,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList)
 
                if (!(uriString.Equals(privilegeURI, true)))
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(1): uri error[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (URI error): [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                        continue;
                }
@@ -191,19 +238,17 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList)
 
                if (validStringFlag == false)
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(1): validStringFlag is false[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string: [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                }
        }
 
-       SysTryCatch(NID_SEC, resultFlag == true, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
+       TryCatchTag(OSP_INSTALLER, resultFlag == true, r = E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
 
        pBitwisePrivilege = pResult;
 
        delete pEnum;
 
-       SysLog(NID_SEC, "Exit.");
        return pBitwisePrivilege;
 
 CATCH:
@@ -211,7 +256,8 @@ CATCH:
        delete pEnum;
        free(pResult);
 
-       SysLog(NID_SEC, "Exit.");
+       SetLastResult(r);
+
        return null;
 }
 
@@ -229,16 +275,15 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel
        byte* pResult = null;
        IEnumerator* pEnum = null;
 
-       SysLog(NID_SEC, "Enter.");
        ClearLastResult();
 
        pResult = (byte*) malloc(sizeof(byte) * MAX_BITWISE_PRIV_SIZE);
-       SysTryReturn(NID_SEC, pResult != null, null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       TryReturnResultTag(OSP_INSTALLER, pResult != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
 
        memset(pResult, 0, MAX_BITWISE_PRIV_SIZE);
 
        pEnum = privilegeList.GetEnumeratorN();
-       SysTryCatch(NID_SEC, pEnum != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, pEnum != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        while (pEnum->MoveNext() == E_SUCCESS)
        {
@@ -251,8 +296,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel
 
                if ((pTempString->GetLength()) < (privilegeURI.GetLength()))
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(3): length error[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (Length error): [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                        continue;
                }
@@ -262,8 +306,7 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel
 
                if (!(uriString.Equals(privilegeURI, true)))
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(3): uri error[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string (URI error): [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                        continue;
                }
@@ -296,26 +339,23 @@ PrivilegeHandler::PackPrivilegeN(const IList& privilegeList, int visibilityLevel
 
                if (validStringFlag == false)
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] Invalid privilege string : %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(3): privilege string error[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] Invalid privilege string: [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                }
 
                if (validLevelFlag == false)
                {
-                       SysLogException(NID_SEC, E_INVALID_ARG, "[E_INVALID_ARG] The application does not have the visibility to register %ls", pTempString->GetPointer());
-                       AppLogTag(OSP_INSTALLER, "[Privilege] PackPrivilegeN(3): validLevelFlag is false[%ls]", pTempString->GetPointer());
+                       AppLogExceptionTag(OSP_INSTALLER, "[E_INVALID_ARG] The application does not have the visibility to register [%ls]", pTempString->GetPointer());
                        resultFlag = false;
                }
        }
 
-       SysTryCatch(NID_SEC, resultFlag == true, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
+       TryCatchTag(OSP_INSTALLER, resultFlag == true, r = E_INVALID_ARG, "[E_INVALID_ARG] One of privilege string is invalid.");
 
        *ppBitwisePrivilege = pResult;
 
        delete pEnum;
 
-       SysLog(NID_SEC, "Exit.");;
        return r;
 
 CATCH:
@@ -323,7 +363,6 @@ CATCH:
        delete pEnum;
        free(pResult);
 
-       SysLog(NID_SEC, "Exit.");
        return r;
 }
 
@@ -334,20 +373,18 @@ PrivilegeHandler::GetEncryptedBitwise(byte* pBitwisePrivilege, String& encrypted
        result r = E_SUCCESS;
        ByteBuffer* pTempBitwisePrivilege = null;
 
-       SysLog(NID_SEC, "Enter.");
-
        pTempBitwisePrivilege = new (std::nothrow) ByteBuffer();
-       SysTryReturnResult(NID_SEC, pTempBitwisePrivilege != null, E_OUT_OF_MEMORY, "Memory allocation is failed.");
+       TryReturnResultTag(OSP_INSTALLER, pTempBitwisePrivilege != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
 
        r = pTempBitwisePrivilege->Construct(MAX_BITWISE_PRIV_SIZE);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        r = pTempBitwisePrivilege->SetArray(pBitwisePrivilege, 0, MAX_BITWISE_PRIV_SIZE);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
        pTempBitwisePrivilege->Flip();
 
        r = StringUtil::EncodeToBase64String(*pTempBitwisePrivilege, encryptedPrivileges);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        // fall through
 
@@ -355,7 +392,6 @@ CATCH:
 
        delete pTempBitwisePrivilege;
 
-       SysLog(NID_SEC, "Exit.");
        return r;
 }
 
@@ -371,7 +407,7 @@ PrivilegeHandler::GetChecksum(AppId appId, byte* pBitwisePrivilege, String& chec
        char* pAppId = null;
 
        pAppId = (char*) _StringConverter::CopyToCharArrayN(appId);
-       SysTryCatch(NID_SEC, pAppId != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, pAppId != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        memcpy(tempChecksumString, pAppId, MAX_APP_ID_SIZE);
        memcpy(tempChecksumString + MAX_APP_ID_SIZE, pBitwisePrivilege, MAX_BITWISE_PRIV_SIZE);
@@ -380,20 +416,20 @@ PrivilegeHandler::GetChecksum(AppId appId, byte* pBitwisePrivilege, String& chec
        pAppId = null;
 
        r = input.Construct(MAX_APP_ID_SIZE + MAX_BITWISE_PRIV_SIZE);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        r = input.SetArray(tempChecksumString, 0, MAX_APP_ID_SIZE + MAX_BITWISE_PRIV_SIZE);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
        input.Flip();
 
        pHash = new (std::nothrow) Sha1Hash();
-       SysTryCatch(NID_SEC, pHash != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
+       TryCatchTag(OSP_INSTALLER, pHash != null, r = E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation is failed.");
 
        pChecksumByteBuffer = pHash->GetHashN(input);
-       SysTryCatch(NID_SEC, pChecksumByteBuffer != null, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, pChecksumByteBuffer != null, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        r = StringUtil::EncodeToBase64String(*pChecksumByteBuffer, checksum);
-       SysTryCatch(NID_SEC, r == E_SUCCESS, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
+       TryCatchTag(OSP_INSTALLER, r == E_SUCCESS, r = E_SYSTEM, "[E_SYSTEM] An unexpected system error occurred.");
 
        // fall through
 
index 90373e6..fd68c18 100644 (file)
@@ -36,6 +36,8 @@ namespace Tizen { namespace Base
 class String;
 }}
 
+static const wchar_t EXTERNAL_PRIVILEGE_FILE_NAME[] = L"/usr/share/osp/.external-privilege.ini";
+
 /**
  * @class              PrivilegeHandler
  * @brief              This class represents the class of PrivilegeHandler.
@@ -48,13 +50,14 @@ class PrivilegeHandler
 {
 
 public:
-               static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum);
-               static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum);
+               static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
+               static result GenerateCipherPrivilege(const Tizen::App::AppId& appId, const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, Tizen::Base::String& encryptedPrivileges, Tizen::Base::String& checksum, Tizen::Base::Collection::IList& stringPrivilege);
 private:
                static byte* PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList);
                static result PackPrivilegeN(const Tizen::Base::Collection::IList& privilegeList, int visibilityLevel, byte** ppBitwisePrivilege);
                static result GetEncryptedBitwise(byte* __bitwisePrivilege, Tizen::Base::String& encryptedPrivileges);
                static result GetChecksum(Tizen::App::AppId appId, byte* __bitwisePrivilege, Tizen::Base::String& checksum);
+               static result PickExternalPrivilege(const Tizen::Base::Collection::IList& fullPrivilegeList, Tizen::Base::Collection::IList& normalPrivilegeList, Tizen::Base::Collection::IList& externalPrivilegeList);
 
 }; // PrivilegeHandler
 
index 17cc465..725cd20 100755 (executable)
@@ -20,6 +20,7 @@
  */
 
 #include "SignatureHandler.h"
+#include "InstallerUtil.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
@@ -65,16 +66,16 @@ SignatureHandler::Parse(const char *pFilepath)
 bool
 SignatureHandler::OnStartElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null.");
+       TryReturn(pName, true, "pName is null.");
 
        bool status = true;
 
        if (strcasecmp(pName, "Signature") == 0)
        {
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "signature.xml");
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "<%s>", pName);
+               AppLog("------------------------------------------");
+               AppLog("signature.xml");
+               AppLog("------------------------------------------");
+               AppLog("<%s>", pName);
                status = OnSignatureElement();
        }
 
@@ -89,13 +90,13 @@ SignatureHandler::OnStartElement(const char *pName)
 bool
 SignatureHandler::OnEndElement(const char *pName)
 {
-       TryReturn(pName, true, "[osp-installer] pName is null.");
+       TryReturn(pName, true, "pName is null.");
 
        if (strcasecmp(pName, "Signature") == 0)
        {
                __isDistributorSignature = false;
                __isAuthorSignature = false;
-               AppLogTag(OSP_INSTALLER, "</%s>", pName);
+               AppLog("</%s>", pName);
        }
 
        return true;
@@ -108,7 +109,7 @@ SignatureHandler::OnCharacters(const char *pCharacters)
        char *pName = 0;
 
        pName = GetElementName();
-       TryReturn(pName, false, "[osp-installer] pName is null.");
+       TryReturn(pName, false, "pName is null.");
 
        if (strcasecmp(pName, "X509Certificate") == 0)
        {
@@ -130,12 +131,12 @@ SignatureHandler::OnSignatureElement(void)
        char *pId = null;
 
        pAttr = GetAttribute();
-       TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+       TryReturn(pAttr, true, "pAttr is null");
 
        pId = pAttr->Find("Id");
        if (pId)
        {
-               AppLogTag(OSP_INSTALLER, "<Id = %s>", pId);
+               AppLog("<Id = %s>", pId);
 
                if (strcasecmp(pId, "AuthorSignature") == 0)
                {
@@ -153,7 +154,7 @@ SignatureHandler::OnSignatureElement(void)
 bool
 SignatureHandler::OnCertificateValue(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "<X509Certificate>%s</X509Certificate>", pCharacters);
+       AppLog("<X509Certificate>%s</X509Certificate>", pCharacters);
 
        result r = E_SUCCESS;
        bool res = true;
@@ -164,17 +165,17 @@ SignatureHandler::OnCertificateValue(const char *pCharacters)
                if (__pAuthorCertChain == null)
                {
                        __pAuthorCertChain = new (std::nothrow) ArrayList;
-                       TryCatch(__pAuthorCertChain, res = false, "[osp-installer] __pAuthorCertChain is null");
+                       TryCatch(__pAuthorCertChain, res = false, "__pAuthorCertChain is null");
                }
 
                pByteBuffer = new (std::nothrow) ByteBuffer;
-               TryCatch(pByteBuffer, res = false, "[osp-installer] pByteBuffer is null");
+               TryCatch(pByteBuffer, res = false, "pByteBuffer is null");
 
                int length = strlen(pCharacters);
                pByteBuffer->Construct(length);
 
                r = pByteBuffer->SetArray((byte*)pCharacters, 0, length);
-               TryCatch(!IsFailed(r), res = false, "[osp-installer] SetArray() is failed.");
+               TryCatch(!IsFailed(r), res = false, "SetArray() is failed.");
 
                pByteBuffer->Flip();
 
@@ -186,17 +187,17 @@ SignatureHandler::OnCertificateValue(const char *pCharacters)
                if (__pDistributorCertChain == null)
                {
                        __pDistributorCertChain = new (std::nothrow) ArrayList;
-                       TryCatch(__pDistributorCertChain, res = false, "[osp-installer] __pDistributorCertChain is null");
+                       TryCatch(__pDistributorCertChain, res = false, "__pDistributorCertChain is null");
                }
 
                pByteBuffer = new (std::nothrow) ByteBuffer;
-               TryCatch(pByteBuffer, res = false, "[osp-installer] pByteBuffer is null");
+               TryCatch(pByteBuffer, res = false, "pByteBuffer is null");
 
                int length = strlen(pCharacters);
                pByteBuffer->Construct(length);
 
                r = pByteBuffer->SetArray((byte*)pCharacters, 0, length);
-               TryCatch(!IsFailed(r), res = false, "[osp-installer] SetArray() is failed.");
+               TryCatch(!IsFailed(r), res = false, "SetArray() is failed.");
 
                pByteBuffer->Flip();
 
index 61e8ee1..b6d439e 100755 (executable)
@@ -51,11 +51,11 @@ XmlAttribute::Construct(const char *pName, const char *pValue)
        }
 
        __pName = new (std::nothrow) char[strlen(pName)+1];
-       TryReturn(__pName, false, "[osp-installer] __pName is null");
+       TryReturn(__pName, false, "__pName is null");
        strcpy(__pName, pName);
 
        __pValue = new (std::nothrow) char[strlen(pValue)+1];
-       TryReturn(__pValue, false, "[osp-installer] __pValue is null");
+       TryReturn(__pValue, false, "__pValue is null");
        strcpy(__pValue, pValue);
 
        return true;
@@ -107,7 +107,7 @@ XmlAttribute::Add(const char *pName, const char *pValue)
        else
        {
                __pNext = new (std::nothrow) XmlAttribute();
-               TryReturn(__pNext, false, "[osp-installer] __pNext is null");
+               TryReturn(__pNext, false, "__pNext is null");
 
                __pNext->Construct(pName, pValue);
        }
index d36ec2e..5d15ca3 100755 (executable)
@@ -57,28 +57,28 @@ XmlHandler::~XmlHandler(void)
 bool
 XmlHandler::OnStartDocument(void)
 {
-       AppLogTag(OSP_INSTALLER, "OnStartDocument()");
+       AppLog("OnStartDocument()");
        return true;
 }
 
 bool
 XmlHandler::OnEndDocument(void)
 {
-       AppLogTag(OSP_INSTALLER, "OnEndDocument()");
+       AppLog("OnEndDocument()");
        return true;
 }
 
 bool
 XmlHandler::OnStartElement(const char *pName)
 {
-       AppLogTag(OSP_INSTALLER, "OnStartElement()");
+       AppLog("OnStartElement()");
        return true;
 }
 
 bool
 XmlHandler::OnEndElement(const char *pName)
 {
-       AppLogTag(OSP_INSTALLER, "OnEndElement()");
+       AppLog("OnEndElement()");
 
        return true;
 }
@@ -86,7 +86,7 @@ XmlHandler::OnEndElement(const char *pName)
 bool
 XmlHandler::OnCharacters(const char *pCharacters)
 {
-       AppLogTag(OSP_INSTALLER, "OnCharacters()");
+       AppLog("OnCharacters()");
        return true;
 }
 
@@ -103,7 +103,7 @@ XmlHandler::StartElement(void *ctx, const xmlChar *name, const xmlChar **atts)
        }
 
        pHandler->SetElementName((const char *)name);
-       // AppLogTag(OSP_INSTALLER, "<%s>", (const char*)name);
+       // AppLog("<%s>", (const char*)name);
 
        if (atts)
        {
@@ -118,7 +118,7 @@ XmlHandler::StartElement(void *ctx, const xmlChar *name, const xmlChar **atts)
                        // log
                        //if (atts[0][0] && atts[1][0])
                        //{
-                               // AppLogTag(OSP_INSTALLER, "%s=\"%s\"", (const char*)atts[0], (const char*)atts[1]);
+                               // AppLog("%s=\"%s\"", (const char*)atts[0], (const char*)atts[1]);
                        //}
 
                        atts = &atts[2];
@@ -131,7 +131,7 @@ XmlHandler::StartElement(void *ctx, const xmlChar *name, const xmlChar **atts)
                        // log
                        //if (atts[0][0] && atts[1][0])
                        //{
-                               // AppLogTag(OSP_INSTALLER, "%s=\"%s\"", (const char*)atts[0], (const char*)atts[1]);
+                               // AppLog("%s=\"%s\"", (const char*)atts[0], (const char*)atts[1]);
                        //}
 
                        atts = &atts[2];
@@ -170,7 +170,7 @@ XmlHandler::EndElement(void *ctx, const xmlChar *name)
                pHandler->SetError();
        }
 
-       // AppLogTag(OSP_INSTALLER, "</%s>", name);
+       // AppLog("</%s>", name);
 
        pHandler->DeleteElement();
        pHandler->DeleteAttribute();
@@ -199,7 +199,7 @@ XmlHandler::Characters(void *ctx, const xmlChar *ch, int len)
 
        pHandler->SetCharacters(pCharacters);
 
-       // AppLogTag(OSP_INSTALLER, "%s", pCharacters);
+       // AppLog("%s", pCharacters);
        delete[] pCharacters;
 }
 
@@ -217,27 +217,27 @@ XmlHandler::ParseDocument(const char *pFilepath)
        int readSize = 0;
 
        r = file.Construct(pFilepath, L"r");
-       TryCatch(r == E_SUCCESS, ret = false, "[osp-installer] file.Construct is failed. [%s]", pFilepath);
+       TryCatch(r == E_SUCCESS, ret = false, "file.Construct is failed. [%s]", pFilepath);
 
        r = file.GetAttributes(pFilepath, attr);
-       TryCatch(IsFailed(r) == false, ret = false, "[osp-installer] file.GetAttributes is failed. [%s]", pFilepath);
+       TryCatch(IsFailed(r) == false, ret = false, "file.GetAttributes is failed. [%s]", pFilepath);
 
        size = (int)attr.GetFileSize();
-       TryCatch(size > 0, ret = false, "[osp-installer] size is invalid. [%s]", pFilepath);
+       TryCatch(size > 0, ret = false, "size is invalid. [%s]", pFilepath);
 
        pBuf = new (std::nothrow) char[size+1];
-       TryCatch(pBuf, ret = false, "[osp-installer] pBuf is null");
+       TryCatch(pBuf, ret = false, "pBuf is null");
 
        memset(pBuf, 0, size+1);
 
        readSize = file.Read(pBuf, size);
-       TryCatch(readSize > 0, ret = false, "[osp-installer] file.Read is failed. [%s][%d]", pFilepath, readSize);
+       TryCatch(readSize > 0, ret = false, "file.Read is failed. [%s][%d]", pFilepath, readSize);
 
        ctxt = xmlCreateMemoryParserCtxt(pBuf, size+1);
-       TryCatch(ctxt, ret = false, "[osp-installer] invalid xml file, %s", pFilepath);
+       TryCatch(ctxt, ret = false, "invalid xml file, %s", pFilepath);
 
        pSAXHandler = new (std::nothrow) xmlSAXHandler;
-       TryCatch(pSAXHandler, ret = false, "[osp-installer] pSAXHandler is null");
+       TryCatch(pSAXHandler, ret = false, "pSAXHandler is null");
        memset(pSAXHandler, 0, sizeof(xmlSAXHandler));
 
        ctxt->userData = (void *)this;
@@ -251,7 +251,7 @@ XmlHandler::ParseDocument(const char *pFilepath)
        xmlParseDocument(ctxt);
        xmlFreeParserCtxt(ctxt);
 
-       TryCatch(GetError() != true, ret = false, "[osp-installer] xml parsing error is occurred.");
+       TryCatch(GetError() != true, ret = false, "xml parsing error is occurred.");
 
 CATCH:
        delete[] pBuf;
@@ -275,34 +275,34 @@ XmlHandler::ParseNormalizedDocument(const char* pFilepath)
        int readSize = 0;
 
        r = file.Construct(pFilepath, L"r");
-       TryCatch(r == E_SUCCESS, ret = false, "[osp-installer] file.Construct is failed. [%s]", pFilepath);
+       TryCatch(r == E_SUCCESS, ret = false, "file.Construct is failed. [%s]", pFilepath);
 
        r = file.GetAttributes(pFilepath, attr);
-       TryCatch(IsFailed(r) == false, ret = false, "[osp-installer] file.GetAttributes is failed. [%s]", pFilepath);
+       TryCatch(IsFailed(r) == false, ret = false, "file.GetAttributes is failed. [%s]", pFilepath);
 
        size = (int)attr.GetFileSize();
-       TryCatch(size > 0, ret = false, "[osp-installer] size is invalid. [%s]", pFilepath);
+       TryCatch(size > 0, ret = false, "size is invalid. [%s]", pFilepath);
 
        pBuf = new (std::nothrow) char[size+1];
-       TryCatch(pBuf, ret = false, "[osp-installer] pBuf is null");
+       TryCatch(pBuf, ret = false, "pBuf is null");
 
        pNormalizedBuf = new (std::nothrow) char[size+1];
-       TryCatch(pNormalizedBuf, ret = false, "[osp-installer] pNormalizedBuf is null");
+       TryCatch(pNormalizedBuf, ret = false, "pNormalizedBuf is null");
 
        memset(pBuf, 0, size+1);
        memset(pNormalizedBuf, 0, size+1);
 
        readSize = file.Read(pBuf, size);
-       TryCatch(readSize > 0, ret = false, "[osp-installer] file.Read is failed. [%s][%d]", pFilepath, readSize);
+       TryCatch(readSize > 0, ret = false, "file.Read is failed. [%s][%d]", pFilepath, readSize);
 
        normalizedSize = Normalize(pBuf, size, pNormalizedBuf);
-       TryCatch(normalizedSize > 0, ret = false, "[osp-installer] normalizedSize [%d]", readSize);
+       TryCatch(normalizedSize > 0, ret = false, "normalizedSize [%d]", readSize);
 
        ctxt = xmlCreateMemoryParserCtxt(pNormalizedBuf, normalizedSize);
-       TryCatch(ctxt, ret = false, "[osp-installer] invalid xml file, %s", pFilepath);
+       TryCatch(ctxt, ret = false, "invalid xml file, %s", pFilepath);
 
        pSAXHandler = new (std::nothrow) xmlSAXHandler;
-       TryCatch(pSAXHandler, ret = false, "[osp-installer] pSAXHandler is null");
+       TryCatch(pSAXHandler, ret = false, "pSAXHandler is null");
        memset(pSAXHandler, 0, sizeof(xmlSAXHandler));
 
        ctxt->userData = (void *)this;
@@ -316,7 +316,7 @@ XmlHandler::ParseNormalizedDocument(const char* pFilepath)
        xmlParseDocument(ctxt);
        xmlFreeParserCtxt(ctxt);
 
-       TryCatch(GetError() != true, ret = false, "[osp-installer] xml parsing error is occurred.");
+       TryCatch(GetError() != true, ret = false, "xml parsing error is occurred.");
 
 CATCH:
        delete[] pBuf;
@@ -344,7 +344,7 @@ XmlHandler::Normalize(const char* pBuf, int size, char* pNormalizedBuf)
                }
                else if((pBuf[idx] == 0X0A) && (pBuf[idx + 1] == 0x4d) && (pBuf[idx - 1] == 0x3E))
                {
-                       //AppLogTag(OSP_INSTALLER, "[pBuf = %s]", pBuf);
+                       //AppLog("[pBuf = %s]", pBuf);
                        idx++;
                        pNormalizedBuf[normalizedIdx] = pBuf[idx];
                        normalizedIdx++;
@@ -364,7 +364,7 @@ XmlHandler::Normalize(const char* pBuf, int size, char* pNormalizedBuf)
 bool
 XmlHandler::SetElementName(const char *pElementName)
 {
-       TryReturn(pElementName, false, "[osp-installer] pElementName is null");
+       TryReturn(pElementName, false, "pElementName is null");
 
        if (__pElementName)
        {
@@ -373,7 +373,7 @@ XmlHandler::SetElementName(const char *pElementName)
        }
 
        __pElementName = new (std::nothrow) char[strlen(pElementName)+1];
-       TryReturn(__pElementName, false, "[osp-installer] __pElementName is null");
+       TryReturn(__pElementName, false, "__pElementName is null");
        strcpy(__pElementName, pElementName);
 
        __elementStack.Push(*new (std::nothrow) String(pElementName));
@@ -399,12 +399,12 @@ XmlHandler::DeleteElement(void)
 bool
 XmlHandler::SetCharacters(const char* pCharacter)
 {
-       TryReturn(pCharacter, false, "[osp-installer] pCharacter is null");
+       TryReturn(pCharacter, false, "pCharacter is null");
 
        if (__pCharacters == null)
        {
                __pCharacters = new (std::nothrow) char[4096];
-               TryReturn(__pCharacters, false, "[osp-installer] __pCharacters is null");
+               TryReturn(__pCharacters, false, "__pCharacters is null");
 
                memset(__pCharacters, 0, 4096);
        }
index 0cf3512..a534f6f 100755 (executable)
@@ -51,27 +51,27 @@ XmlWriter::~XmlWriter(void)
        err = xmlTextWriterEndDocument(__pXmlWriter);
        if (err == -1)
        {
-               AppLogTag(OSP_INSTALLER, "xmlTextWriterEndDocument() is failed(%d)", err);
+               AppLog("xmlTextWriterEndDocument() is failed(%d)", err);
        }
 
        File file;
        r = file.Construct(__xmlFilePath, "w");
        if (IsFailed(r))
        {
-               AppLogTag(OSP_INSTALLER, "file.Construct() failed, __xmlFilePath=[%ls]", __xmlFilePath.GetPointer());
+               AppLog("file.Construct() failed, __xmlFilePath=[%ls]", __xmlFilePath.GetPointer());
        }
        else
        {
                r = file.Write((char *)__pXmlBuffer->content, __pXmlBuffer->use);
                if (IsFailed(r))
                {
-                       AppLogTag(OSP_INSTALLER, "file.Write() failed, __xmlFilePath=[%ls]", __xmlFilePath.GetPointer());
+                       AppLog("file.Write() failed, __xmlFilePath=[%ls]", __xmlFilePath.GetPointer());
                }
 
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               AppLogTag(OSP_INSTALLER, "%ls is generated", __xmlFilePath.GetPointer());
-               AppLogTag(OSP_INSTALLER, "------------------------------------------");
-               // AppLogTag(OSP_INSTALLER, "%s", __pXmlBuffer->content);
+               AppLog("------------------------------------------");
+               AppLog("%ls is generated", __xmlFilePath.GetPointer());
+               AppLog("------------------------------------------");
+               // AppLog("%s", __pXmlBuffer->content);
                // InstallerUtil::DumpLog((const char*)__pXmlBuffer->content);
        }
 
@@ -94,17 +94,17 @@ XmlWriter::Construct(const Tizen::Base::String& filepath)
 
        // __pXmlBuffer = xmlBufferCreate();
        __pXmlBuffer = xmlBufferCreateSize(4096*10);
-       TryCatch(__pXmlBuffer, res = false, "[osp-installer] __pXmlBuffer is null");
+       TryCatch(__pXmlBuffer, res = false, "__pXmlBuffer is null");
 
        __xmlFilePath = filepath;
 
        __pXmlWriter = xmlNewTextWriterMemory(__pXmlBuffer, 0);
-       TryCatch(__pXmlWriter, res = false, "[osp-installer] __pXmlWriter is null");
+       TryCatch(__pXmlWriter, res = false, "__pXmlWriter is null");
 
        xmlTextWriterSetIndent(__pXmlWriter, 1);
 
        err = xmlTextWriterStartDocument(__pXmlWriter, null, null, null);
-       TryCatch(err == 0, res = false, "[osp-installer] err is %d", err);
+       TryCatch(err == 0, res = false, "err is %d", err);
 
        return true;
 CATCH:
index ad38402..ece1f6a 100755 (executable)
 #include "InstallerUtil.h"
 
 using namespace Tizen::Base;
+using namespace Tizen::App;
 
 extern "C" void Osp_Initialize();
-static bool __osp_installer_report_result(const String& appId, int errorType);
+static bool __osp_installer_report_result(const Tizen::App::PackageId& packageId, int errorType);
 
 static pkgmgr_installer *_pi = null;
 
@@ -47,28 +48,39 @@ main(int argc, char **argv)
        const char *pkg_info = NULL;
        char* pkg_path = NULL;
        String path;
-       String appId;
+       PackageId packageId;
        int errorType = 0;
-       InstallerManager manager;
        pkgmgr_installer *pi = null;
        int req_type = 0;
 
        Osp_Initialize();
 
-       AppLogTag(OSP_INSTALLER, "--\n\n\n");
-       AppLogTag(OSP_INSTALLER, "==========================================");
-       AppLogTag(OSP_INSTALLER, " # %s", OSP_INSTALLER_VERSION);
-       AppLogTag(OSP_INSTALLER, " # argc = %d", argc);
+       char buf[1024];
+       memset(buf, 0, sizeof(buf));
+       for (int i = 0; i < argc; i++)
+       {
+               strcat(buf, argv[i]);
+               if (i != argc - 1)
+               {
+                       strcat(buf, " ");
+               }
+       }
+
+       int emul = 0;
+
+#ifdef _OSP_EMUL_
+       emul = 1;
+#endif
+       fprintf(stderr, "  ## osp-installer: %s[%s] cmd=[%s]\n", OSP_INSTALLER_VERSION, emul?"Emulator":"Target", buf);
 
        if (argc == TEST_ARG_COUNT)
        {
-               errorType = manager.ReqeustByTest();
-               manager.PrintResult();
+               errorType = InstallerManager::ReqeustByTest();
                goto CATCH;
        }
        else if (argc == COMMAND_ARG_COUNT)
        {
-               errorType = manager.RequestByCommand(argc, argv);
+               errorType = InstallerManager::RequestByCommand(argc, argv);
                goto CATCH;
        }
 
@@ -85,7 +97,7 @@ main(int argc, char **argv)
 
        pkg_info = pkgmgr_installer_get_request_info(pi);
        pkg_path = (const_cast<char*>(pkg_info));
-       AppLogTag(OSP_INSTALLER, " # path = [%s]", pkg_path);
+       AppLog(" # path = [%s]", pkg_path);
 
        path = pkg_path;
 
@@ -93,17 +105,22 @@ main(int argc, char **argv)
        {
        case PKGMGR_REQ_INSTALL:
                {
-                       errorType = manager.Request(path, INSTALLER_OPERATION_INSTALL, REQUESTER_TYPE_NORMAL);
-                       appId = manager.GetId();
+                       errorType = InstallerManager::Request(path, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_NORMAL, packageId);
                        if (_pi != 0)
                        {
                                char resultBuf[128] = {0};
-                               snprintf(resultBuf, sizeof(resultBuf), "%ls", appId.GetPointer());
+                               snprintf(resultBuf, sizeof(resultBuf), "%ls", packageId.GetPointer());
                                pkgmgr_installer_send_signal(_pi, "tpk", resultBuf, "start", "install");
+
+                               // temp
+                               pkgmgr_installer_send_signal(_pi, "tpk", resultBuf, "install_percent", "0");
+                               usleep(50000);
+                               pkgmgr_installer_send_signal(_pi, "tpk", resultBuf, "install_percent", "30");
+                               usleep(50000);
                        }
                        else
                        {
-                               AppLogTag(OSP_INSTALLER, "_pi is null");
+                               AppLog("_pi is null");
                        }
 
 //                     if (errorType != 0)
@@ -111,42 +128,31 @@ main(int argc, char **argv)
 //                             manager.RemoveGarbage(path);
 //                     }
 
-                       __osp_installer_report_result(appId, errorType);
-                       manager.PrintResult();
+                       __osp_installer_report_result(packageId, errorType);
                }
                break;
 
        case PKGMGR_REQ_UNINSTALL:
                {
-                       String requestAppId;
+                       PackageId reqeustPackageId;
 
-                       if (path.Contains(PACKAGE_NAME_PREFIX_ORG) == true)
-                       {
-                               String prefixPackage(PACKAGE_NAME_PREFIX_ORG);
-                               path.SubString(prefixPackage.GetLength(), APPID_LENGTH, requestAppId);
-                       }
-                       else
-                       {
-                               path.SubString(0, APPID_LENGTH, requestAppId);
-                       }
+                       path.SubString(0, PACKAGE_ID_LENGTH, reqeustPackageId);
 
-                       AppLogTag(OSP_INSTALLER, "requestAppId = %ls", requestAppId.GetPointer());
-                       ret = manager.Request(requestAppId, INSTALLER_OPERATION_UNINSTALL, REQUESTER_TYPE_NORMAL);
-                       appId = manager.GetId();
+                       AppLog("reqeustPackageId = %ls", reqeustPackageId.GetPointer());
+                       ret = InstallerManager::Request(reqeustPackageId, INSTALLER_OPERATION_UNINSTALL, INSTALLER_OPTION_NORMAL, packageId);
 
                        if (_pi != 0)
                        {
                                char resultBuf[128] = {0};
-                               snprintf(resultBuf, sizeof(resultBuf), "%ls", appId.GetPointer());
+                               snprintf(resultBuf, sizeof(resultBuf), "%ls", packageId.GetPointer());
                                pkgmgr_installer_send_signal(_pi, "tpk", resultBuf, "start", "uninstall");
                        }
                        else
                        {
-                               AppLogTag(OSP_INSTALLER, "_pi is null");
+                               AppLog("_pi is null");
                        }
 
-                       __osp_installer_report_result(appId, errorType);
-                       manager.PrintResult();
+                       __osp_installer_report_result(packageId, errorType);
                }
                break;
 
@@ -157,13 +163,12 @@ main(int argc, char **argv)
                                int moveType = -1;
                                moveType = pkgmgr_installer_get_move_type(_pi);
 
-                               manager.RequestMove(path, moveType);
+                               InstallerManager::RequestMove(path, moveType);
                        }
                        else
                        {
                                AppLog("_pi is null");
                        }
-
                }
                break;
 
@@ -178,6 +183,7 @@ main(int argc, char **argv)
        }
 
 CATCH:
+
        return errorType;
 }
 
@@ -191,6 +197,10 @@ __osp_installer_send_error(int errorType)
        {
                error = INSTALLER_ERROR_FATAL_ERROR;
        }
+       else
+       {
+               error = errorType;
+       }
 
        snprintf(errorMsg, sizeof(errorMsg) - 1, "%d", error);
        pkgmgr_installer_send_signal(_pi, "tpk", "", "error", errorMsg);
@@ -199,7 +209,7 @@ __osp_installer_send_error(int errorType)
 }
 
 bool
-__osp_installer_report_result(const String& appId, int errorType)
+__osp_installer_report_result(const PackageId& packageId, int errorType)
 {
        int ret = 0;
        char resultBuf[128] = {0};
@@ -208,48 +218,49 @@ __osp_installer_report_result(const String& appId, int errorType)
        const char* pKey = "end";
        const char* pValue = null;
 
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "osp_installer_report_result");
-       AppLogTag(OSP_INSTALLER, " # request_type = [%d]", pkgmgr_installer_get_request_type(_pi));
-       AppLogTag(OSP_INSTALLER, " # request_info = [%s]", pkgmgr_installer_get_request_info(_pi));
-       AppLogTag(OSP_INSTALLER, " # session_id = [%s]", pkgmgr_installer_get_session_id(_pi));
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
+       AppLog("osp_installer_report_result");
+       AppLog(" # request_type = [%d]", pkgmgr_installer_get_request_type(_pi));
+       AppLog(" # request_info = [%s]", pkgmgr_installer_get_request_info(_pi));
+       AppLog(" # session_id = [%s]", pkgmgr_installer_get_session_id(_pi));
+       AppLog("------------------------------------------");
 
        if (_pi == 0)
        {
-               AppLogTag(OSP_INSTALLER, "_pi is null");
+               AppLog("_pi is null");
                return false;
        }
 
        if (errorType == 0)
        {
-               if (appId.IsEmpty() == true)
-               {
-                       snprintf(resultBuf, sizeof(resultBuf), "0000000000");
-               }
-               else
-               {
-                       snprintf(resultBuf, sizeof(resultBuf), "%ls", appId.GetPointer());
-               }
-
                pValue = "ok";
        }
        else
        {
-               snprintf(resultBuf, sizeof(resultBuf), "0000000000");
                pValue = "fail";
                __osp_installer_send_error(errorType);
        }
 
+       if (packageId.IsEmpty() == false)
+       {
+               snprintf(resultBuf, sizeof(resultBuf), "%ls", packageId.GetPointer());
+       }
+
+       // temp
+       pkgmgr_installer_send_signal(_pi, pPkgType, resultBuf, "install_percent", "65");
+       usleep(50000);
+       pkgmgr_installer_send_signal(_pi, pPkgType, resultBuf, "install_percent", "100");
+       usleep(50000);
+
        ret = pkgmgr_installer_send_signal(_pi, pPkgType, resultBuf, pKey, pValue);
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
-       AppLogTag(OSP_INSTALLER, "pkgmgr_installer_send_signal");
-       AppLogTag(OSP_INSTALLER, " # type   = [%s]", pPkgType);
-       AppLogTag(OSP_INSTALLER, " # pkg id = [%s]", resultBuf);
-       AppLogTag(OSP_INSTALLER, " # key    = [%s]", pKey);
-       AppLogTag(OSP_INSTALLER, " # val    = [%s]", pValue);
-       AppLogTag(OSP_INSTALLER, " # ret    = [%s]", (ret == 0)?"success":"failure");
-       AppLogTag(OSP_INSTALLER, "------------------------------------------");
+       AppLog("------------------------------------------");
+       AppLog("pkgmgr_installer_send_signal");
+       AppLog(" # type   = [%s]", pPkgType);
+       AppLog(" # pkg id = [%s]", resultBuf);
+       AppLog(" # key    = [%s]", pKey);
+       AppLog(" # val    = [%s]", pValue);
+       AppLog(" # ret    = [%s]", (ret == 0)?"success":"failure");
+       AppLog("------------------------------------------");
 
        pkgmgr_installer_free(_pi);
        _pi = null;