From c68b6666446158924960f81dc33e9c8682ae550a Mon Sep 17 00:00:00 2001 From: Duyoung Jang Date: Wed, 17 Apr 2013 14:15:09 +0900 Subject: [PATCH] OptionalData is added for installation Change-Id: I6407b50b534105e6c7e5864d25445376857bbea5 Signed-off-by: Duyoung Jang --- inc/InstallerDefs.h | 2 +- src/Context/InstallationContext.h | 1 + src/Manager/InstallerManager.cpp | 26 ++++++++++++++++++++------ src/Manager/InstallerManager.h | 4 ++-- src/Manager/SmackManager.cpp | 2 +- src/backend/backend.cpp | 10 ++++++---- 6 files changed, 31 insertions(+), 14 deletions(-) diff --git a/inc/InstallerDefs.h b/inc/InstallerDefs.h index 896d099..f799a26 100755 --- a/inc/InstallerDefs.h +++ b/inc/InstallerDefs.h @@ -23,7 +23,7 @@ #include "InstallerUtil.h" -#define OSP_INSTALLER_VERSION "version=[20130416.2]" +#define OSP_INSTALLER_VERSION "version=[20130417.1]" #define DIR_BIN L"/bin" #define DIR_INFO L"/info" diff --git a/src/Context/InstallationContext.h b/src/Context/InstallationContext.h index e6aadef..ba1308a 100755 --- a/src/Context/InstallationContext.h +++ b/src/Context/InstallationContext.h @@ -136,6 +136,7 @@ public: Tizen::Base::String __author; Tizen::Base::String __url; Tizen::Base::String __description; + Tizen::App::AppId __storeClientId; int __certType; void* __pPkgmgrInstaller; diff --git a/src/Manager/InstallerManager.cpp b/src/Manager/InstallerManager.cpp index d233b2f..cf4fdac 100755 --- a/src/Manager/InstallerManager.cpp +++ b/src/Manager/InstallerManager.cpp @@ -84,7 +84,7 @@ InstallerManager::GetInstance() } InstallerError -InstallerManager::Construct(const String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const PackageId* pPackageId) +InstallerManager::Construct(const String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const String* pOptionalData) { InstallerError error = INSTALLER_ERROR_NONE; InstallerType installerType = INSTALLER_TYPE_INSTALLER; @@ -154,10 +154,24 @@ InstallerManager::Construct(const String& path, InstallerOperation operation, In __pContext->__packagePath = newPath; } - if (pPackageId) + if (pOptionalData) { - AppLog(" # packageId = [%ls]", pPackageId->GetPointer()); - __pContext->__packageId = (*pPackageId); + PackageId packageId; + pOptionalData->SubString(0, PACKAGE_ID_LENGTH, packageId); + __pContext->__packageId = packageId; + AppLog(" # packageId = [%ls]", packageId.GetPointer()); + + // format -> pOptionalData = "abcde12345:StoreClientId=12345abcde.TizenStore" + int indexOf = 0; + String storeClientId; + String tokenDelimiter(":StoreClientId="); + r = pOptionalData->IndexOf(tokenDelimiter, 0, indexOf); + if (!IsFailed(r)) + { + pOptionalData->SubString(indexOf + tokenDelimiter.GetLength(), storeClientId); + __pContext->__storeClientId = storeClientId; + AppLog(" # storeClientId = [%ls]", storeClientId.GetPointer()); + } SendEvent(__pContext, __pContext->__packageId, "start", "install"); } @@ -785,7 +799,7 @@ InstallerManager::SendEvent(InstallationContext* pContext, const PackageId& pack } int -InstallerManager::Request(const String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const PackageId* pPackageId) +InstallerManager::Request(const String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const String* pOptionalData) { InstallerError errorType = INSTALLER_ERROR_NONE; InstallerManager* pInstallManager = null; @@ -797,7 +811,7 @@ InstallerManager::Request(const String& path, InstallerOperation operation, Inst pInstallManager = InstallerManager::GetInstance(); TryCatch(pInstallManager, errorType = INSTALLER_ERROR_INTERNAL_STATE, "pInstallManager is null."); - errorType = pInstallManager->Construct(path, operation, option, pPkgmgrInstaller, pPackageId); + errorType = pInstallManager->Construct(path, operation, option, pPkgmgrInstaller, pOptionalData); TryCatch(errorType == INSTALLER_ERROR_NONE, , "pInstallManager->Construct() failed."); errorType = pInstallManager->Activate(); diff --git a/src/Manager/InstallerManager.h b/src/Manager/InstallerManager.h index 694ddb7..8540052 100755 --- a/src/Manager/InstallerManager.h +++ b/src/Manager/InstallerManager.h @@ -38,7 +38,7 @@ class InstallerManager { public: InstallerManager(void); - InstallerError Construct(const Tizen::Base::String& path, InstallerOperation op, InstallerOption option, void* pPkgmgrInstaller, const Tizen::App::PackageId* pPackageId = null); + InstallerError Construct(const Tizen::Base::String& path, InstallerOperation op, InstallerOption option, void* pPkgmgrInstaller, const Tizen::Base::String* pOptionalData = null); virtual ~InstallerManager(void); static InstallerManager* GetInstance(void); @@ -60,7 +60,7 @@ public: static bool SendEvent(InstallationContext* pContext, const Tizen::App::PackageId& packageId, const Tizen::Base::String& key, const Tizen::Base::String& val); - static int Request(const Tizen::Base::String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const Tizen::App::PackageId* pPackageId = null); + static int Request(const Tizen::Base::String& path, InstallerOperation operation, InstallerOption option, void* pPkgmgrInstaller, const Tizen::Base::String* pOptionalData = null); static int RequestRecursiveDirectory(const Tizen::Base::String& path, int& errorType); static int RequestByCommand(int argc, char **argv); static int ReqeustByTest(void); diff --git a/src/Manager/SmackManager.cpp b/src/Manager/SmackManager.cpp index 3923dbf..f627e67 100755 --- a/src/Manager/SmackManager.cpp +++ b/src/Manager/SmackManager.cpp @@ -175,7 +175,7 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat } else if (dirPath.Contains(L"shared/res") == true) { - label = L"*"; + label = L"_"; //label.Append("_sharedres"); } else if (dirPath.Contains(L"shared/trusted") == true) diff --git a/src/backend/backend.cpp b/src/backend/backend.cpp index dc9bb96..c9c71a6 100755 --- a/src/backend/backend.cpp +++ b/src/backend/backend.cpp @@ -51,6 +51,7 @@ main(int argc, char **argv) char* pkg_path = null; const char* pOptional = null; String path; + String optionalData; PackageId packageId; int errorType = 0; pkgmgr_installer *pi = null; @@ -115,8 +116,8 @@ main(int argc, char **argv) pOptional = pkgmgr_installer_get_optional_data(pi); if (pOptional) { - packageId = pOptional; - AppLog(" # optional = [%s]", pOptional); + optionalData = pOptional; + AppLog(" # optional = [%ls]", optionalData.GetPointer()); } else { @@ -147,10 +148,11 @@ main(int argc, char **argv) } } - AppLog(" # path = [%ls] -> packageId = [%ls]", path.GetPointer(), packageId.GetPointer()); + optionalData = packageId; + AppLog(" # path = [%ls] -> optionalData = [%ls]", path.GetPointer(), optionalData.GetPointer()); } - errorType = InstallerManager::Request(path, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_NORMAL, pi, &packageId); + errorType = InstallerManager::Request(path, INSTALLER_OPERATION_INSTALL, INSTALLER_OPTION_NORMAL, pi, &optionalData); // if (errorType != 0) // { -- 2.7.4