From 7c4127098a058b724ce202ab6afb367d89e85dd9 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 7 Nov 2017 09:45:22 +0900 Subject: [PATCH] Fix logic to store api version at application structure - Each application could have different api version based on pkg which it belongs to, such as hybrid pkg. - Store api version of each application into application structure to deliver it to security-manager. Related changes: [app-installers] : https://review.tizen.org/gerrit/159061 Change-Id: I80c0faa909d25d23bb152d6a715ebe3e7e832f70 Signed-off-by: Junghyun Yeon --- src/wgt/step/configuration/step_parse.cc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/wgt/step/configuration/step_parse.cc b/src/wgt/step/configuration/step_parse.cc index 05a3b5d..353cf28 100644 --- a/src/wgt/step/configuration/step_parse.cc +++ b/src/wgt/step/configuration/step_parse.cc @@ -412,6 +412,7 @@ bool StepParse::FillMainApplicationInfo(manifest_x* manifest) { application->autorestart = strdup("false"); application->launch_mode = strdup(app_info->launch_mode().c_str()); + application->api_version = strdup(manifest->api_version); for (auto& icon : GListRange(manifest->icon)) { icon_x* app_icon = reinterpret_cast(calloc(1, sizeof(icon_x))); if (!app_icon) { @@ -460,7 +461,7 @@ bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) { SetApplicationXDefaults(application); application->support_ambient = strdup("false"); application->package = strdup(manifest->package); - + application->api_version = strdup(manifest->api_version); for (auto& pair : service_info.names()) { AppendLabel(application, pair.second, pair.first); } @@ -527,7 +528,7 @@ bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) { SetApplicationXDefaults(application); application->support_ambient = strdup("false"); application->package = strdup(manifest->package); - + application->api_version = strdup(manifest->api_version); if (!app_widget.label.default_value.empty()) { AppendLabel(application, app_widget.label.default_value, std::string()); } @@ -903,18 +904,6 @@ common_installer::Step::Status StepParse::process() { backend_data->service_list.set(*service_list); } - manifest_x* manifest = - static_cast(calloc(1, sizeof(manifest_x))); - if (!manifest) { - LOG(ERROR) << "Out of memory"; - return common_installer::Step::Status::ERROR; - } - if (!FillManifestX(manifest)) { - LOG(ERROR) << "[Parse] Storing manifest_x failed. " - << parser_->GetErrorMessage(); - return common_installer::Step::Status::PARSE_ERROR; - } - // Copy data from ManifestData to InstallerContext auto info = GetManifestDataForKey( @@ -940,8 +929,20 @@ common_installer::Step::Status StepParse::process() { const std::string& package_version = wgt_info->version(); const std::string& required_api_version = info->required_version(); + manifest_x* manifest = + static_cast(calloc(1, sizeof(manifest_x))); + if (!manifest) { + LOG(ERROR) << "Out of memory"; + return common_installer::Step::Status::ERROR; + } manifest->api_version = strdup(required_api_version.c_str()); + if (!FillManifestX(manifest)) { + LOG(ERROR) << "[Parse] Storing manifest_x failed. " + << parser_->GetErrorMessage(); + return common_installer::Step::Status::PARSE_ERROR; + } + context_->pkgid.set(manifest->package); // write pkgid for recovery file -- 2.7.4