-std::string JobWidgetInstall::generateTizenId() {
- std::string allowed("0123456789"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz");
- std::string tizenId;
- tizenId.resize(MAX_TIZENID_LENGTH);
- for (int i = 0; i < MAX_TIZENID_LENGTH; ++i) {
- tizenId[i] = allowed[rand() % allowed.length()];
+ConfigureResult JobWidgetInstall::PrePareInstallation(
+ const std::string &widgetPath)
+{
+ ConfigureResult result;
+ m_needEncryption = false;
+
+ Try
+ {
+ std::string tempDir;
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ std::ostringstream tempPathBuilder;
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << widgetPath;
+ tempDir = tempPathBuilder.str();;
+ } else {
+ tempDir =
+ Jobs::WidgetInstall::createTempPath(
+ m_jobStruct.m_installMode ==
+ InstallMode::INSTALL_MODE_PRELOAD);
+ }
+
+ m_isDRM = isDRMWidget(widgetPath);
+ if (true == m_isDRM) {
+ LogDebug("decrypt DRM widget");
+ if (DecryptDRMWidget(widgetPath, tempDir)) {
+ LogDebug("Failed decrypt DRM widget");
+ return ConfigureResult::Failed_DrmError;
+ }
+ }
+
+ LogDebug("widgetPath:" << widgetPath);
+
+ m_installerContext.widgetConfig.packagingType =
+ checkPackageType(widgetPath, tempDir);
+ ConfigParserData configData = getWidgetDataFromXML(
+ widgetPath,
+ tempDir,
+ m_installerContext.widgetConfig.packagingType,
+ m_isDRM,
+ m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY);
+ LogDebug("widget packaging type : " <<
+ m_installerContext.widgetConfig.packagingType.pkgType);
+
+ setTizenId(configData);
+ setApplicationType(configData);
+ m_needEncryption = detectResourceEncryption(configData);
+ setInstallLocationType(configData);
+
+ // Configure installation
+ result = ConfigureInstallation(widgetPath, configData, tempDir);
+ }
+ Catch(Exceptions::ExtractFileFailed)
+ {
+ LogError("Failed to create temporary path for widget");
+ result = ConfigureResult::Failed_InvalidConfig;