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";
56 const char kDownloadableFontCategoryName[] =
57 "http://tizen.org/category/downloadable_font";
58 const char kTTSCategoryName[] = "http://tizen.org/category/tts";
60 const char kResWgt[] = "res/wgt";
61 const char kConfigFileName[] = "config.xml";
63 GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) {
64 GList* list = nullptr;
65 for (auto& meta : meta_info.metadata()) {
66 metadata_x* new_meta =
67 static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
68 new_meta->key = strdup(meta.first.c_str());
69 if (!meta.second.empty())
70 new_meta->value = strdup(meta.second.c_str());
71 list = g_list_append(list, new_meta);
76 void AppendWidgetMetadata(GList** metadatas,
77 const std::vector<std::pair<std::string, std::string>> metadata) {
78 GList* list = *metadatas;
79 for (auto& meta : metadata) {
80 metadata_x* new_meta = static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
81 new_meta->key = strdup(meta.first.c_str());
82 if (!meta.second.empty())
83 new_meta->value = strdup(meta.second.c_str());
85 list = g_list_append(list, new_meta);
91 void SetApplicationXDefaults(application_x* application) {
92 application->effectimage_type = strdup("image");
93 application->enabled = strdup("true");
94 application->guestmode_visibility = strdup("true");
95 application->hwacceleration = strdup("default");
96 application->indicatordisplay = strdup("true");
97 application->launchcondition = strdup("false");
98 application->permission_type = strdup("normal");
99 application->process_pool = strdup("false");
100 application->recentimage = strdup("false");
101 application->screenreader = strdup("use-system-setting");
102 application->submode = strdup("false");
103 application->support_disable = strdup("false");
104 application->ui_gadget = strdup("false");
105 application->multiple = strdup("false");
109 void AppendLabel(T* root, const std::string& label,
110 const std::string& locale) {
111 label_x* label_item = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
112 label_item->name = strdup(label.c_str());
113 label_item->text = strdup(label.c_str());
114 label_item->lang = !locale.empty() ?
115 strdup(locale.c_str()) : strdup(DEFAULT_LOCALE);
116 root->label = g_list_append(root->label, label_item);
121 namespace configuration {
123 namespace app_keys = wgt::application_widget_keys;
124 namespace sc = std::chrono;
126 StepParse::StepParse(common_installer::InstallerContext* context,
127 ConfigLocation config_location,
128 bool check_start_file)
130 config_location_(config_location),
131 check_start_file_(check_start_file) {
134 std::set<std::string> StepParse::ExtractPrivileges(
135 std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info) const {
136 return perm_info->GetAPIPermissions();
139 std::string StepParse::GetPackageVersion(
140 const std::string& manifest_version) {
141 if (manifest_version.empty()) {
142 return kManifestVersion;
144 std::string version = manifest_version.substr(0,
145 manifest_version.find_first_not_of("1234567890."));
150 bool StepParse::FillInstallationInfo(manifest_x* manifest) {
151 manifest->root_path = strdup(
152 (context_->root_application_path.get() / manifest->package).c_str());
153 manifest->installed_time =
154 strdup(std::to_string(sc::system_clock::to_time_t(
155 sc::system_clock::now())).c_str());
159 bool StepParse::FillIconPaths(manifest_x* manifest) {
161 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
162 app_keys::kTizenApplicationKey);
164 LOG(ERROR) << "Application info manifest data has not been found.";
168 GetManifestDataForKey<const wgt::parse::ApplicationIconsInfo>(
169 app_keys::kIconsKey);
171 icons_info.reset(new wgt::parse::ApplicationIconsInfo());
173 wgt::parse::LocalizedApplicationIconsInfo localized_list =
174 wgt::parse::GetLocalizedIconList(*icons_info, widget_path_);
175 // We need to generate icon for each locale and icons are already set into
176 // lookup order. There isn't said that all icons should be received from
177 // one <icon> tag position so we iterate utils we run out of icons creating
178 // any icon element that are possible for given locale.
179 std::set<std::string> found_locales;
180 for (auto& application_icon : localized_list) {
181 const std::string& locale = application_icon.locale();
182 if (found_locales.find(locale) != found_locales.end())
184 found_locales.insert(locale);
186 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
187 bf::path icon_path = context_->root_application_path.get()
188 / app_info->package() / "res" / "wgt" / application_icon.path();
189 icon->text = strdup(icon_path.c_str());
191 icon->lang = strdup(locale.c_str());
193 icon->lang = strdup(DEFAULT_LOCALE);
194 manifest->icon = g_list_append(manifest->icon, icon);
199 bool StepParse::FillWidgetInfo(manifest_x* manifest) {
201 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
202 app_keys::kWidgetKey);
204 if (!wgt_info.get()) {
205 LOG(ERROR) << "Widget info manifest data has not been found.";
209 const std::string& version = wgt_info->version();
211 manifest->ns = strdup(kTizenPackageXmlNamespace);
212 manifest->version = strdup(GetPackageVersion(version).c_str());
214 for (auto& item : wgt_info->description_set()) {
215 description_x* description = reinterpret_cast<description_x*>
216 (calloc(1, sizeof(description_x)));
217 description->text = strdup(item.second.c_str());
218 description->lang = !item.first.empty() ?
219 strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
220 manifest->description = g_list_append(manifest->description, description);
223 for (auto& item : wgt_info->name_set()) {
224 AppendLabel(manifest, item.second, item.first);
227 manifest->type = strdup("wgt");
228 manifest->appsetting = strdup("false");
229 manifest->nodisplay_setting = strdup("false");
230 if (context_->is_preload_request.get())
231 manifest->preload = strdup("true");
233 manifest->preload = strdup("false");
234 manifest->installed_storage = strdup("installed_internal");
236 // For wgt package use the long name
238 reinterpret_cast<application_x*>(manifest->application->data);
239 for (auto& item : wgt_info->name_set()) {
240 AppendLabel(app, item.second, item.first);
243 author_x* author = reinterpret_cast<author_x*>(calloc(1, sizeof(author_x)));
244 if (!wgt_info->author().empty())
245 author->text = strdup(wgt_info->author().c_str());
246 if (!wgt_info->author_email().empty())
247 author->email = strdup(wgt_info->author_email().c_str());
248 if (!wgt_info->author_href().empty())
249 author->href = strdup(wgt_info->author_href().c_str());
250 author->lang = strdup(DEFAULT_LOCALE);
251 manifest->author = g_list_append(manifest->author, author);
254 GetManifestDataForKey<const wgt::parse::SettingInfo>(
255 wgt::application_widget_keys::kTizenSettingKey);
257 switch (settings_info->install_location()) {
258 case wgt::parse::SettingInfo::InstallLocation::AUTO: {
259 manifest->installlocation = strdup("auto");
262 case wgt::parse::SettingInfo::InstallLocation::INTERNAL: {
263 manifest->installlocation = strdup("internal-only");
266 case wgt::parse::SettingInfo::InstallLocation::EXTERNAL: {
267 manifest->installlocation = strdup("prefer-external");
272 manifest->installlocation = strdup("auto");
278 bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
280 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
281 app_keys::kTizenApplicationKey);
283 LOG(ERROR) << "Application info manifest data has not been found.";
286 bool has_watch_category = false;
287 bool has_ime = false;
288 bool has_downloadable_font = false;
289 bool has_tts = false;
291 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
292 app_keys::kTizenCategoryKey);
295 has_watch_category = std::find_if(category_info->categories.begin(),
296 category_info->categories.end(),
297 [](const std::string& category) {
298 return category == kCategoryWearableClock ||
299 category == kCategoryWatchClock;
300 }) != category_info->categories.end();
301 has_ime = std::find(category_info->categories.begin(),
302 category_info->categories.end(),
304 != category_info->categories.end();
305 has_downloadable_font = std::find(category_info->categories.begin(),
306 category_info->categories.end(),
307 kDownloadableFontCategoryName)
308 != category_info->categories.end();
309 has_tts = std::find(category_info->categories.begin(),
310 category_info->categories.end(),
312 != category_info->categories.end();
316 application_x* application = reinterpret_cast<application_x*>(
317 calloc(1, sizeof(application_x)));
318 application->component_type =
319 has_watch_category ? strdup("watchapp") : strdup("uiapp");
320 application->mainapp = strdup("true");
321 application->appid = strdup(app_info->id().c_str());
323 GetManifestDataForKey<const wgt::parse::SettingInfo>(
324 wgt::application_widget_keys::kTizenSettingKey);
326 bool no_display = settings_info ? settings_info->no_display() : false;
327 bool has_no_display_category =
328 has_watch_category || has_ime || has_tts || has_downloadable_font;
330 application->nodisplay = (has_no_display_category || no_display) ?
331 strdup("true") : strdup("false");
332 application->taskmanage = has_no_display_category ? strdup("false") :
335 SetApplicationXDefaults(application);
336 if (has_watch_category)
337 application->ambient_support =
338 strdup(app_info->ambient_support() ? "true" : "false");
340 application->ambient_support = strdup("false");
341 application->package = strdup(app_info->package().c_str());
344 strdup((context_->root_application_path.get() / app_info->package()
345 / "bin" / application->appid).c_str());
346 application->type = strdup("webapp");
347 application->onboot = strdup("false");
348 application->autorestart = strdup("false");
350 application->launch_mode = strdup(app_info->launch_mode().c_str());
351 for (auto& icon : GListRange<icon_x*>(manifest->icon)) {
352 icon_x* app_icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
353 app_icon->text = strdup(icon->text);
354 app_icon->lang = strdup(icon->lang);
355 application->icon = g_list_append(application->icon, app_icon);
357 // guarantees that the main app will be at the begining of the list
358 manifest->application = g_list_insert(manifest->application, application, 0);
360 manifest->package = strdup(app_info->package().c_str());
361 manifest->mainapp_id = strdup(app_info->id().c_str());
365 bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
367 GetManifestDataForKey<const wgt::parse::ServiceList>(
368 app_keys::kTizenServiceKey);
371 for (auto& service_info : service_list->services) {
372 application_x* application = reinterpret_cast<application_x*>
373 (calloc(1, sizeof(application_x)));
374 application->component_type = strdup("svcapp");
375 application->mainapp = strdup("false");
376 application->appid = strdup(service_info.id().c_str());
378 strdup((context_->root_application_path.get() / manifest->package
379 / "bin" / application->appid).c_str());
380 application->type = strdup("webapp");
381 application->onboot =
382 service_info.on_boot() ? strdup("true") : strdup("false");
383 application->autorestart =
384 service_info.auto_restart() ? strdup("true") : strdup("false");
385 application->nodisplay = strdup("false");
386 application->taskmanage = strdup("true");
387 SetApplicationXDefaults(application);
388 application->ambient_support = strdup("false");
389 application->package = strdup(manifest->package);
391 for (auto& pair : service_info.names()) {
392 AppendLabel(application, pair.second, pair.first);
395 if (!service_info.icon().empty()) {
396 bf::path icon_path = context_->root_application_path.get()
397 / manifest->package / "res" / "wgt" / service_info.icon();
398 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
399 icon->text = strdup(icon_path.c_str());
400 icon->lang = strdup(DEFAULT_LOCALE);
401 application->icon = g_list_append(application->icon, icon);
404 for (auto& category : service_info.categories()) {
405 application->category = g_list_append(application->category,
406 strdup(category.c_str()));
409 for (auto& pair : service_info.metadata_set()) {
410 metadata_x* item = reinterpret_cast<metadata_x*>(
411 calloc(1, sizeof(metadata_x)));
412 item->key = strdup(pair.first.c_str());
413 if (!pair.second.empty())
414 item->value = strdup(pair.second.c_str());
415 application->metadata = g_list_append(application->metadata, item);
418 manifest->application = g_list_append(manifest->application, application);
423 bool StepParse::FillWidgetApplicationInfo(manifest_x* manifest) {
424 auto appwidget_info =
425 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
426 wgt::application_widget_keys::kTizenAppWidgetFullKey);
429 for (auto& app_widget : appwidget_info->app_widgets()) {
430 application_x* application = reinterpret_cast<application_x*>
431 (calloc(1, sizeof(application_x)));
432 application->component_type = strdup("widgetapp");
433 application->mainapp = strdup("false");
434 application->appid = strdup(app_widget.id.c_str());
436 strdup((context_->root_application_path.get() / manifest->package
437 / "bin" / application->appid).c_str());
438 application->type = strdup("webapp");
439 application->nodisplay = strdup("true");
440 application->taskmanage = strdup("false");
441 SetApplicationXDefaults(application);
442 application->ambient_support = strdup("false");
443 application->package = strdup(manifest->package);
445 if (!app_widget.label.default_value.empty()) {
446 AppendLabel(application, app_widget.label.default_value, std::string());
449 for (auto& pair : app_widget.label.lang_value_map) {
450 AppendLabel(application, pair.second, pair.first);
453 if (!app_widget.icon_src.empty()) {
454 icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
455 icon->text = strdup(app_widget.icon_src.c_str());
456 icon->lang = strdup(DEFAULT_LOCALE);
457 application->icon = g_list_append(application->icon, icon);
460 if (!app_widget.metadata.empty())
461 AppendWidgetMetadata(&application->metadata, app_widget.metadata);
463 manifest->application = g_list_append(manifest->application, application);
469 bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) {
470 auto manifest_data = parser_->GetManifestData(
471 app_keys::kTizenBackgroundCategoryKey);
472 std::shared_ptr<const wgt::parse::BackgroundCategoryInfoList> bc_list =
473 std::static_pointer_cast<const wgt::parse::BackgroundCategoryInfoList>(
480 reinterpret_cast<application_x*>(manifest->application->data);
482 for (auto& background_category : bc_list->background_categories) {
483 app->background_category = g_list_append(
484 app->background_category, strdup(background_category.value().c_str()));
490 bool StepParse::FillAppControl(manifest_x* manifest) {
492 GetManifestDataForKey<const wgt::parse::AppControlInfoList>(
493 app_keys::kTizenApplicationAppControlsKey);
496 reinterpret_cast<application_x*>(manifest->application->data);
498 for (const auto& control : app_info_list->controls) {
499 appcontrol_x* app_control =
500 static_cast<appcontrol_x*>(calloc(1, sizeof(appcontrol_x)));
501 app_control->operation = strdup(control.operation().c_str());
502 app_control->mime = strdup(control.mime().c_str());
503 app_control->uri = strdup(control.uri().c_str());
504 app->appcontrol = g_list_append(app->appcontrol, app_control);
510 bool StepParse::FillPrivileges(manifest_x* manifest) {
512 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
513 app_keys::kTizenPermissionsKey);
514 std::set<std::string> privileges;
516 privileges = ExtractPrivileges(perm_info);
518 for (auto& priv : privileges) {
519 manifest->privileges =
520 g_list_append(manifest->privileges, strdup(priv.c_str()));
525 bool StepParse::FillCategories(manifest_x* manifest) {
527 GetManifestDataForKey<const wgt::parse::CategoryInfoList>(
528 app_keys::kTizenCategoryKey);
533 reinterpret_cast<application_x*>(manifest->application->data);
534 // there is one app atm
535 for (auto& category : category_info->categories) {
536 app->category = g_list_append(app->category, strdup(category.c_str()));
541 bool StepParse::FillMetadata(manifest_x* manifest) {
543 GetManifestDataForKey<const wgt::parse::MetaDataInfo>(
544 app_keys::kTizenMetaDataKey);
548 for (application_x* app : GListRange<application_x*>(manifest->application)) {
549 app->metadata = GenerateMetadataListX(*meta_info);
554 bool StepParse::FillAppWidget() {
555 // This is needed to store preview icons which are not saved into manifest_x
556 WgtBackendData* backend_data =
557 static_cast<WgtBackendData*>(context_->backend_data.get());
559 auto appwidget_info =
560 GetManifestDataForKey<const wgt::parse::AppWidgetInfo>(
561 wgt::application_widget_keys::kTizenAppWidgetFullKey);
563 backend_data->appwidgets.set(*appwidget_info);
567 bool StepParse::FillAccounts(manifest_x* manifest) {
569 GetManifestDataForKey<const wgt::parse::AccountInfo>(
570 app_keys::kAccountKey);
573 common_installer::AccountInfo info;
574 for (auto& account : account_info->accounts()) {
575 common_installer::SingleAccountInfo single_info;
576 single_info.capabilities = account.capabilities;
577 single_info.icon_paths = account.icon_paths;
578 single_info.multiple_account_support = account.multiple_account_support;
579 single_info.names = account.names;
580 // wgt can contain only one app so this assumes mainapp_id is valid here
581 single_info.appid = manifest->mainapp_id;
582 info.set_account(single_info);
584 context_->manifest_plugins_data.get().account_info.set(info);
588 bool StepParse::FillImeInfo() {
590 GetManifestDataForKey<const wgt::parse::ImeInfo>(
591 app_keys::kTizenImeKey);
595 common_installer::ImeInfo info;
596 info.setUuid(ime_info->uuid());
598 const auto &languages = ime_info->languages();
599 for (const auto &language : languages)
600 info.AddLanguage(language);
602 context_->manifest_plugins_data.get().ime_info.set(std::move(info));
606 bool StepParse::FillExtraManifestInfo(manifest_x* manifest) {
607 return FillAccounts(manifest) && FillImeInfo() && FillAppWidget();
610 bool StepParse::FillManifestX(manifest_x* manifest) {
611 // Fill data for main application
612 if (!FillIconPaths(manifest))
614 if (!FillMainApplicationInfo(manifest))
616 if (!FillWidgetInfo(manifest))
618 if (!FillInstallationInfo(manifest))
620 if (!FillPrivileges(manifest))
622 if (!FillAppControl(manifest))
624 if (!FillCategories(manifest))
626 if (!FillMetadata(manifest))
628 if (!FillBackgroundCategoryInfo(manifest))
631 // Fill data for other applications
632 if (!FillAdditionalApplications(manifest))
635 // Fill extra data, other than manifest_x structure
636 if (!FillExtraManifestInfo(manifest))
643 bool StepParse::FillAdditionalApplications(manifest_x* manifest) {
644 if (!FillServiceApplicationInfo(manifest))
646 if (!FillWidgetApplicationInfo(manifest))
651 bool StepParse::LocateConfigFile() {
652 switch (config_location_) {
653 case ConfigLocation::PACKAGE:
654 return StepParse::Check(context_->unpacked_dir_path.get());
655 case ConfigLocation::INSTALLED:
656 return StepParse::Check(context_->pkg_path.get() / kResWgt);
657 case ConfigLocation::RECOVERY:
658 if (StepParse::Check(common_installer::GetBackupPathForPackagePath(
659 context_->root_application_path.get()
660 / context_->pkgid.get()) / kResWgt))
662 if (StepParse::Check(
663 context_->root_application_path.get()
664 / context_->pkgid.get() / kResWgt))
667 case ConfigLocation::RESOURCE_WGT:
668 return StepParse::Check(context_->unpacked_dir_path.get() / kResWgt);
670 LOG(ERROR) << "Unknown config location";
675 common_installer::Step::Status StepParse::process() {
676 if (!LocateConfigFile()) {
677 LOG(ERROR) << "No config.xml";
678 return common_installer::Step::Status::MANIFEST_NOT_FOUND;
681 parser_.reset(new wgt::parse::WidgetConfigParser());
682 if (!parser_->ParseManifest(widget_path_ / kConfigFileName)) {
683 LOG(ERROR) << "[Parse] Parse failed. " << parser_->GetErrorMessage();
684 return common_installer::Step::Status::PARSE_ERROR;
687 WgtBackendData* backend_data =
688 static_cast<WgtBackendData*>(context_->backend_data.get());
690 if (check_start_file_) {
691 if (!parser_->CheckValidStartFile()) {
692 LOG(ERROR) << parser_->GetErrorMessage();
693 return common_installer::Step::Status::PARSE_ERROR;
695 if (!parser_->CheckValidServicesStartFiles()) {
696 LOG(ERROR) << parser_->GetErrorMessage();
697 return common_installer::Step::Status::PARSE_ERROR;
700 // making backup of content data and services content data
702 GetManifestDataForKey<const wgt::parse::ContentInfo>(
703 wgt::application_widget_keys::kTizenContentKey);
705 GetManifestDataForKey<const wgt::parse::ServiceList>(
706 wgt::application_widget_keys::kTizenServiceKey);
708 backend_data->content.set(*content_info);
710 backend_data->service_list.set(*service_list);
713 manifest_x* manifest =
714 static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
715 if (!FillManifestX(manifest)) {
716 LOG(ERROR) << "[Parse] Storing manifest_x failed. "
717 << parser_->GetErrorMessage();
718 return common_installer::Step::Status::PARSE_ERROR;
721 // Copy data from ManifestData to InstallerContext
723 GetManifestDataForKey<const wgt::parse::TizenApplicationInfo>(
724 wgt::application_widget_keys::kTizenApplicationKey);
726 GetManifestDataForKey<const wgt::parse::WidgetInfo>(
727 wgt::application_widget_keys::kTizenWidgetKey);
730 const auto& name_set = wgt_info->name_set();
731 if (name_set.find("") != name_set.end())
732 name = name_set.find("")->second;
733 if (name_set.begin() != name_set.end())
734 name = name_set.begin()->second;
736 std::string short_name;
737 const auto& short_name_set = wgt_info->short_name_set();
738 if (short_name_set.find("") != short_name_set.end())
739 short_name = short_name_set.find("")->second;
740 if (short_name_set.begin() != short_name_set.end())
741 short_name = short_name_set.begin()->second;
743 const std::string& package_version = wgt_info->version();
744 const std::string& required_api_version = info->required_version();
746 manifest->api_version = strdup(required_api_version.c_str());
748 context_->pkgid.set(manifest->package);
750 // write pkgid for recovery file
751 if (context_->recovery_info.get().recovery_file) {
752 context_->recovery_info.get().recovery_file->set_pkgid(manifest->package);
753 context_->recovery_info.get().recovery_file->WriteAndCommitFileContent();
757 GetManifestDataForKey<const wgt::parse::PermissionsInfo>(
758 wgt::application_widget_keys::kTizenPermissionsKey);
759 parser::PermissionSet permissions;
761 permissions = perm_info->GetAPIPermissions();
764 GetManifestDataForKey<const wgt::parse::SettingInfo>(
765 wgt::application_widget_keys::kTizenSettingKey);
767 backend_data->settings.set(*settings_info);
769 LOG(DEBUG) << " Read data -[ ";
770 LOG(DEBUG) << "App id: " << info->id();
771 LOG(DEBUG) << " package = " << info->package();
772 LOG(DEBUG) << " id = " << info->id();
773 LOG(DEBUG) << " name = " << name;
774 LOG(DEBUG) << " short_name = " << short_name;
775 LOG(DEBUG) << " aplication version = " << package_version;
776 LOG(DEBUG) << " api_version = " << info->required_version();
777 LOG(DEBUG) << " launch_mode = " << info->launch_mode();
778 LOG(DEBUG) << " privileges -[";
779 for (const auto& p : permissions) {
780 LOG(DEBUG) << " " << p;
785 if (context_->manifest_data.get())
786 pkgmgr_parser_free_manifest_xml(context_->manifest_data.get());
788 context_->manifest_data.set(manifest);
789 return common_installer::Step::Status::OK;
792 bool StepParse::Check(const boost::filesystem::path& widget_path) {
793 LOG(DEBUG) << "unpacked widget path: " << widget_path;
795 widget_path_ = widget_path;
797 boost::filesystem::path config = widget_path / kConfigFileName;
798 LOG(DEBUG) << "config.xml path: " << config;
799 if (!boost::filesystem::exists(config))
804 } // namespace configuration