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>
44 #include "wgt/wgt_backend_data.h"
46 namespace bf = boost::filesystem;
50 const char kCategoryWearableClock[] =
51 "http://tizen.org/category/wearable_clock";
52 const char kCategoryWatchClock[] = "com.samsung.wmanager.WATCH_CLOCK";
54 const std::string kManifestVersion = "1.0.0";
55 const char kTizenPackageXmlNamespace[] = "http://tizen.org/ns/packages";
56 const char kImeCategoryName[] = "http://tizen.org/category/ime";
57 const char kDownloadableFontCategoryName[] =
58 "http://tizen.org/category/downloadable_font";
59 const char kTTSCategoryName[] = "http://tizen.org/category/tts";
61 const char kResWgt[] = "res/wgt";
62 const char kConfigFileName[] = "config.xml";
64 GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) {
65 GList* list = nullptr;
66 for (auto& meta : meta_info.metadata()) {
67 metadata_x* new_meta =
68 static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
69 new_meta->key = strdup(meta.first.c_str());
70 if (!meta.second.empty())
71 new_meta->value = strdup(meta.second.c_str());
72 list = g_list_append(list, new_meta);
77 void AppendWidgetMetadata(GList** metadatas,
78 const std::vector<std::pair<std::string, std::string>> metadata) {
79 GList* list = *metadatas;
80 for (auto& meta : metadata) {
81 metadata_x* new_meta =
82 static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
83 new_meta->key = strdup(meta.first.c_str());
84 if (!meta.second.empty())
85 new_meta->value = strdup(meta.second.c_str());
87 list = g_list_append(list, new_meta);
93 void SetApplicationXDefaults(application_x* application) {
94 application->effectimage_type = strdup("image");
95 application->enabled = strdup("true");
96 application->guestmode_visibility = strdup("true");
97 application->hwacceleration = strdup("default");
98 application->indicatordisplay = strdup("true");
99 application->launchcondition = strdup("false");
100 application->permission_type = strdup("normal");
101 application->process_pool = strdup("false");
102 application->recentimage = strdup("false");
103 application->screenreader = strdup("use-system-setting");
104 application->submode = strdup("false");
105 application->support_disable = strdup("false");
106 application->ui_gadget = strdup("false");
107 application->multiple = strdup("false");
111 void AppendLabel(T* root, const std::string& label,
112 const std::string& locale) {
113 label_x* label_item = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
114 label_item->name = strdup(label.c_str());
115 label_item->text = strdup(label.c_str());
116 label_item->lang = !locale.empty() ?
117 strdup(locale.c_str()) : strdup(DEFAULT_LOCALE);
118 root->label = g_list_append(root->label, label_item);
123 namespace configuration {
125 namespace app_keys = wgt::application_widget_keys;
126 namespace sc = std::chrono;
128 StepParse::StepParse(common_installer::InstallerContext* context,
129 ConfigLocation config_location,
130 bool check_start_file)
132 config_location_(config_location),
133 check_start_file_(check_start_file) {
136 std::set<std::string> StepParse::ExtractPrivileges(
137 std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info) const {
138 return perm_info->GetAPIPermissions();
141 std::string StepParse::GetPackageVersion(
142 const std::string& manifest_version) {
143 if (manifest_version.empty()) {
144 return kManifestVersion;
146 std::string version = manifest_version.substr(0,
147 manifest_version.find_first_not_of("1234567890."));
152 bool StepParse::FillInstallationInfo(manifest_x* manifest) {
153 manifest->root_path = strdup(
154 (context_->root_application_path.get() / manifest->package).c_str());
155 manifest->installed_time =
156 strdup(std::to_string(sc::system_clock::to_time_t(
157 sc::system_clock::now())).c_str());
161 bool StepParse::FillIconPaths(manifest_x* manifest) {
163 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
164 app_keys::kTizenApplicationKey);
166 LOG(ERROR) << "Application info manifest data has not been found.";
170 GetManifestDataForKey<const wgt::parse::ApplicationIconsInfo>(
171 app_keys::kIconsKey);
173 icons_info.reset(new wgt::parse::ApplicationIconsInfo());
175 wgt::parse::LocalizedApplicationIconsInfo localized_list =
176 wgt::parse::GetLocalizedIconList(*icons_info, widget_path_);
177 // We need to generate icon for each locale and icons are already set into
178 // lookup order. There isn't said that all icons should be received from
179 // one <icon> tag position so we iterate utils we run out of icons creating
180 // any icon element that are possible for given locale.
181 std::set<std::string> found_locales;
182 for (auto& application_icon : localized_list) {
183 const std::string& locale = application_icon.locale();
184 if (found_locales.find(locale) != found_locales.end())
186 found_locales.insert(locale);
188 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
189 bf::path icon_path = context_->root_application_path.get()
190 / app_info->package() / "res" / "wgt" / application_icon.path();
191 icon->text = strdup(icon_path.c_str());
193 icon->lang = strdup(locale.c_str());
195 icon->lang = strdup(DEFAULT_LOCALE);
196 manifest->icon = g_list_append(manifest->icon, icon);
201 bool StepParse::FillWidgetInfo(manifest_x* manifest) {
203 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
204 app_keys::kWidgetKey);
206 if (!wgt_info.get()) {
207 LOG(ERROR) << "Widget info manifest data has not been found.";
211 const std::string& version = wgt_info->version();
213 manifest->ns = strdup(kTizenPackageXmlNamespace);
214 manifest->version = strdup(GetPackageVersion(version).c_str());
216 for (auto& item : wgt_info->description_set()) {
217 description_x* description = reinterpret_cast<description_x*>
218 (calloc(1, sizeof(description_x)));
219 description->text = strdup(item.second.c_str());
220 description->lang = !item.first.empty() ?
221 strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
222 manifest->description = g_list_append(manifest->description, description);
225 for (auto& item : wgt_info->name_set()) {
226 AppendLabel(manifest, item.second, item.first);
229 manifest->type = strdup("wgt");
230 manifest->appsetting = strdup("false");
231 manifest->nodisplay_setting = strdup("false");
232 if (context_->is_preload_request.get())
233 manifest->preload = strdup("true");
235 manifest->preload = strdup("false");
236 manifest->installed_storage = strdup("installed_internal");
238 // For wgt package use the long name
240 reinterpret_cast<application_x*>(manifest->application->data);
241 for (auto& item : wgt_info->name_set()) {
242 AppendLabel(app, item.second, item.first);
245 author_x* author = reinterpret_cast<author_x*>(calloc(1, sizeof(author_x)));
246 if (!wgt_info->author().empty())
247 author->text = strdup(wgt_info->author().c_str());
248 if (!wgt_info->author_email().empty())
249 author->email = strdup(wgt_info->author_email().c_str());
250 if (!wgt_info->author_href().empty())
251 author->href = strdup(wgt_info->author_href().c_str());
252 author->lang = strdup(DEFAULT_LOCALE);
253 manifest->author = g_list_append(manifest->author, author);
256 GetManifestDataForKey<const wgt::parse::SettingInfo>(
257 wgt::application_widget_keys::kTizenSettingKey);
259 switch (settings_info->install_location()) {
260 case wgt::parse::SettingInfo::InstallLocation::AUTO: {
261 manifest->installlocation = strdup("auto");
264 case wgt::parse::SettingInfo::InstallLocation::INTERNAL: {
265 manifest->installlocation = strdup("internal-only");
268 case wgt::parse::SettingInfo::InstallLocation::EXTERNAL: {
269 manifest->installlocation = strdup("prefer-external");
274 manifest->installlocation = strdup("auto");
280 bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
282 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
283 app_keys::kTizenApplicationKey);
285 LOG(ERROR) << "Application info manifest data has not been found.";
288 bool has_watch_category = false;
289 bool has_ime = false;
290 bool has_downloadable_font = false;
291 bool has_tts = false;
293 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
294 app_keys::kTizenCategoryKey);
297 has_watch_category = std::find_if(category_info->categories.begin(),
298 category_info->categories.end(),
299 [](const std::string& category) {
300 return category == kCategoryWearableClock ||
301 category == kCategoryWatchClock;
302 }) != category_info->categories.end();
303 has_ime = std::find(category_info->categories.begin(),
304 category_info->categories.end(),
306 != category_info->categories.end();
307 has_downloadable_font = std::find(category_info->categories.begin(),
308 category_info->categories.end(),
309 kDownloadableFontCategoryName)
310 != category_info->categories.end();
311 has_tts = std::find(category_info->categories.begin(),
312 category_info->categories.end(),
314 != category_info->categories.end();
318 application_x* application = reinterpret_cast<application_x*>(
319 calloc(1, sizeof(application_x)));
320 application->component_type =
321 has_watch_category ? strdup("watchapp") : strdup("uiapp");
322 application->mainapp = strdup("true");
323 application->appid = strdup(app_info->id().c_str());
325 GetManifestDataForKey<const wgt::parse::SettingInfo>(
326 wgt::application_widget_keys::kTizenSettingKey);
328 bool no_display = settings_info ? settings_info->no_display() : false;
329 bool has_no_display_category =
330 has_watch_category || has_ime || has_tts || has_downloadable_font;
332 application->nodisplay = (has_no_display_category || no_display) ?
333 strdup("true") : strdup("false");
334 application->taskmanage = has_no_display_category ? strdup("false") :
337 SetApplicationXDefaults(application);
338 if (has_watch_category)
339 application->ambient_support =
340 strdup(app_info->ambient_support() ? "true" : "false");
342 application->ambient_support = strdup("false");
343 application->package = strdup(app_info->package().c_str());
346 strdup((context_->root_application_path.get() / app_info->package()
347 / "bin" / application->appid).c_str());
348 application->type = strdup("webapp");
349 application->onboot = strdup("false");
350 application->autorestart = strdup("false");
352 application->launch_mode = strdup(app_info->launch_mode().c_str());
353 for (auto& icon : GListRange<icon_x*>(manifest->icon)) {
354 icon_x* app_icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
355 app_icon->text = strdup(icon->text);
356 app_icon->lang = strdup(icon->lang);
357 application->icon = g_list_append(application->icon, app_icon);
359 // guarantees that the main app will be at the begining of the list
360 manifest->application = g_list_insert(manifest->application, application, 0);
362 manifest->package = strdup(app_info->package().c_str());
363 manifest->mainapp_id = strdup(app_info->id().c_str());
367 bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
369 GetManifestDataForKey<const wgt::parse::ServiceList>(
370 app_keys::kTizenServiceKey);
373 for (auto& service_info : service_list->services) {
374 application_x* application = reinterpret_cast<application_x*>
375 (calloc(1, sizeof(application_x)));
376 application->component_type = strdup("svcapp");
377 application->mainapp = strdup("false");
378 application->appid = strdup(service_info.id().c_str());
380 strdup((context_->root_application_path.get() / manifest->package
381 / "bin" / application->appid).c_str());
382 application->type = strdup("webapp");
383 application->onboot =
384 service_info.on_boot() ? strdup("true") : strdup("false");
385 application->autorestart =
386 service_info.auto_restart() ? strdup("true") : strdup("false");
387 application->nodisplay = strdup("false");
388 application->taskmanage = strdup("true");
389 SetApplicationXDefaults(application);
390 application->ambient_support = strdup("false");
391 application->package = strdup(manifest->package);
393 for (auto& pair : service_info.names()) {
394 AppendLabel(application, pair.second, pair.first);
397 if (!service_info.icon().empty()) {
398 bf::path icon_path = context_->root_application_path.get()
399 / manifest->package / "res" / "wgt" / service_info.icon();
400 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
401 icon->text = strdup(icon_path.c_str());
402 icon->lang = strdup(DEFAULT_LOCALE);
403 application->icon = g_list_append(application->icon, icon);
406 for (auto& category : service_info.categories()) {
407 application->category = g_list_append(application->category,
408 strdup(category.c_str()));
411 for (auto& pair : service_info.metadata_set()) {
412 metadata_x* item = reinterpret_cast<metadata_x*>(
413 calloc(1, sizeof(metadata_x)));
414 item->key = strdup(pair.first.c_str());
415 if (!pair.second.empty())
416 item->value = strdup(pair.second.c_str());
417 application->metadata = g_list_append(application->metadata, item);
420 manifest->application = g_list_append(manifest->application, application);
425 bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) {
426 auto appwidget_info =
427 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
428 wgt::application_widget_keys::kTizenAppWidgetFullKey);
431 for (auto& app_widget : appwidget_info->app_widgets()) {
432 application_x* application = reinterpret_cast<application_x*>
433 (calloc(1, sizeof(application_x)));
434 application->component_type = strdup("widgetapp");
435 application->mainapp = strdup("false");
436 application->appid = strdup(app_widget.id.c_str());
438 strdup((context_->root_application_path.get() / manifest->package
439 / "bin" / application->appid).c_str());
440 application->type = strdup("webapp");
441 application->nodisplay = strdup("true");
442 application->taskmanage = strdup("false");
443 SetApplicationXDefaults(application);
444 application->ambient_support = strdup("false");
445 application->package = strdup(manifest->package);
447 if (!app_widget.label.default_value.empty()) {
448 AppendLabel(application, app_widget.label.default_value, std::string());
451 for (auto& pair : app_widget.label.lang_value_map) {
452 AppendLabel(application, pair.second, pair.first);
455 if (!app_widget.icon_src.empty()) {
456 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
457 icon->text = strdup(app_widget.icon_src.c_str());
458 icon->lang = strdup(DEFAULT_LOCALE);
459 application->icon = g_list_append(application->icon, icon);
462 if (!app_widget.metadata.empty())
463 AppendWidgetMetadata(&application->metadata, app_widget.metadata);
465 manifest->application = g_list_append(manifest->application, application);
471 bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) {
472 auto manifest_data = parser_->GetManifestData(
473 app_keys::kTizenBackgroundCategoryKey);
474 std::shared_ptr<const wgt::parse::BackgroundCategoryInfoList> bc_list =
475 std::static_pointer_cast<const wgt::parse::BackgroundCategoryInfoList>(
482 reinterpret_cast<application_x*>(manifest->application->data);
484 for (auto& background_category : bc_list->background_categories) {
485 app->background_category = g_list_append(
486 app->background_category, strdup(background_category.value().c_str()));
492 bool StepParse::FillAppControl(manifest_x* manifest) {
494 GetManifestDataForKey<const wgt::parse::AppControlInfoList>(
495 app_keys::kTizenApplicationAppControlsKey);
498 reinterpret_cast<application_x*>(manifest->application->data);
500 for (const auto& control : app_info_list->controls) {
501 appcontrol_x* app_control =
502 static_cast<appcontrol_x*>(calloc(1, sizeof(appcontrol_x)));
503 app_control->operation = strdup(control.operation().c_str());
504 app_control->mime = strdup(control.mime().c_str());
505 app_control->uri = strdup(control.uri().c_str());
506 app->appcontrol = g_list_append(app->appcontrol, app_control);
512 bool StepParse::FillPrivileges(manifest_x* manifest) {
514 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
515 app_keys::kTizenPermissionsKey);
516 std::set<std::string> privileges;
518 privileges = ExtractPrivileges(perm_info);
520 for (auto& priv : privileges) {
521 manifest->privileges =
522 g_list_append(manifest->privileges, strdup(priv.c_str()));
527 bool StepParse::FillCategories(manifest_x* manifest) {
529 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
530 app_keys::kTizenCategoryKey);
535 reinterpret_cast<application_x*>(manifest->application->data);
536 // there is one app atm
537 for (auto& category : category_info->categories) {
538 app->category = g_list_append(app->category, strdup(category.c_str()));
543 bool StepParse::FillMetadata(manifest_x* manifest) {
545 GetManifestDataForKey<const wgt::parse::MetaDataInfo>(
546 app_keys::kTizenMetaDataKey);
550 for (application_x* app : GListRange<application_x*>(manifest->application)) {
551 app->metadata = GenerateMetadataListX(*meta_info);
556 bool StepParse::FillAppWidget() {
557 // This is needed to store preview icons which are not saved into manifest_x
558 WgtBackendData* backend_data =
559 static_cast<WgtBackendData*>(context_->backend_data.get());
561 auto appwidget_info =
562 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
563 wgt::application_widget_keys::kTizenAppWidgetFullKey);
565 backend_data->appwidgets.set(*appwidget_info);
569 bool StepParse::FillAccounts(manifest_x* manifest) {
571 GetManifestDataForKey<const wgt::parse::AccountInfo>(
572 app_keys::kAccountKey);
575 common_installer::AccountInfo info;
576 for (auto& account : account_info->accounts()) {
577 common_installer::SingleAccountInfo single_info;
578 single_info.capabilities = account.capabilities;
579 single_info.icon_paths = account.icon_paths;
580 single_info.multiple_account_support = account.multiple_account_support;
581 single_info.names = account.names;
582 // wgt can contain only one app so this assumes mainapp_id is valid here
583 single_info.appid = manifest->mainapp_id;
584 info.set_account(single_info);
586 context_->manifest_plugins_data.get().account_info.set(info);
590 bool StepParse::FillImeInfo() {
592 GetManifestDataForKey<const wgt::parse::ImeInfo>(
593 app_keys::kTizenImeKey);
597 common_installer::ImeInfo info;
598 info.setUuid(ime_info->uuid());
600 const auto &languages = ime_info->languages();
601 for (const auto &language : languages)
602 info.AddLanguage(language);
604 context_->manifest_plugins_data.get().ime_info.set(std::move(info));
608 bool StepParse::FillExtraManifestInfo(manifest_x* manifest) {
609 return FillAccounts(manifest) && FillImeInfo() && FillAppWidget();
612 bool StepParse::FillManifestX(manifest_x* manifest) {
613 // Fill data for main application
614 if (!FillIconPaths(manifest))
616 if (!FillMainApplicationInfo(manifest))
618 if (!FillWidgetInfo(manifest))
620 if (!FillInstallationInfo(manifest))
622 if (!FillPrivileges(manifest))
624 if (!FillAppControl(manifest))
626 if (!FillCategories(manifest))
628 if (!FillMetadata(manifest))
630 if (!FillBackgroundCategoryInfo(manifest))
633 // Fill data for other applications
634 if (!FillAdditionalApplications(manifest))
637 // Fill extra data, other than manifest_x structure
638 if (!FillExtraManifestInfo(manifest))
645 bool StepParse::FillAdditionalApplications(manifest_x* manifest) {
646 if (!FillServiceApplicationInfo(manifest))
648 if (!FillWidgetApplicationInfo(manifest))
653 bool StepParse::LocateConfigFile() {
654 switch (config_location_) {
655 case ConfigLocation::PACKAGE:
656 return StepParse::Check(context_->unpacked_dir_path.get());
657 case ConfigLocation::INSTALLED:
658 return StepParse::Check(context_->pkg_path.get() / kResWgt);
659 case ConfigLocation::RECOVERY:
660 if (StepParse::Check(common_installer::GetBackupPathForPackagePath(
661 context_->root_application_path.get()
662 / context_->pkgid.get()) / kResWgt))
664 if (StepParse::Check(
665 context_->root_application_path.get()
666 / context_->pkgid.get() / kResWgt))
669 case ConfigLocation::RESOURCE_WGT:
670 return StepParse::Check(context_->unpacked_dir_path.get() / kResWgt);
672 LOG(ERROR) << "Unknown config location";
677 common_installer::Step::Status StepParse::process() {
678 if (!LocateConfigFile()) {
679 LOG(ERROR) << "No config.xml";
680 return common_installer::Step::Status::MANIFEST_NOT_FOUND;
683 parser_.reset(new wgt::parse::WidgetConfigParser());
684 if (!parser_->ParseManifest(widget_path_ / kConfigFileName)) {
685 LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();
686 return common_installer::Step::Status::PARSE_ERROR;
689 WgtBackendData* backend_data =
690 static_cast<WgtBackendData*>(context_->backend_data.get());
692 if (check_start_file_) {
693 if (!parser_->CheckValidStartFile()) {
694 LOG(ERROR) << parser_->GetErrorMessage();
695 return common_installer::Step::Status::PARSE_ERROR;
697 if (!parser_->CheckValidServicesStartFiles()) {
698 LOG(ERROR) << parser_->GetErrorMessage();
699 return common_installer::Step::Status::PARSE_ERROR;
702 // making backup of content data and services content data
704 GetManifestDataForKey<const wgt::parse::ContentInfo>(
705 wgt::application_widget_keys::kTizenContentKey);
707 GetManifestDataForKey<const wgt::parse::ServiceList>(
708 wgt::application_widget_keys::kTizenServiceKey);
710 backend_data->content.set(*content_info);
712 backend_data->service_list.set(*service_list);
715 manifest_x* manifest =
716 static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
717 if (!FillManifestX(manifest)) {
718 LOG(ERROR) << "[Parse] Storing manifest_x failed. "
719 << parser_->GetErrorMessage();
720 return common_installer::Step::Status::PARSE_ERROR;
723 // Copy data from ManifestData to InstallerContext
725 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
726 wgt::application_widget_keys::kTizenApplicationKey);
728 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
729 wgt::application_widget_keys::kTizenWidgetKey);
732 const auto& name_set = wgt_info->name_set();
733 if (name_set.find("") != name_set.end())
734 name = name_set.find("")->second;
735 if (name_set.begin() != name_set.end())
736 name = name_set.begin()->second;
738 std::string short_name;
739 const auto& short_name_set = wgt_info->short_name_set();
740 if (short_name_set.find("") != short_name_set.end())
741 short_name = short_name_set.find("")->second;
742 if (short_name_set.begin() != short_name_set.end())
743 short_name = short_name_set.begin()->second;
745 const std::string& package_version = wgt_info->version();
746 const std::string& required_api_version = info->required_version();
748 manifest->api_version = strdup(required_api_version.c_str());
750 context_->pkgid.set(manifest->package);
752 // write pkgid for recovery file
753 if (context_->recovery_info.get().recovery_file) {
754 context_->recovery_info.get().recovery_file->set_pkgid(manifest->package);
755 context_->recovery_info.get().recovery_file->WriteAndCommitFileContent();
759 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
760 wgt::application_widget_keys::kTizenPermissionsKey);
761 parser::PermissionSet permissions;
763 permissions = perm_info->GetAPIPermissions();
766 GetManifestDataForKey<const wgt::parse::SettingInfo>(
767 wgt::application_widget_keys::kTizenSettingKey);
769 backend_data->settings.set(*settings_info);
771 LOG(DEBUG) << " Read data -[ ";
772 LOG(DEBUG) << "App id: " << info->id();
773 LOG(DEBUG) << " package = " << info->package();
774 LOG(DEBUG) << " id = " << info->id();
775 LOG(DEBUG) << " name = " << name;
776 LOG(DEBUG) << " short_name = " << short_name;
777 LOG(DEBUG) << " aplication version = " << package_version;
778 LOG(DEBUG) << " api_version = " << info->required_version();
779 LOG(DEBUG) << " launch_mode = " << info->launch_mode();
780 LOG(DEBUG) << " privileges -[";
781 for (const auto& p : permissions) {
782 LOG(DEBUG) << " " << p;
787 if (context_->manifest_data.get())
788 pkgmgr_parser_free_manifest_xml(context_->manifest_data.get());
790 context_->manifest_data.set(manifest);
791 return common_installer::Step::Status::OK;
794 bool StepParse::Check(const boost::filesystem::path& widget_path) {
795 LOG(DEBUG) << "unpacked widget path: " << widget_path;
797 widget_path_ = widget_path;
799 boost::filesystem::path config = widget_path / kConfigFileName;
800 LOG(DEBUG) << "config.xml path: " << config;
801 if (!boost::filesystem::exists(config))
806 } // namespace configuration