saving ime info in the manifest
[platform/core/appfw/wgt-backend.git] / src / wgt / step / configuration / step_parse.cc
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.
5
6 #include "wgt/step/configuration/step_parse.h"
7
8 #include <boost/filesystem/path.hpp>
9
10 #include <common/app_installer.h>
11 #include <common/installer_context.h>
12 #include <common/step/step.h>
13 #include <common/utils/glist_range.h>
14 #include <manifest_parser/utils/version_number.h>
15 #include <wgt_manifest_handlers/account_handler.h>
16 #include <wgt_manifest_handlers/app_control_handler.h>
17 #include <wgt_manifest_handlers/application_icons_handler.h>
18 #include <wgt_manifest_handlers/application_manifest_constants.h>
19 #include <wgt_manifest_handlers/background_category_handler.h>
20 #include <wgt_manifest_handlers/category_handler.h>
21 #include <wgt_manifest_handlers/content_handler.h>
22 #include <wgt_manifest_handlers/metadata_handler.h>
23 #include <wgt_manifest_handlers/service_handler.h>
24 #include <wgt_manifest_handlers/setting_handler.h>
25 #include <wgt_manifest_handlers/tizen_application_handler.h>
26 #include <wgt_manifest_handlers/widget_handler.h>
27 #include <wgt_manifest_handlers/ime_handler.h>
28
29 #include <pkgmgr/pkgmgr_parser.h>
30
31 #include <string.h>
32
33 #include <chrono>
34 #include <cstdio>
35 #include <cstdlib>
36 #include <memory>
37 #include <set>
38 #include <string>
39 #include <vector>
40
41 #include "wgt/wgt_backend_data.h"
42
43 namespace bf = boost::filesystem;
44
45 namespace {
46
47 const char kCategoryWearableClock[] =
48     "http://tizen.org/category/wearable_clock";
49 const char kCategoryWatchClock[] = "com.samsung.wmanager.WATCH_CLOCK";
50
51 const std::string kManifestVersion = "1.0.0";
52 const char kTizenPackageXmlNamespace[] = "http://tizen.org/ns/packages";
53
54 GList* GenerateMetadataListX(const wgt::parse::MetaDataInfo& meta_info) {
55   GList* list = nullptr;
56   for (auto& meta : meta_info.metadata()) {
57     metadata_x* new_meta =
58         static_cast<metadata_x*>(calloc(1, sizeof(metadata_x)));
59     new_meta->key = strdup(meta.first.c_str());
60     if (!meta.second.empty())
61       new_meta->value = strdup(meta.second.c_str());
62     list = g_list_append(list, new_meta);
63   }
64   return list;
65 }
66
67 void SetApplicationXDefaults(application_x* application) {
68   application->effectimage_type = strdup("image");
69   application->enabled = strdup("true");
70   application->guestmode_visibility = strdup("true");
71   application->hwacceleration = strdup("default");
72   application->indicatordisplay = strdup("true");
73   application->launchcondition = strdup("false");
74   application->permission_type = strdup("normal");
75   application->process_pool = strdup("false");
76   application->recentimage = strdup("false");
77   application->screenreader = strdup("use-system-setting");
78   application->submode = strdup("false");
79   application->support_disable = strdup("false");
80   application->taskmanage = strdup("true");
81   application->ui_gadget = strdup("false");
82 }
83
84 }  // namespace
85
86 namespace wgt {
87 namespace configuration {
88
89 namespace app_keys = wgt::application_widget_keys;
90 namespace sc = std::chrono;
91
92 StepParse::StepParse(common_installer::InstallerContext* context,
93                      bool check_start_file)
94     : Step(context),
95       check_start_file_(check_start_file) {
96 }
97
98 std::set<std::string> StepParse::ExtractPrivileges(
99     std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info) const {
100   return perm_info->GetAPIPermissions();
101 }
102
103 std::string StepParse::GetPackageVersion(
104      const std::string& manifest_version) {
105   if (manifest_version.empty()) {
106     return kManifestVersion;
107   }
108   std::string version = manifest_version.substr(0,
109       manifest_version.find_first_not_of("1234567890."));
110
111   utils::VersionNumber version_number(version);
112
113   if (!version_number.IsValidTizenPackageVersion()) {
114     LOG(WARNING) << "Version number: " << manifest_version
115                  << " is not valid version number for tizen package. "
116                  << "Default value will be used.";
117     return kManifestVersion;
118   }
119
120   return version_number.ToString();
121 }
122
123 bool StepParse::FillInstallationInfo(manifest_x* manifest) {
124   manifest->root_path = strdup(
125       (context_->root_application_path.get() / manifest->package).c_str());
126   manifest->installed_time =
127       strdup(std::to_string(sc::system_clock::to_time_t(
128           sc::system_clock::now())).c_str());
129   return true;
130 }
131
132 bool StepParse::FillIconPaths(manifest_x* manifest) {
133   std::shared_ptr<const wgt::parse::TizenApplicationInfo> app_info =
134       std::static_pointer_cast<const wgt::parse::TizenApplicationInfo>(
135           parser_->GetManifestData(app_keys::kTizenApplicationKey));
136   if (!app_info) {
137     LOG(ERROR) << "Application info manifest data has not been found.";
138     return false;
139   }
140   std::shared_ptr<const wgt::parse::ApplicationIconsInfo> icons_info =
141       std::static_pointer_cast<const wgt::parse::ApplicationIconsInfo>(
142           parser_->GetManifestData(app_keys::kIconsKey));
143   if (icons_info.get()) {
144     for (auto& application_icon : icons_info->icons()) {
145       icon_x* icon = reinterpret_cast<icon_x*> (calloc(1, sizeof(icon_x)));
146       bf::path icon_path = context_->root_application_path.get()
147           / app_info->package() / "res" / "wgt" / application_icon.path();
148       icon->text = strdup(icon_path.c_str());
149       icon->lang = strdup(DEFAULT_LOCALE);
150       manifest->icon = g_list_append(manifest->icon, icon);
151     }
152   }
153   return true;
154 }
155
156 bool StepParse::FillWidgetInfo(manifest_x* manifest) {
157   std::shared_ptr<const wgt::parse::WidgetInfo> wgt_info =
158       std::static_pointer_cast<const wgt::parse::WidgetInfo>(
159           parser_->GetManifestData(app_keys::kWidgetKey));
160   if (!wgt_info.get()) {
161     LOG(ERROR) << "Widget info manifest data has not been found.";
162     return false;
163   }
164
165   const std::string& version = wgt_info->version();
166
167   manifest->ns = strdup(kTizenPackageXmlNamespace);
168   manifest->version = strdup(GetPackageVersion(version).c_str());
169
170   for (auto& item : wgt_info->description_set()) {
171     description_x* description = reinterpret_cast<description_x*>
172         (calloc(1, sizeof(description_x)));
173     description->text = strdup(item.second.c_str());
174     description->lang = !item.first.empty() ?
175         strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
176     manifest->description = g_list_append(manifest->description, description);
177   }
178
179   for (auto& item : wgt_info->name_set()) {
180     label_x* label = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
181     label->name = strdup(item.second.c_str());
182     label->text = strdup(item.second.c_str());
183     label->lang = !item.first.empty() ?
184         strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
185     manifest->label = g_list_append(manifest->label, label);
186   }
187
188   manifest->type = strdup("wgt");
189   manifest->appsetting = strdup("false");
190   manifest->nodisplay_setting = strdup("false");
191   manifest->preload = strdup("false");
192
193   // For wgt package use the long name
194   for (auto& item : wgt_info->name_set()) {
195     application_x* app =
196         reinterpret_cast<application_x*>(manifest->application->data);
197     label_x* label = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
198     label->name = strdup(item.second.c_str());
199     label->text = strdup(item.second.c_str());
200     label->lang = !item.first.empty() ?
201         strdup(item.first.c_str()) : strdup(DEFAULT_LOCALE);
202     app->label = g_list_append(app->label, label);
203   }
204
205   author_x* author = reinterpret_cast<author_x*>(calloc(1, sizeof(author_x)));
206   if (!wgt_info->author().empty())
207     author->text = strdup(wgt_info->author().c_str());
208   if (!wgt_info->author_email().empty())
209     author->email = strdup(wgt_info->author_email().c_str());
210   if (!wgt_info->author_href().empty())
211     author->href = strdup(wgt_info->author_href().c_str());
212   author->lang = strdup(DEFAULT_LOCALE);
213   manifest->author = g_list_append(manifest->author, author);
214
215   std::shared_ptr<const wgt::parse::SettingInfo> settings_info =
216       std::static_pointer_cast<const wgt::parse::SettingInfo>(
217           parser_->GetManifestData(
218               wgt::application_widget_keys::kTizenSettingKey));
219   if (settings_info) {
220     switch (settings_info->install_location()) {
221     case wgt::parse::SettingInfo::InstallLocation::AUTO: {
222       manifest->installlocation = strdup("auto");
223       break;
224     }
225     case wgt::parse::SettingInfo::InstallLocation::INTERNAL: {
226       manifest->installlocation = strdup("internal-only");
227       break;
228     }
229     case wgt::parse::SettingInfo::InstallLocation::EXTERNAL: {
230       manifest->installlocation = strdup("prefer-external");
231       break;
232     }
233     }
234   } else {
235     manifest->installlocation = strdup("auto");
236   }
237
238   return true;
239 }
240
241 bool StepParse::FillMainApplicationInfo(manifest_x* manifest) {
242   std::shared_ptr<const wgt::parse::TizenApplicationInfo> app_info =
243       std::static_pointer_cast<const wgt::parse::TizenApplicationInfo>(
244           parser_->GetManifestData(app_keys::kTizenApplicationKey));
245   if (!app_info) {
246     LOG(ERROR) << "Application info manifest data has not been found.";
247     return false;
248   }
249   bool has_watch_catergory = false;
250   std::shared_ptr<const wgt::parse::CategoryInfoList> category_info =
251       std::static_pointer_cast<const wgt::parse::CategoryInfoList>(
252           parser_->GetManifestData(app_keys::kTizenCategoryKey));
253   if (category_info) {
254     has_watch_catergory = std::find_if(category_info->categories.begin(),
255                                        category_info->categories.end(),
256                                        [](const std::string& category) {
257       return category == kCategoryWearableClock ||
258              category == kCategoryWatchClock;
259     }) != category_info->categories.end();
260   }
261
262   // application data
263   application_x* application = reinterpret_cast<application_x*>(
264       calloc(1, sizeof(application_x)));
265   application->component_type =
266       has_watch_catergory ? strdup("watchapp") : strdup("uiapp");
267   application->mainapp = strdup("true");
268   application->nodisplay = strdup("false");
269   application->multiple = strdup("false");
270   application->appid = strdup(app_info->id().c_str());
271   SetApplicationXDefaults(application);
272   if (has_watch_catergory)
273     application->ambient_support =
274         strdup(app_info->ambient_support() ? "true" : "false");
275   else
276     application->ambient_support = strdup("false");
277   application->package = strdup(app_info->package().c_str());
278
279   application->exec =
280       strdup((context_->root_application_path.get() / app_info->package()
281               / "bin" / application->appid).c_str());
282   application->type = strdup("webapp");
283   application->onboot = strdup("false");
284   application->autorestart = strdup("false");
285
286   application->launch_mode = strdup(app_info->launch_mode().c_str());
287   if (manifest->icon) {
288     icon_x* icon = reinterpret_cast<icon_x*>(manifest->icon->data);
289     icon_x* app_icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
290     app_icon->text = strdup(icon->text);
291     app_icon->lang = strdup(icon->lang);
292     application->icon = g_list_append(application->icon, app_icon);
293   }
294   manifest->application = g_list_append(manifest->application, application);
295
296   manifest->package = strdup(app_info->package().c_str());
297   manifest->mainapp_id = strdup(app_info->id().c_str());
298   return true;
299 }
300
301 bool StepParse::FillServiceApplicationInfo(manifest_x* manifest) {
302   std::shared_ptr<const wgt::parse::ServiceList> service_list =
303       std::static_pointer_cast<const wgt::parse::ServiceList>(
304           parser_->GetManifestData(app_keys::kTizenServiceKey));
305   if (!service_list)
306     return true;
307   for (auto& service_info : service_list->services) {
308     application_x* application = reinterpret_cast<application_x*>
309         (calloc(1, sizeof(application_x)));
310     application->component_type = strdup("svcapp");
311     application->mainapp = strdup("false");
312     application->nodisplay = strdup("false");
313     application->multiple = strdup("false");
314     application->appid = strdup(service_info.id().c_str());
315     application->exec =
316         strdup((context_->root_application_path.get() / manifest->package
317                 / "bin" / application->appid).c_str());
318     application->type = strdup("webapp");
319     application->onboot =
320         service_info.on_boot() ? strdup("true") : strdup("false");
321     application->autorestart =
322         service_info.auto_restart() ? strdup("true") : strdup("false");
323     SetApplicationXDefaults(application);
324     application->ambient_support = strdup("false");
325     application->package = strdup(manifest->package);
326
327     for (auto& pair : service_info.names()) {
328       label_x* label = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
329       label->lang = !pair.first.empty() ?
330           strdup(pair.first.c_str()) : strdup(DEFAULT_LOCALE);
331       label->name = strdup(pair.second.c_str());
332       label->text = strdup(pair.second.c_str());
333       application->label = g_list_append(application->label, label);
334     }
335
336     if (!service_info.icon().empty()) {
337       icon_x* icon = reinterpret_cast<icon_x*>(calloc(1, sizeof(icon_x)));
338       icon->text = strdup(service_info.icon().c_str());
339       icon->lang = strdup(DEFAULT_LOCALE);
340       application->icon = g_list_append(application->icon, icon);
341     }
342
343     // TODO(t.iwanek): what about description, how is it different from name?
344
345     for (auto& category : service_info.categories()) {
346       application->category = g_list_append(application->category,
347                                             strdup(category.c_str()));
348     }
349
350     for (auto& pair : service_info.metadata_set()) {
351       metadata_x* item = reinterpret_cast<metadata_x*>(
352           calloc(1, sizeof(metadata_x)));
353       item->key = strdup(pair.first.c_str());
354       if (!pair.second.empty())
355         item->value = strdup(pair.second.c_str());
356       application->metadata = g_list_append(application->metadata, item);
357     }
358
359     manifest->application = g_list_append(manifest->application, application);
360   }
361   return true;
362 }
363
364 bool StepParse::FillBackgroundCategoryInfo(manifest_x* manifest) {
365   auto manifest_data = parser_->GetManifestData(
366       app_keys::kTizenBackgroundCategoryKey);
367   std::shared_ptr<const wgt::parse::BackgroundCategoryInfoList> bc_list =
368       std::static_pointer_cast<const wgt::parse::BackgroundCategoryInfoList>(
369           manifest_data);
370
371   if (!bc_list)
372     return true;
373
374   application_x* app =
375       reinterpret_cast<application_x*>(manifest->application->data);
376
377   for (auto& background_category : bc_list->background_categories) {
378     app->background_category = g_list_append(
379         app->background_category, strdup(background_category.value().c_str()));
380   }
381
382   return true;
383 }
384
385 bool StepParse::FillAppControl(manifest_x* manifest) {
386   std::shared_ptr<const wgt::parse::AppControlInfoList> app_info_list =
387       std::static_pointer_cast<const wgt::parse::AppControlInfoList>(
388           parser_->GetManifestData(app_keys::kTizenApplicationAppControlsKey));
389
390   application_x* app =
391       reinterpret_cast<application_x*>(manifest->application->data);
392   if (app_info_list) {
393     for (const auto& control : app_info_list->controls) {
394       appcontrol_x* app_control =
395           static_cast<appcontrol_x*>(calloc(1, sizeof(appcontrol_x)));
396       app_control->operation = strdup(control.operation().c_str());
397       app_control->mime = strdup(control.mime().c_str());
398       app_control->uri = strdup(control.uri().c_str());
399       app->appcontrol = g_list_append(app->appcontrol, app_control);
400     }
401   }
402   return true;
403 }
404
405 bool StepParse::FillPrivileges(manifest_x* manifest) {
406   std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info =
407       std::static_pointer_cast<const wgt::parse::PermissionsInfo>(
408           parser_->GetManifestData(app_keys::kTizenPermissionsKey));
409   std::set<std::string> privileges;
410   if (perm_info)
411     privileges = ExtractPrivileges(perm_info);
412
413   for (auto& priv : privileges) {
414     manifest->privileges =
415         g_list_append(manifest->privileges, strdup(priv.c_str()));
416   }
417   return true;
418 }
419
420 bool StepParse::FillCategories(manifest_x* manifest) {
421   std::shared_ptr<const wgt::parse::CategoryInfoList> category_info =
422       std::static_pointer_cast<const wgt::parse::CategoryInfoList>(
423           parser_->GetManifestData(app_keys::kTizenCategoryKey));
424   if (!category_info)
425     return true;
426
427   application_x* app =
428       reinterpret_cast<application_x*>(manifest->application->data);
429   // there is one app atm
430   for (auto& category : category_info->categories) {
431     app->category = g_list_append(app->category, strdup(category.c_str()));
432   }
433   return true;
434 }
435
436 bool StepParse::FillMetadata(manifest_x* manifest) {
437   std::shared_ptr<const wgt::parse::MetaDataInfo> meta_info =
438       std::static_pointer_cast<const wgt::parse::MetaDataInfo>(
439           parser_->GetManifestData(app_keys::kTizenMetaDataKey));
440   if (!meta_info)
441     return true;
442
443   for (application_x* app : GListRange<application_x*>(manifest->application)) {
444     app->metadata = GenerateMetadataListX(*meta_info);
445   }
446   return true;
447 }
448
449 bool StepParse::FillAccounts(manifest_x* manifest) {
450   std::shared_ptr<const wgt::parse::AccountInfo> account_info =
451       std::static_pointer_cast<const wgt::parse::AccountInfo>(
452           parser_->GetManifestData(app_keys::kAccountKey));
453   if (!account_info)
454     return true;
455   common_installer::AccountInfo info;
456   for (auto& account : account_info->accounts()) {
457     common_installer::SingleAccountInfo single_info;
458     single_info.capabilities = account.capabilities;
459     single_info.icon_paths = account.icon_paths;
460     single_info.multiple_account_support = account.multiple_account_support;
461     single_info.names = account.names;
462     // wgt can contain only one app so this assumes mainapp_id is valid here
463     single_info.appid = manifest->mainapp_id;
464     info.set_account(single_info);
465   }
466   context_->manifest_plugins_data.get().account_info.set(info);
467   return true;
468 }
469
470 bool StepParse::FillImeInfo() {
471   const auto ime_info = std::static_pointer_cast<const wgt::parse::ImeInfo>(
472       parser_->GetManifestData(app_keys::kTizenImeKey));
473   if (!ime_info)
474     return true;
475
476   common_installer::ImeInfo info;
477   info.setUuid(ime_info->uuid());
478
479   const auto &languages = ime_info->languages();
480   for (const auto &language : languages)
481     info.AddLanguage(language);
482
483   context_->manifest_plugins_data.get().ime_info.set(std::move(info));
484   return true;
485 }
486
487 bool StepParse::FillExtraManifestInfo(manifest_x* manifest) {
488   return FillAccounts(manifest) && FillImeInfo();
489 }
490
491 bool StepParse::FillManifestX(manifest_x* manifest) {
492   if (!FillIconPaths(manifest))
493     return false;
494   if (!FillMainApplicationInfo(manifest))
495     return false;
496   if (!FillWidgetInfo(manifest))
497     return false;
498   if (!FillInstallationInfo(manifest))
499     return false;
500   if (!FillPrivileges(manifest))
501     return false;
502   if (!FillAppControl(manifest))
503     return false;
504   if (!FillCategories(manifest))
505     return false;
506   if (!FillMetadata(manifest))
507     return false;
508   // TODO(t.iwanek): fix adding ui application element
509   // for now adding application service is added here because rest of code
510   // assumes that there is one application at manifest->application
511   // so this must execute last
512   if (!FillServiceApplicationInfo(manifest))
513     return false;
514   if (!FillBackgroundCategoryInfo(manifest))
515     return false;
516   if (!FillExtraManifestInfo(manifest))
517     return false;
518   return true;
519 }
520
521 bool StepParse::LocateConfigFile() {
522   return StepParse::Check(context_->unpacked_dir_path.get());
523 }
524
525 common_installer::Step::Status StepParse::process() {
526   if (!LocateConfigFile()) {
527     LOG(ERROR) << "No config.xml";
528     return common_installer::Step::Status::MANIFEST_NOT_FOUND;
529   }
530
531   parser_.reset(new wgt::parse::WidgetConfigParser());
532   if (!parser_->ParseManifest(config_)) {
533     LOG(ERROR) << "[Parse] Parse failed. " <<  parser_->GetErrorMessage();
534     return common_installer::Step::Status::PARSE_ERROR;
535   }
536   if (check_start_file_) {
537     if (!parser_->HasValidStartFile()) {
538       LOG(ERROR) << parser_->GetErrorMessage();
539       return common_installer::Step::Status::PARSE_ERROR;
540     }
541     if (!parser_->HasValidServicesStartFiles()) {
542       LOG(ERROR) << parser_->GetErrorMessage();
543       return common_installer::Step::Status::PARSE_ERROR;
544     }
545   }
546
547   manifest_x* manifest =
548       static_cast<manifest_x*>(calloc(1, sizeof(manifest_x)));
549   if (!FillManifestX(manifest)) {
550     LOG(ERROR) << "[Parse] Storing manifest_x failed. "
551                <<  parser_->GetErrorMessage();
552     return common_installer::Step::Status::PARSE_ERROR;
553   }
554
555   // Copy data from ManifestData to InstallerContext
556   std::shared_ptr<const wgt::parse::TizenApplicationInfo> info =
557       std::static_pointer_cast<const wgt::parse::TizenApplicationInfo>(
558           parser_->GetManifestData(
559               wgt::application_widget_keys::kTizenApplicationKey));
560   std::shared_ptr<const wgt::parse::WidgetInfo> wgt_info =
561       std::static_pointer_cast<const wgt::parse::WidgetInfo>(
562           parser_->GetManifestData(
563               wgt::application_widget_keys::kTizenWidgetKey));
564
565   std::string name;
566   const auto& name_set = wgt_info->name_set();
567   if (name_set.find("") != name_set.end())
568     name = name_set.find("")->second;
569   if (name_set.begin() != name_set.end())
570     name = name_set.begin()->second;
571
572   std::string short_name;
573   const auto& short_name_set = wgt_info->short_name_set();
574   if (short_name_set.find("") != short_name_set.end())
575     short_name = short_name_set.find("")->second;
576   if (short_name_set.begin() != short_name_set.end())
577     short_name = short_name_set.begin()->second;
578
579   const std::string& package_version = wgt_info->version();
580   const std::string& required_api_version = info->required_version();
581
582   manifest->api_version = strdup(required_api_version.c_str());
583
584   context_->pkgid.set(manifest->package);
585
586   // write pkgid for recovery file
587   if (context_->recovery_info.get().recovery_file) {
588     context_->recovery_info.get().recovery_file->set_pkgid(manifest->package);
589     context_->recovery_info.get().recovery_file->WriteAndCommitFileContent();
590   }
591
592   std::shared_ptr<const wgt::parse::PermissionsInfo> perm_info =
593       std::static_pointer_cast<const wgt::parse::PermissionsInfo>(
594           parser_->GetManifestData(
595               wgt::application_widget_keys::kTizenPermissionsKey));
596   parser::PermissionSet permissions;
597   if (perm_info)
598      permissions = perm_info->GetAPIPermissions();
599
600   WgtBackendData* backend_data =
601       static_cast<WgtBackendData*>(context_->backend_data.get());
602
603   std::shared_ptr<const wgt::parse::SettingInfo> settings_info =
604       std::static_pointer_cast<const wgt::parse::SettingInfo>(
605           parser_->GetManifestData(
606               wgt::application_widget_keys::kTizenSettingKey));
607   if (settings_info)
608     backend_data->settings.set(*settings_info);
609
610   LOG(DEBUG) << " Read data -[ ";
611   LOG(DEBUG) << "App id: " << info->id();
612   LOG(DEBUG) << "  package     = " <<  info->package();
613   LOG(DEBUG) << "  id          = " <<  info->id();
614   LOG(DEBUG) << "  name        = " <<  name;
615   LOG(DEBUG) << "  short_name  = " <<  short_name;
616   LOG(DEBUG) << "  aplication version     = " <<  package_version;
617   LOG(DEBUG) << "  api_version = " <<  info->required_version();
618   LOG(DEBUG) << "  launch_mode = " <<  info->launch_mode();
619   LOG(DEBUG) << "  privileges -[";
620   for (const auto& p : permissions) {
621     LOG(DEBUG) << "    " << p;
622   }
623   LOG(DEBUG) << "  ]-";
624   LOG(DEBUG) << "]-";
625
626   // TODO(t.iwanek): In delta mode this step is running two times
627   if (context_->manifest_data.get())
628     pkgmgr_parser_free_manifest_xml(context_->manifest_data.get());
629
630   context_->manifest_data.set(manifest);
631   return common_installer::Step::Status::OK;
632 }
633
634 bool StepParse::Check(const boost::filesystem::path& widget_path) {
635   boost::filesystem::path config = widget_path / "config.xml";
636
637   LOG(DEBUG) << "config.xml path: " << config;
638
639   if (!boost::filesystem::exists(config))
640     return false;
641
642   config_ = config;
643   return true;
644 }
645
646 }  // namespace configuration
647 }  // namespace wgt