Generate deviceprofile list for tpk 81/53281/8
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 3 Dec 2015 08:52:40 +0000 (09:52 +0100)
committerPawel Sikorski <p.sikorski@samsung.com>
Wed, 9 Dec 2015 14:32:05 +0000 (06:32 -0800)
Requires:
 - https://review.tizen.org/gerrit/53280
 - https://review.tizen.org/gerrit/53288

Change-Id: Ic166436b24531b42166328e5651876db7f938850

src/common/step/step_generate_xml.cc
src/tpk/step/step_parse.cc

index 53629d8..565257a 100644 (file)
@@ -356,6 +356,14 @@ common_installer::Step::Status StepGenerateXml::process() {
     xmlTextWriterEndElement(writer);
   }
 
+  for (const char* profile :
+       GListRange<char*>(context_->manifest_data.get()->deviceprofile)) {
+    xmlTextWriterStartElement(writer, BAD_CAST "profile");
+    xmlTextWriterWriteAttribute(writer, BAD_CAST "name",
+                                BAD_CAST profile);
+    xmlTextWriterEndElement(writer);
+  }
+
   const auto& shortcuts =
       context_->manifest_plugins_data.get().shortcut_info.get();
   if (!shortcuts.empty()) {
index 850858a..228ded5 100644 (file)
@@ -10,6 +10,7 @@
 #include <tpk_manifest_handlers/description_handler.h>
 #include <tpk_manifest_handlers/package_handler.h>
 #include <tpk_manifest_handlers/privileges_handler.h>
+#include <tpk_manifest_handlers/profile_handler.h>
 #include <tpk_manifest_handlers/service_application_handler.h>
 #include <tpk_manifest_handlers/shortcut_handler.h>
 #include <tpk_manifest_handlers/ui_application_handler.h>
@@ -129,6 +130,16 @@ bool StepParse::FillPackageInfo(manifest_x* manifest) {
   manifest->installlocation = strdup(app_info->install_location().c_str());
   manifest->api_version = strdup(app_info->api_version().c_str());
 
+  std::shared_ptr<const ProfileInfo> profile_info =
+      std::static_pointer_cast<const ProfileInfo>(
+          parser_->GetManifestData(ProfileInfo::Key()));
+  if (profile_info) {
+    for (auto& profile : profile_info->profiles()) {
+      manifest->deviceprofile = g_list_append(manifest->deviceprofile,
+                                              strdup(profile.c_str()));
+    }
+  }
+
   if (ui_application_list) {
     manifest->mainapp_id =
         strdup(ui_application_list->items[0].ui_info.appid().c_str());