1 /* 2014, Copyright © Intel Coporation, license APACHE-2.0, see LICENSE file */
2 // Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3 // Use of this source code is governed by a apache 2.0 license that can be
4 // found in the LICENSE file.
6 #include "wgt/step/configuration/step_parse.h"
8 #include <boost/filesystem/path.hpp>
10 #include <common/app_installer.h>
11 #include <common/paths.h>
12 #include <common/installer_context.h>
13 #include <common/step/step.h>
14 #include <common/utils/glist_range.h>
15 #include <manifest_parser/utils/version_number.h>
16 #include <wgt_manifest_handlers/account_handler.h>
17 #include <wgt_manifest_handlers/app_control_handler.h>
18 #include <wgt_manifest_handlers/application_icons_handler.h>
19 #include <wgt_manifest_handlers/application_manifest_constants.h>
20 #include <wgt_manifest_handlers/background_category_handler.h>
21 #include <wgt_manifest_handlers/category_handler.h>
22 #include <wgt_manifest_handlers/content_handler.h>
23 #include <wgt_manifest_handlers/ime_handler.h>
24 #include <wgt_manifest_handlers/metadata_handler.h>
25 #include <wgt_manifest_handlers/service_handler.h>
26 #include <wgt_manifest_handlers/setting_handler.h>
27 #include <wgt_manifest_handlers/tizen_application_handler.h>
28 #include <wgt_manifest_handlers/widget_handler.h>
29 #include <wgt_manifest_handlers/w3c_pc_utils.h>
31 #include <pkgmgr/pkgmgr_parser.h>
43 #include "wgt/wgt_backend_data.h"
45 namespace bf = boost::filesystem;
49 const char kCategoryWearableClock[] =
50 "http://tizen.org/category/wearable_clock";
51 const char kCategoryWatchClock[] = "com.samsung.wmanager.WATCH_CLOCK";
53 const std::string kManifestVersion = "1.0.0";
54 const char kTizenPackageXmlNamespace[] = "http://tizen.org/ns/packages";
55 const char kImeCategoryName[] = "http://tizen.org/category/ime";
57 const char kResWgt[] = "res/wgt";
58 const char kConfigFileName[] = "config.xml";
60 GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) {
61 GList* list = nullptr;
62 for (auto& meta : meta_info.metadata()) {
63 metadata_x* new_meta =
64 static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
65 new_meta->key = strdup(meta.first.c_str());
66 if (!meta.second.empty())
67 new_meta->value = strdup(meta.second.c_str());
68 list = g_list_append(list, new_meta);
73 void AppendWidgetMetadata(GList** metadatas,
74 const std::vector<std::pair<std::string, std::string>> metadata) {
75 GList* list = *metadatas;
76 for (auto& meta : metadata) {
77 metadata_x* new_meta = static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
78 new_meta->key = strdup(meta.first.c_str());
79 if (!meta.second.empty())
80 new_meta->value = strdup(meta.second.c_str());
82 list = g_list_append(list, new_meta);
88 void SetApplicationXDefaults(application_x* application) {
89 application->effectimage_type = strdup("image");
90 application->enabled = strdup("true");
91 application->guestmode_visibility = strdup("true");
92 application->hwacceleration = strdup("default");
93 application->indicatordisplay = strdup("true");
94 application->launchcondition = strdup("false");
95 application->permission_type = strdup("normal");
96 application->process_pool = strdup("false");
97 application->recentimage = strdup("false");
98 application->screenreader = strdup("use-system-setting");
99 application->submode = strdup("false");
100 application->support_disable = strdup("false");
101 application->ui_gadget = strdup("false");
102 application->multiple = strdup("false");
106 void AppendLabel(T* root, const std::string& label,
107 const std::string& locale) {
108 label_x* label_item = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
109 label_item->name = strdup(label.c_str());
110 label_item->text = strdup(label.c_str());
111 label_item->lang = !locale.empty() ?
112 strdup(locale.c_str()) : strdup(DEFAULT_LOCALE);
113 root->label = g_list_append(root->label, label_item);
118 namespace configuration {
120 namespace app_keys = wgt::application_widget_keys;
121 namespace sc = std::chrono;
123 StepParse::StepParse(common_installer::InstallerContext* context,
124 ConfigLocation config_location,
125 bool check_start_file)
127 config_location_(config_location),
128 check_start_file_(check_start_file) {
131 std::set<std::string> StepParse::ExtractPrivileges(
132 std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info) const {
133 return perm_info->GetAPIPermissions();
136 std::string StepParse::GetPackageVersion(
137 const std::string& manifest_version) {
138 if (manifest_version.empty()) {
139 return kManifestVersion;
141 std::string version = manifest_version.substr(0,
142 manifest_version.find_first_not_of("1234567890."));
144 utils::VersionNumber version_number(version);
146 if (!version_number.IsValidTizenPackageVersion()) {
147 LOG(WARNING) << "Version number: " << manifest_version
148 << " is not valid version number for tizen package. "
149 << "Default value will be used.";
150 return kManifestVersion;
153 return version_number.ToString();
156 bool StepParse::FillInstallationInfo(manifest_x* manifest) {
157 manifest->root_path = strdup(
158 (context_->root_application_path.get() / manifest->package).c_str());
159 manifest->installed_time =
160 strdup(std::to_string(sc::system_clock::to_time_t(
161 sc::system_clock::now())).c_str());
165 bool StepParse::FillIconPaths(manifest_x* manifest) {
167 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
168 app_keys::kTizenApplicationKey);
170 LOG(ERROR) << "Application info manifest data has not been found.";
174 GetManifestDataForKey<const wgt::parse::ApplicationIconsInfo>(
175 app_keys::kIconsKey);
177 icons_info.reset(new wgt::parse::ApplicationIconsInfo());
179 wgt::parse::LocalizedApplicationIconsInfo localized_list =
180 wgt::parse::GetLocalizedIconList(*icons_info, widget_path_);
181 // We need to generate icon for each locale and icons are already set into
182 // lookup order. There isn't said that all icons should be received from
183 // one <icon> tag position so we iterate utils we run out of icons creating
184 // any icon element that are possible for given locale.
185 std::set<std::string> found_locales;
186 for (auto& application_icon : localized_list) {
187 const std::string& locale = application_icon.locale();
188 if (found_locales.find(locale) != found_locales.end())
190 found_locales.insert(locale);
192 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
193 bf::path icon_path = context_->root_application_path.get()
194 / app_info->package() / "res" / "wgt" / application_icon.path();
195 icon->text = strdup(icon_path.c_str());
197 icon->lang = strdup(locale.c_str());
199 icon->lang = strdup(DEFAULT_LOCALE);
200 manifest->icon = g_list_append(manifest->icon, icon);
205 bool StepParse::FillWidgetInfo(manifest_x* manifest) {
207 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
208 app_keys::kWidgetKey);
210 if (!wgt_info.get()) {
211 LOG(ERROR) << "Widget info manifest data has not been found.";
215 const std::string& version = wgt_info->version();
217 manifest->ns = strdup(kTizenPackageXmlNamespace);
218 manifest->version = strdup(GetPackageVersion(version).c_str());
220 for (auto& item : wgt_info->description_set()) {
221 description_x* description = reinterpret_cast<description_x*>
222 (calloc(1, sizeof(description_x)));
223 description->text = strdup(item.second.c_str());
224 description->lang = !item.first.empty() ?
225 strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
226 manifest->description = g_list_append(manifest->description, description);
229 for (auto& item : wgt_info->name_set()) {
230 AppendLabel(manifest, item.second, item.first);
233 manifest->type = strdup("wgt");
234 manifest->appsetting = strdup("false");
235 manifest->nodisplay_setting = strdup("false");
236 if (context_->is_preload_request.get())
237 manifest->preload = strdup("true");
239 manifest->preload = strdup("false");
240 manifest->installed_storage = strdup("installed_internal");
242 // For wgt package use the long name
244 reinterpret_cast<application_x*>(manifest->application->data);
245 for (auto& item : wgt_info->name_set()) {
246 AppendLabel(app, item.second, item.first);
249 author_x* author = reinterpret_cast<author_x*>(calloc(1, sizeof(author_x)));
250 if (!wgt_info->author().empty())
251 author->text = strdup(wgt_info->author().c_str());
252 if (!wgt_info->author_email().empty())
253 author->email = strdup(wgt_info->author_email().c_str());
254 if (!wgt_info->author_href().empty())
255 author->href = strdup(wgt_info->author_href().c_str());
256 author->lang = strdup(DEFAULT_LOCALE);
257 manifest->author = g_list_append(manifest->author, author);
260 GetManifestDataForKey<const wgt::parse::SettingInfo>(
261 wgt::application_widget_keys::kTizenSettingKey);
263 switch (settings_info->install_location()) {
264 case wgt::parse::SettingInfo::InstallLocation::AUTO: {
265 manifest->installlocation = strdup("auto");
268 case wgt::parse::SettingInfo::InstallLocation::INTERNAL: {
269 manifest->installlocation = strdup("internal-only");
272 case wgt::parse::SettingInfo::InstallLocation::EXTERNAL: {
273 manifest->installlocation = strdup("prefer-external");
278 manifest->installlocation = strdup("auto");
284 bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
286 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
287 app_keys::kTizenApplicationKey);
289 LOG(ERROR) << "Application info manifest data has not been found.";
292 bool has_watch_category = false;
293 bool has_ime = false;
295 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
296 app_keys::kTizenCategoryKey);
299 has_watch_category = std::find_if(category_info->categories.begin(),
300 category_info->categories.end(),
301 [](const std::string& category) {
302 return category == kCategoryWearableClock ||
303 category == kCategoryWatchClock;
304 }) != category_info->categories.end();
305 has_ime = std::find(category_info->categories.begin(),
306 category_info->categories.end(),
308 != category_info->categories.end();
312 application_x* application = reinterpret_cast<application_x*>(
313 calloc(1, sizeof(application_x)));
314 application->component_type =
315 has_watch_category ? strdup("watchapp") : strdup("uiapp");
316 application->mainapp = strdup("true");
317 application->appid = strdup(app_info->id().c_str());
319 GetManifestDataForKey<const wgt::parse::SettingInfo>(
320 wgt::application_widget_keys::kTizenSettingKey);
321 bool no_display = settings_info ? settings_info->no_display() : false;
322 application->nodisplay = (has_watch_category || has_ime || no_display) ?
323 strdup("true") : strdup("false");
324 application->taskmanage = (has_watch_category || has_ime) ? strdup("false") :
326 SetApplicationXDefaults(application);
327 if (has_watch_category)
328 application->ambient_support =
329 strdup(app_info->ambient_support() ? "true" : "false");
331 application->ambient_support = strdup("false");
332 application->package = strdup(app_info->package().c_str());
335 strdup((context_->root_application_path.get() / app_info->package()
336 / "bin" / application->appid).c_str());
337 application->type = strdup("webapp");
338 application->onboot = strdup("false");
339 application->autorestart = strdup("false");
341 application->launch_mode = strdup(app_info->launch_mode().c_str());
342 for (auto& icon : GListRange<icon_x*>(manifest->icon)) {
343 icon_x* app_icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
344 app_icon->text = strdup(icon->text);
345 app_icon->lang = strdup(icon->lang);
346 application->icon = g_list_append(application->icon, app_icon);
348 // guarantees that the main app will be at the begining of the list
349 manifest->application = g_list_insert(manifest->application, application, 0);
351 manifest->package = strdup(app_info->package().c_str());
352 manifest->mainapp_id = strdup(app_info->id().c_str());
356 bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
358 GetManifestDataForKey<const wgt::parse::ServiceList>(
359 app_keys::kTizenServiceKey);
362 for (auto& service_info : service_list->services) {
363 application_x* application = reinterpret_cast<application_x*>
364 (calloc(1, sizeof(application_x)));
365 application->component_type = strdup("svcapp");
366 application->mainapp = strdup("false");
367 application->appid = strdup(service_info.id().c_str());
369 strdup((context_->root_application_path.get() / manifest->package
370 / "bin" / application->appid).c_str());
371 application->type = strdup("webapp");
372 application->onboot =
373 service_info.on_boot() ? strdup("true") : strdup("false");
374 application->autorestart =
375 service_info.auto_restart() ? strdup("true") : strdup("false");
376 application->nodisplay = strdup("false");
377 application->taskmanage = strdup("true");
378 SetApplicationXDefaults(application);
379 application->ambient_support = strdup("false");
380 application->package = strdup(manifest->package);
382 for (auto& pair : service_info.names()) {
383 AppendLabel(application, pair.second, pair.first);
386 if (!service_info.icon().empty()) {
387 bf::path icon_path = context_->root_application_path.get()
388 / manifest->package / "res" / "wgt" / service_info.icon();
389 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
390 icon->text = strdup(icon_path.c_str());
391 icon->lang = strdup(DEFAULT_LOCALE);
392 application->icon = g_list_append(application->icon, icon);
395 for (auto& category : service_info.categories()) {
396 application->category = g_list_append(application->category,
397 strdup(category.c_str()));
400 for (auto& pair : service_info.metadata_set()) {
401 metadata_x* item = reinterpret_cast<metadata_x*>(
402 calloc(1, sizeof(metadata_x)));
403 item->key = strdup(pair.first.c_str());
404 if (!pair.second.empty())
405 item->value = strdup(pair.second.c_str());
406 application->metadata = g_list_append(application->metadata, item);
409 manifest->application = g_list_append(manifest->application, application);
414 bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) {
415 auto appwidget_info =
416 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
417 wgt::application_widget_keys::kTizenAppWidgetFullKey);
420 for (auto& app_widget : appwidget_info->app_widgets()) {
421 application_x* application = reinterpret_cast<application_x*>
422 (calloc(1, sizeof(application_x)));
423 application->component_type = strdup("widgetapp");
424 application->mainapp = strdup("false");
425 application->appid = strdup(app_widget.id.c_str());
427 strdup((context_->root_application_path.get() / manifest->package
428 / "bin" / application->appid).c_str());
429 application->type = strdup("webapp");
430 application->nodisplay = strdup("true");
431 application->taskmanage = strdup("false");
432 SetApplicationXDefaults(application);
433 application->ambient_support = strdup("false");
434 application->package = strdup(manifest->package);
436 if (!app_widget.label.default_value.empty()) {
437 AppendLabel(application, app_widget.label.default_value, std::string());
440 for (auto& pair : app_widget.label.lang_value_map) {
441 AppendLabel(application, pair.second, pair.first);
444 if (!app_widget.icon_src.empty()) {
445 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
446 icon->text = strdup(app_widget.icon_src.c_str());
447 icon->lang = strdup(DEFAULT_LOCALE);
448 application->icon = g_list_append(application->icon, icon);
451 if (!app_widget.metadata.empty())
452 AppendWidgetMetadata(&application->metadata, app_widget.metadata);
454 manifest->application = g_list_append(manifest->application, application);
460 bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) {
461 auto manifest_data = parser_->GetManifestData(
462 app_keys::kTizenBackgroundCategoryKey);
463 std::shared_ptr<const wgt::parse::BackgroundCategoryInfoList> bc_list =
464 std::static_pointer_cast<const wgt::parse::BackgroundCategoryInfoList>(
471 reinterpret_cast<application_x*>(manifest->application->data);
473 for (auto& background_category : bc_list->background_categories) {
474 app->background_category = g_list_append(
475 app->background_category, strdup(background_category.value().c_str()));
481 bool StepParse::FillAppControl(manifest_x* manifest) {
483 GetManifestDataForKey<const wgt::parse::AppControlInfoList>(
484 app_keys::kTizenApplicationAppControlsKey);
487 reinterpret_cast<application_x*>(manifest->application->data);
489 for (const auto& control : app_info_list->controls) {
490 appcontrol_x* app_control =
491 static_cast<appcontrol_x*>(calloc(1, sizeof(appcontrol_x)));
492 app_control->operation = strdup(control.operation().c_str());
493 app_control->mime = strdup(control.mime().c_str());
494 app_control->uri = strdup(control.uri().c_str());
495 app->appcontrol = g_list_append(app->appcontrol, app_control);
501 bool StepParse::FillPrivileges(manifest_x* manifest) {
503 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
504 app_keys::kTizenPermissionsKey);
505 std::set<std::string> privileges;
507 privileges = ExtractPrivileges(perm_info);
509 for (auto& priv : privileges) {
510 manifest->privileges =
511 g_list_append(manifest->privileges, strdup(priv.c_str()));
516 bool StepParse::FillCategories(manifest_x* manifest) {
518 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
519 app_keys::kTizenCategoryKey);
524 reinterpret_cast<application_x*>(manifest->application->data);
525 // there is one app atm
526 for (auto& category : category_info->categories) {
527 app->category = g_list_append(app->category, strdup(category.c_str()));
532 bool StepParse::FillMetadata(manifest_x* manifest) {
534 GetManifestDataForKey<const wgt::parse::MetaDataInfo>(
535 app_keys::kTizenMetaDataKey);
539 for (application_x* app : GListRange<application_x*>(manifest->application)) {
540 app->metadata = GenerateMetadataListX(*meta_info);
545 bool StepParse::FillAppWidget() {
546 // This is needed to store preview icons which are not saved into manifest_x
547 WgtBackendData* backend_data =
548 static_cast<WgtBackendData*>(context_->backend_data.get());
550 auto appwidget_info =
551 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
552 wgt::application_widget_keys::kTizenAppWidgetFullKey);
554 backend_data->appwidgets.set(*appwidget_info);
558 bool StepParse::FillAccounts(manifest_x* manifest) {
560 GetManifestDataForKey<const wgt::parse::AccountInfo>(
561 app_keys::kAccountKey);
564 common_installer::AccountInfo info;
565 for (auto& account : account_info->accounts()) {
566 common_installer::SingleAccountInfo single_info;
567 single_info.capabilities = account.capabilities;
568 single_info.icon_paths = account.icon_paths;
569 single_info.multiple_account_support = account.multiple_account_support;
570 single_info.names = account.names;
571 // wgt can contain only one app so this assumes mainapp_id is valid here
572 single_info.appid = manifest->mainapp_id;
573 info.set_account(single_info);
575 context_->manifest_plugins_data.get().account_info.set(info);
579 bool StepParse::FillImeInfo() {
581 GetManifestDataForKey<const wgt::parse::ImeInfo>(
582 app_keys::kTizenImeKey);
586 common_installer::ImeInfo info;
587 info.setUuid(ime_info->uuid());
589 const auto &languages = ime_info->languages();
590 for (const auto &language : languages)
591 info.AddLanguage(language);
593 context_->manifest_plugins_data.get().ime_info.set(std::move(info));
597 bool StepParse::FillExtraManifestInfo(manifest_x* manifest) {
598 return FillAccounts(manifest) && FillImeInfo() && FillAppWidget();
601 bool StepParse::FillManifestX(manifest_x* manifest) {
602 // Fill data for main application
603 if (!FillIconPaths(manifest))
605 if (!FillMainApplicationInfo(manifest))
607 if (!FillWidgetInfo(manifest))
609 if (!FillInstallationInfo(manifest))
611 if (!FillPrivileges(manifest))
613 if (!FillAppControl(manifest))
615 if (!FillCategories(manifest))
617 if (!FillMetadata(manifest))
619 if (!FillBackgroundCategoryInfo(manifest))
622 // Fill data for other applications
623 if (!FillAdditionalApplications(manifest))
626 // Fill extra data, other than manifest_x structure
627 if (!FillExtraManifestInfo(manifest))
634 bool StepParse::FillAdditionalApplications(manifest_x* manifest) {
635 if (!FillServiceApplicationInfo(manifest))
637 if (!FillWidgetApplicationInfo(manifest))
642 bool StepParse::LocateConfigFile() {
643 switch (config_location_) {
644 case ConfigLocation::PACKAGE:
645 return StepParse::Check(context_->unpacked_dir_path.get());
646 case ConfigLocation::INSTALLED:
647 return StepParse::Check(context_->pkg_path.get() / kResWgt);
648 case ConfigLocation::RECOVERY:
649 if (StepParse::Check(common_installer::GetBackupPathForPackagePath(
650 context_->root_application_path.get()
651 / context_->pkgid.get()) / kResWgt))
653 if (StepParse::Check(
654 context_->root_application_path.get()
655 / context_->pkgid.get() / kResWgt))
658 case ConfigLocation::RESOURCE_WGT:
659 return StepParse::Check(context_->unpacked_dir_path.get() / kResWgt);
661 LOG(ERROR) << "Unknown config location";
666 common_installer::Step::Status StepParse::process() {
667 if (!LocateConfigFile()) {
668 LOG(ERROR) << "No config.xml";
669 return common_installer::Step::Status::MANIFEST_NOT_FOUND;
672 parser_.reset(new wgt::parse::WidgetConfigParser());
673 if (!parser_->ParseManifest(widget_path_ / kConfigFileName)) {
674 LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();
675 return common_installer::Step::Status::PARSE_ERROR;
678 WgtBackendData* backend_data =
679 static_cast<WgtBackendData*>(context_->backend_data.get());
681 if (check_start_file_) {
682 if (!parser_->CheckValidStartFile()) {
683 LOG(ERROR) << parser_->GetErrorMessage();
684 return common_installer::Step::Status::PARSE_ERROR;
686 if (!parser_->CheckValidServicesStartFiles()) {
687 LOG(ERROR) << parser_->GetErrorMessage();
688 return common_installer::Step::Status::PARSE_ERROR;
691 // making backup of content data and services content data
693 GetManifestDataForKey<const wgt::parse::ContentInfo>(
694 wgt::application_widget_keys::kTizenContentKey);
696 GetManifestDataForKey<const wgt::parse::ServiceList>(
697 wgt::application_widget_keys::kTizenServiceKey);
699 backend_data->content.set(*content_info);
701 backend_data->service_list.set(*service_list);
704 manifest_x* manifest =
705 static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
706 if (!FillManifestX(manifest)) {
707 LOG(ERROR) << "[Parse] Storing manifest_x failed. "
708 << parser_->GetErrorMessage();
709 return common_installer::Step::Status::PARSE_ERROR;
712 // Copy data from ManifestData to InstallerContext
714 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
715 wgt::application_widget_keys::kTizenApplicationKey);
717 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
718 wgt::application_widget_keys::kTizenWidgetKey);
721 const auto& name_set = wgt_info->name_set();
722 if (name_set.find("") != name_set.end())
723 name = name_set.find("")->second;
724 if (name_set.begin() != name_set.end())
725 name = name_set.begin()->second;
727 std::string short_name;
728 const auto& short_name_set = wgt_info->short_name_set();
729 if (short_name_set.find("") != short_name_set.end())
730 short_name = short_name_set.find("")->second;
731 if (short_name_set.begin() != short_name_set.end())
732 short_name = short_name_set.begin()->second;
734 const std::string& package_version = wgt_info->version();
735 const std::string& required_api_version = info->required_version();
737 manifest->api_version = strdup(required_api_version.c_str());
739 context_->pkgid.set(manifest->package);
741 // write pkgid for recovery file
742 if (context_->recovery_info.get().recovery_file) {
743 context_->recovery_info.get().recovery_file->set_pkgid(manifest->package);
744 context_->recovery_info.get().recovery_file->WriteAndCommitFileContent();
748 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
749 wgt::application_widget_keys::kTizenPermissionsKey);
750 parser::PermissionSet permissions;
752 permissions = perm_info->GetAPIPermissions();
755 GetManifestDataForKey<const wgt::parse::SettingInfo>(
756 wgt::application_widget_keys::kTizenSettingKey);
758 backend_data->settings.set(*settings_info);
760 LOG(DEBUG) << " Read data -[ ";
761 LOG(DEBUG) << "App id: " << info->id();
762 LOG(DEBUG) << " package = " << info->package();
763 LOG(DEBUG) << " id = " << info->id();
764 LOG(DEBUG) << " name = " << name;
765 LOG(DEBUG) << " short_name = " << short_name;
766 LOG(DEBUG) << " aplication version = " << package_version;
767 LOG(DEBUG) << " api_version = " << info->required_version();
768 LOG(DEBUG) << " launch_mode = " << info->launch_mode();
769 LOG(DEBUG) << " privileges -[";
770 for (const auto& p : permissions) {
771 LOG(DEBUG) << " " << p;
776 if (context_->manifest_data.get())
777 pkgmgr_parser_free_manifest_xml(context_->manifest_data.get());
779 context_->manifest_data.set(manifest);
780 return common_installer::Step::Status::OK;
783 bool StepParse::Check(const boost::filesystem::path& widget_path) {
784 LOG(DEBUG) << "unpacked widget path: " << widget_path;
786 widget_path_ = widget_path;
788 boost::filesystem::path config = widget_path / kConfigFileName;
789 LOG(DEBUG) << "config.xml path: " << config;
790 if (!boost::filesystem::exists(config))
795 } // namespace configuration