apiVersion = pContext->__apiVersion;
String versionInfoFile;
versionInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), VERSION_INFO_FILE);
- CreateInfoFile(versionInfoFile, &apiVersion);
+ InstallerUtil::CreateInfoFile(versionInfoFile, &apiVersion);
if (pContext->__isOspCompat == true)
{
String compatInfoFile;
compatInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), COMPAT_INFO_FILE);
- CreateInfoFile(compatInfoFile, null);
+ InstallerUtil::CreateInfoFile(compatInfoFile, null);
}
String webServicePrivilege(TIZEN_PRIVILEGE_WEB_SERVICE);
String webServiceInfoFile;
webServiceInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), WEBSERVICE_INFO_FILE);
- CreateInfoFile(webServiceInfoFile, null);
+ InstallerUtil::CreateInfoFile(webServiceInfoFile, null);
}
IListT<AppData*>* pAppDataList = pContext->__pAppDataList;
String uiScalabilityInfoFile;
uiScalabilityInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), UISCALABILITY_INFO_FILE);
- CreateInfoFile(uiScalabilityInfoFile, &uiScalability);
+ InstallerUtil::CreateInfoFile(uiScalabilityInfoFile, &uiScalability);
int categoryType = pAppData->__feature;
if (categoryType != CATEGORY_TYPE_NONE)
String typeInfoFile;
typeInfoFile.Format(1024, L"%ls%ls", rootPath.GetPointer(), TYPE_INFO_FILE);
- CreateInfoFile(typeInfoFile, &typeInfo);
+ InstallerUtil::CreateInfoFile(typeInfoFile, &typeInfo);
}
}
else if (appType == L"ServiceApp")
InstallerUtil::Remove(pXmlPath.get());
}
-// _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;
}
bool
-ConfigurationManager::RegisterCertInfo(InstallationContext* pContext) const
-{
- 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->__packageId;
- X509CertificatePath* pAuthorCertPath = pContext->GetAuthorCertPath();
- X509CertificatePath* pDistributorCertPath = pContext->GetDistributorCertPath();
-
- char* pAppId = _StringConverter::CopyToCharArrayN(appId);
- TryCatch(pAppId, result = false, "pAppId is null");
-
- res = pkgmgr_installer_create_certinfo_set_handle(&handle);
- TryCatch(res == 0, result = false, "pkgmgr_installer_create_certinfo_set_handle() failed.[%d]", res);
-
- if (pAuthorCertPath)
- {
- AppLog("[AuthorCert]");
- result = SetCertHashValue(handle, pAuthorCertPath, PM_SET_AUTHOR_SIGNER_CERT);
- TryCatch(result == true, , "RegisterCertHashValue() failed. [pAuthorCertPath]");
- }
-
- if (pDistributorCertPath)
- {
- AppLog("[DistributorCert]");
- result = SetCertHashValue(handle, pDistributorCertPath, PM_SET_DISTRIBUTOR_SIGNER_CERT);
- TryCatch(result == true, , "RegisterCertHashValue() failed. [pDistributorCertPath]");
- }
-
- res = pkgmgr_installer_save_certinfo(pAppId, handle);
- TryCatch(res == 0, result = false, "pkgmgr_installer_save_certinfo(%s) failed.[%d]", pAppId, res);
-
- AppLog("RegisterCertInfo - END");
- AppLog("------------------------------------------");
-
-CATCH:
- if (handle)
- {
- pkgmgr_installer_destroy_certinfo_set_handle(handle);
- }
-
- delete[] pAppId;
- return result;
-}
-
-bool
-ConfigurationManager::SetCertHashValue(void* pHandle, X509CertificatePath* pCertPath, int certType) const
-{
- TryReturn(pCertPath, false, "pCertPath is null.");
-
- int res = 0;
- bool result = true;
- ICertificate* pCert = null;
- char* pCertValue = null;
-
- for (int i = 0; i < pCertPath->GetLength(); i++)
- {
- pCert = pCertPath->GetCertificateN(i);
- TryCatch(pCert, result = false, "pCert is null.[%i]", i);
-
- pCertValue = GetCertValueN(pCert);
- TryCatch(pCertValue, result = false, "pCertValue is null.[%i]", i);
-
- 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, "pkgmgr_installer_set_cert_value(%d) failed.[%d]", i, res);
-
- delete pCert;
- pCert = null;
- delete[] pCertValue;
- pCertValue = null;
-
- certType--;
- }
-
-CATCH:
- delete pCert;
- delete[] pCertValue;
-
- return result;
-}
-
-char*
-ConfigurationManager::GetCertValueN(ICertificate* pCert) const
-{
- result r = E_SUCCESS;
- ByteBuffer* pEncodedData = null;
- String base64Value;
- char* pEncodedValue = null;
-
- pEncodedData = pCert->GetEncodedDataN();
- TryCatch(pEncodedData, , "pEncodedData is null.");
-
- r = StringUtil::EncodeToBase64String(*pEncodedData, base64Value);
- TryCatch(!IsFailed(r), , "StringUtil::EncodeToBase64String is failed.");
-
- pEncodedValue = _StringConverter::CopyToCharArrayN(base64Value);
- TryCatch(pEncodedValue, , "pEncodedValue is null");
-
-CATCH:
- delete pEncodedData;
-
- return pEncodedValue;
-}
-
-bool
-ConfigurationManager::UnregisterCertInfo(InstallationContext* pContext) const
-{
- if (pContext->__isHybridService == true)
- {
- AppLog("Skip - HybridService");
- return true;
- }
-
- AppLog("START");
- int res = 0;
- bool result = true;
- String appId = pContext->__packageId;
-
- char* pAppId = _StringConverter::CopyToCharArrayN(appId);
- TryCatch(pAppId, result = false, "pAppId is null");
-
- res = pkgmgr_installer_delete_certinfo(pAppId);
- TryCatch(res == 0, result = false, "pkgmgr_installer_delete_certinfo(%s) failed.[%d]", pAppId, res);
-
- AppLog("UnregisterCertInfo - END");
- AppLog("------------------------------------------");
-
-CATCH:
- delete[] pAppId;
- return result;
-}
-
-bool
ConfigurationManager::PostInstall(InstallationContext* pContext, bool error) const
{
app2ext_handle* pHandle = (app2ext_handle*)pContext->__pApp2ExtHandle;
SmackManager smackManager;
smackManager.Construct(pContext);
- smackManager.AddPermissions(packageId);
+ smackManager.EnablePermissions(packageId);
}
if (pHandle)
// InstallerUtil::Remove(desktopPath);
// }
//
-// CreateInfoFile(desktopPath, &desktop);
+// InstallerUtil::CreateInfoFile(desktopPath, &desktop);
// }
// }
//
File systemXml;
r = systemXml.Construct(systemXmlPath, L"w");
- TryReturn(!IsFailed(r), false, "systemXmlPath.Construct is failed");
+ TryReturn(!IsFailed(r), false, "systemXmlPath.Construct() is failed.");
- systemXml.Write(pMergedBuf.get(), fileSize);
+ r = systemXml.Write(pMergedBuf.get(), fileSize);
+ TryReturn(!IsFailed(r), false, "systemXmlPath.Write() is failed.");
AppLog("pMergedBuf.get()=0x%0x, length=%d", (unsigned int)pMergedBuf.get(), fileSize);
InstallerUtil::DumpLogData(pMergedBuf.get(), fileSize);
}
bool
-ConfigurationManager::CreateInfoFile(const String& filePath, const String* pContext)
-{
- result r = E_SUCCESS;
- File file;
-
- r = file.Construct(filePath, "w");
- TryReturn(!IsFailed(r), false, "file.Construct() failed, filePath=[%ls]", filePath.GetPointer());
-
- AppLog("------------------------------------------");
- AppLog("CreateInfoFile(), filePath = [%ls]", filePath.GetPointer());
-
- if (pContext)
- {
- r = file.Write(*pContext);
- TryReturn(!IsFailed(r), false, "file.Write() failed, filePath=[%ls]", filePath.GetPointer());
- AppLog("string = [%ls]", pContext->GetPointer());
- }
- AppLog("------------------------------------------");
-
- return true;
-}
-
-bool
ConfigurationManager::CreateImeSymlink(const String& binaryPath, const String& appId)
{
bool res = true;