#include <libiriwrapper.h>
#include <pkg-manager/pkgmgr_signal.h>
#include <app_manager.h>
-//#include <drm_client.h>
-#include <drm-oem-intel.h> //temporary code
#include "root_parser.h"
#include "widget_parser.h"
#include <widget_install/task_certificates.h>
#include <widget_install/task_unzip.h>
#include <widget_install/task_commons.h>
-
-#include <widget_install/task_plugins_copy.h>
+#include <widget_install/task_prepare_reinstall.h>
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME =
- L"install-location-type";
+ L"install-location";
const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT =
L"prefer-external";
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskCertificates(m_installerContext));
- AddTask(new TaskPluginsCopy(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
} else if (result == ConfigureResult::Updated) {
LogInfo("Configure installation updated");
LogInfo("Widget Update");
m_installerContext.job->SetProgressFlag(true);
+
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ AddTask(new TaskPrepareReinstall(m_installerContext));
+ }
+
if (m_installerContext.widgetConfig.packagingType !=
WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
{
AddTask(new TaskRemoveBackupFiles(m_installerContext));
}
- AddTask(new TaskPluginsCopy(m_installerContext));
AddTask(new TaskDatabase(m_installerContext));
AddTask(new TaskAceCheck(m_installerContext));
//TODO: remove widgetHandle from this task and move before database task
Try
{
- std::string tempDir =
- Jobs::WidgetInstall::createTempPath(m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_PRELOAD);
+ 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) {
widgetPath,
tempDir,
m_installerContext.widgetConfig.packagingType,
- m_isDRM);
+ m_isDRM,
+ m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY);
LogDebug("widget packaging type : " <<
m_installerContext.widgetConfig.packagingType.pkgType);
void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
const std::string& tempPath)
{
- m_installerContext.locations =
- WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
- tzPkgid),
- widgetPath, tempPath,
- m_installerContext.widgetConfig.packagingType,
- m_installerContext.locationType);
+ if (m_jobStruct.m_installMode ==
+ InstallMode::REINSTALL_MODE_DIRECTORY)
+ {
+ // replace widget path to installed path
+ m_installerContext.locations =
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
+ } else {
+ m_installerContext.locations =
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
+ }
m_installerContext.locations->registerAppid(
DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
LogInfo("incoming version = '" << update.incomingVersion);
LogInfo("Tizen AppID = " << update.tzAppId);
+ if (update.existingVersion.IsNull() || update.incomingVersion.IsNull()) {
+ return ConfigureResult::Failed;
+ }
+
// Check running state
bool isRunning = false;
int retval =
m_installerContext.widgetConfig.tzAppid = update.tzAppId;
if (isUpperVersion(update.existingVersion, update.incomingVersion) ||
- m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
+ (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY) ||
+ (m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY))
{
LogInfo("Whether widget policy allow proceed ok");
return ConfigureResult::Updated;
const std::string &widgetSource,
const std::string &tempPath,
WrtDB::PackagingType pkgType,
- bool isDRM)
+ bool isDRM,
+ bool isReinstall)
{
// Parse config
ParserRunner parser;
DPL::FromUTF32String(
L"widget"))));
} else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
- parser.Parse(widgetSource + '/' + WITH_OSP_XML,
+ std::string configPath;
+ configPath = tempPath;
+ configPath += "/";
+ configPath += WITH_OSP_XML;
+
+ if (isReinstall) {
+ // checking RDS data directory
+ if (access(configPath.c_str(), F_OK) != 0) {
+ std::string tzAppId =
+ widgetSource.substr(widgetSource.find_last_of("/")+1);
+ WidgetDAOReadOnly dao(WidgetDAOReadOnly::getTzAppId(DPL::FromUTF8String(tzAppId)));
+ configPath = DPL::ToUTF8String(*dao.getWidgetInstalledPath());
+ configPath += "/";
+ configPath += WITH_OSP_XML;
+ }
+ }
+ parser.Parse(configPath,
ElementParserPtr(
new RootParser<WidgetParser>(
configInfo,
}
WidgetDAOReadOnly dao(tizenId);
+
+ OptionalWidgetVersion optVersion;
+ DPL::OptionalString version = dao.getVersion();
+ if (!version.IsNull()) {
+ optVersion = OptionalWidgetVersion(WidgetVersion(*version));
+ }
+
return WidgetUpdateInfo(
dao.getTzAppId(),
- WidgetVersion(*dao.getVersion()),
+ optVersion,
incomingVersion);
}
const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY)
+ if (m_jobStruct.m_installMode == InstallMode::INSTALL_MODE_DIRECTORY ||
+ m_jobStruct.m_installMode == InstallMode::REINSTALL_MODE_DIRECTORY)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;
}
}
-bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
+bool JobWidgetInstall::isDRMWidget(std::string /*widgetPath*/)
{
- /* TODO :
- * drm_bool_type_e is_drm_file = DRM_UNKNOWN;
- * int ret = -1;
- *
- * ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
- * if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
- */
-
- /* blow code temporary code for drm. */
- int ret = drm_oem_intel_isDrmFile(const_cast<char*>(widgetPath.c_str()));
- if (1 == ret) {
- return true;
- } else {
- return false;
- }
+ /* TODO */
+ return false;
}
-bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
- std::string destPath)
+bool JobWidgetInstall::DecryptDRMWidget(std::string /*widgetPath*/,
+ std::string /*destPath*/)
{
- /* TODO :
- * drm_trusted_sapps_decrypt_package_info_s package_info;
- *
- * strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
- * sizeof(package_info.sadcf_filepath));
- * strncpy(package_info.decrypt_filepath, destPath.c_str(),
- * sizeof(package_info.decrypt_filepath));
- *
- * drm_trusted_request_type_e requestType =
- * DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
- *
- * int ret = drm_trusted_handle_request(requestType,
- * (void *)&package_info, NULL);
- * if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
- * return true;
- * } else {
- * return false;
- * }
- */
- if (drm_oem_intel_decrypt_package(const_cast<char*>(widgetPath.c_str()),
- const_cast<char*>(destPath.c_str())) != 0)
- {
- return true;
- } else {
- return false;
- }
+ /* TODO */
+ return false;
}
} //namespace WidgetInstall
} //namespace Jobs