Parse icon for robotapp
[platform/core/appfw/app-installers.git] / src / common / step / configuration / step_parse_manifest.cc
index 2bf1007..a12a8cc 100644 (file)
@@ -4,21 +4,22 @@
 
 #include "common/step/configuration/step_parse_manifest.h"
 
-#include <boost/tokenizer.hpp>
-
 #include <pkgmgr/pkgmgr_parser.h>
 #include <pkgmgr-info.h>
 
-#include <tpk_manifest_handlers/account_handler.h>
-#include <tpk_manifest_handlers/common/appdefined_privilege_handler.h>
+#include <tpk_manifest_handlers/appdefined_privilege_handler.h>
 #include <tpk_manifest_handlers/application_manifest_constants.h>
 #include <tpk_manifest_handlers/author_handler.h>
+#include <tpk_manifest_handlers/component_based_application_handler.h>
+#include <tpk_manifest_handlers/dependencies_handler.h>
 #include <tpk_manifest_handlers/description_handler.h>
 #include <tpk_manifest_handlers/feature_handler.h>
+#include <tpk_manifest_handlers/light_user_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/provides_appdefined_privileges_handler.h>
+#include <tpk_manifest_handlers/robot_application_handler.h>
 #include <tpk_manifest_handlers/service_application_handler.h>
 #include <tpk_manifest_handlers/shortcut_handler.h>
 #include <tpk_manifest_handlers/trust_anchor_handler.h>
 #include <tpk_manifest_handlers/watch_application_handler.h>
 #include <tpk_manifest_handlers/widget_application_handler.h>
 
-#include <chrono>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
+#include <filesystem>
 #include <memory>
+#include <regex>
 #include <set>
 #include <type_traits>
 #include <string>
 #include <vector>
 
-#include "common/app2ext_dynamic_service.h"
-#include "common/app_installer.h"
 #include "common/feature_validator.h"
 #include "common/installer_context.h"
-#include "common/paths.h"
+#include "common/utils/paths.h"
 #include "common/privileges.h"
 #include "common/pkgmgr_registration.h"
-#include "common/pkgmgr_query.h"
+#include "common/utils/pkgmgr_query.h"
 #include "common/step/step.h"
 #include "common/utils/glist_range.h"
+#include "common/utils/time_util.h"
 
 namespace app_keys = tpk::application_keys;
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace {
 
@@ -102,23 +103,27 @@ Step::Status StepParseManifest::precheck() {
 }
 
 bool StepParseManifest::LocateConfigFile() {
-  boost::filesystem::path manifest;
+  std::filesystem::path manifest;
   switch (manifest_location_) {
     case ManifestLocation::RECOVERY: {
-      bf::path backup_path = common_installer::GetBackupPathForPackagePath(
+      fs::path backup_path = common_installer::GetBackupPathForPackagePath(
           context_->GetPkgPath()) / kManifestFileName;
-      bf::path in_package_path = context_->GetPkgPath() / kManifestFileName;
-      bf::path install_path =
-          bf::path(getUserManifestPath(context_->uid.get(),
+      fs::path in_package_path = context_->GetPkgPath() / kManifestFileName;
+      fs::path install_path =
+          fs::path(getUserManifestPath(context_->uid.get(),
                       context_->is_readonly_package.get()))
-              / bf::path(context_->pkgid.get());
+              / fs::path(context_->pkgid.get());
       install_path += ".xml";
-      if (bf::exists(backup_path))
+      fs::path backup_install_path =
+          common_installer::GetBackupPathForManifestFile(install_path);
+      if (fs::exists(backup_install_path))
+        manifest = backup_install_path;
+      else if (fs::exists(backup_path))
         manifest = backup_path;
-      else if (bf::exists(in_package_path))
-        manifest = in_package_path;
-      else if (bf::exists(install_path))
+      else if (fs::exists(install_path))
         manifest = install_path;
+      else if (fs::exists(in_package_path))
+        manifest = in_package_path;
       break;
     }
     case ManifestLocation::INSTALLED: {
@@ -129,13 +134,13 @@ bool StepParseManifest::LocateConfigFile() {
         uid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER);
       else
         uid = context_->uid.get();
-      bf::path xml_path =
-          bf::path(getUserManifestPath(uid, is_readonly))
-          / bf::path(context_->pkgid.get());
+      fs::path xml_path =
+          fs::path(getUserManifestPath(uid, is_readonly))
+          / fs::path(context_->pkgid.get());
       xml_path += ".xml";
       context_->xml_path.set(xml_path);
       manifest = context_->xml_path.get();
-      if (!boost::filesystem::exists(manifest)) {
+      if (!std::filesystem::exists(manifest)) {
         /* This routine has added for platform update */
         manifest = context_->unpacked_dir_path.get();
         manifest /= kManifestFileName;
@@ -155,7 +160,7 @@ bool StepParseManifest::LocateConfigFile() {
 
   LOG(DEBUG) << "manifest path: " << manifest;
 
-  if (!boost::filesystem::exists(manifest))
+  if (!std::filesystem::exists(manifest))
     return false;
 
   path_ = manifest;
@@ -184,9 +189,7 @@ int StepParseManifest::GetSupportModeVal(std::string support_mode) {
 bool StepParseManifest::FillInstallationInfo(manifest_x* manifest) {
   manifest->root_path = strdup(
       (context_->root_application_path.get() / manifest->package).c_str());
-  manifest->installed_time =
-      strdup(std::to_string(std::chrono::system_clock::to_time_t(
-          std::chrono::system_clock::now())).c_str());
+  manifest->installed_time = strdup(GetCurrentTime().c_str());
   return true;
 }
 
@@ -199,27 +202,6 @@ bool StepParseManifest::FillPackageInfo(manifest_x* manifest) {
     return false;
   }
 
-  auto ui_application_list =
-      std::static_pointer_cast<const tpk::parse::UIApplicationInfoList>(
-          parser_->GetManifestData(app_keys::kUIApplicationKey));
-  auto service_application_list =
-      std::static_pointer_cast<const tpk::parse::ServiceApplicationInfoList>(
-          parser_->GetManifestData(app_keys::kServiceApplicationKey));
-  auto widget_application_list =
-      std::static_pointer_cast<const tpk::parse::WidgetApplicationInfoList>(
-          parser_->GetManifestData(app_keys::kWidgetApplicationKey));
-  auto watch_application_list =
-      std::static_pointer_cast<const tpk::parse::WatchApplicationInfoList>(
-          parser_->GetManifestData(app_keys::kWatchApplicationKey));
-
-  // mandatory check
-  if (!ui_application_list && !service_application_list &&
-      !widget_application_list && !watch_application_list) {
-    LOG(ERROR) << "UI Application or Service Application or Widget Application "
-                  "or Watch Application are mandatory and has not been found.";
-    return false;
-  }
-
   int support_mode_val = GetSupportModeVal(pkg_info->support_mode());
 
   manifest->ns = strdup(pkg_info->xmlns().c_str());
@@ -247,20 +229,6 @@ bool StepParseManifest::FillPackageInfo(manifest_x* manifest) {
     manifest->type = strdup(pkg_info->type().c_str());
   }
 
-  // Set external path if the package is installed at external storage.
-  if (req_type == RequestType::ManifestDirectInstall ||
-      req_type == RequestType::ManifestDirectUpdate ||
-      req_type == RequestType::ManifestPartialInstall ||
-      req_type == RequestType::ManifestPartialUpdate) {
-    App2ExtDynamicService service;
-    std::string image_path = service.GetExternalImagePath(
-        context_->pkgid.get().c_str(), context_->uid.get());
-    if (!image_path.empty()) {
-      manifest->external_path = strdup(image_path.c_str());
-      manifest->installed_storage = strdup(kInstalledExternally);
-    }
-  }
-
   for (auto& pair : pkg_info->labels()) {
     label_x* label = reinterpret_cast<label_x*>(calloc(1, sizeof(label_x)));
     if (!label) {
@@ -288,10 +256,10 @@ bool StepParseManifest::FillPackageInfo(manifest_x* manifest) {
   // set installed_storage if package is installed
   // this is internal field in package manager but after reading configuration
   // we must know it
+  PkgQueryInterface pkg_query(manifest->package, context_->uid.get());
   if (!manifest->installed_storage) {
     if (manifest_location_ == ManifestLocation::INSTALLED ||
         manifest_location_ == ManifestLocation::RECOVERY) {
-      PkgQueryInterface pkg_query(manifest->package, context_->uid.get());
       std::string storage = pkg_query.StorageForPkgId();
       if (storage.empty()) {
         // Failed to query installation storage, assign internal
@@ -304,6 +272,28 @@ bool StepParseManifest::FillPackageInfo(manifest_x* manifest) {
     }
   }
 
+  // retrieve and set plugin execution info if exists
+  if (store_location_ == StoreLocation::BACKUP && (
+      manifest_location_ == ManifestLocation::INSTALLED ||
+      manifest_location_ == ManifestLocation::RECOVERY)) {
+    std::vector<PkgQueryInterface::PluginInfo> plugin_list;
+    pkg_query.PluginExecutionInfo(&plugin_list);
+
+    for (const auto& plugin_info : plugin_list) {
+      plugin_x* plugin =
+          reinterpret_cast<plugin_x*>(calloc(1, sizeof(plugin_x)));
+      if (!plugin) {
+        LOG(ERROR) << "Out of memory";
+        return false;
+      }
+
+      plugin->pkgid = strdup(manifest->package);
+      plugin->appid = strdup(std::get<1>(plugin_info).c_str());
+      plugin->plugin_type = strdup(std::get<2>(plugin_info).c_str());
+      plugin->plugin_name = strdup(std::get<3>(plugin_info).c_str());
+      manifest->plugin = g_list_append(manifest->plugin, plugin);
+    }
+  }
   return true;
 }
 
@@ -385,7 +375,7 @@ bool StepParseManifest::FillPrivileges(manifest_x* manifest) {
     privilege->value = strdup(priv.privilege.c_str());
     privilege->type = strdup(priv.type.c_str());
     if (!priv.license.empty()) {
-      if (bf::path(priv.license).is_absolute())
+      if (fs::path(priv.license).is_absolute())
         privilege->license = strdup(priv.license.c_str());
       else
         privilege->license = strdup((context_->GetPkgPath()
@@ -421,7 +411,7 @@ bool StepParseManifest::FillProvidesAppDefinedPrivileges(
     privilege->value = strdup(priv.privilege.c_str());
     privilege->type = strdup(priv.type.c_str());
     if (!priv.license.empty()) {
-      if (bf::path(priv.license).is_absolute())
+      if (fs::path(priv.license).is_absolute())
         privilege->license = strdup(priv.license.c_str());
       else
         privilege->license = strdup((context_->GetPkgPath()
@@ -483,9 +473,13 @@ bool StepParseManifest::FillWidgetApplication(manifest_x* manifest) {
     widget_app->package = strdup(manifest->package);
     widget_app->support_disable = strdup(manifest->support_disable);
     widget_app->launch_mode = strdup("single");
-    widget_app->api_version = strdup(manifest->api_version);
+    if (!application.app_info.api_version().empty())
+      widget_app->api_version =
+          strdup(application.app_info.api_version().c_str());
+    else
+      widget_app->api_version = strdup(manifest->api_version);
     manifest->application = g_list_append(manifest->application, widget_app);
-    if (bf::path(application.app_info.exec().c_str()).is_absolute())
+    if (fs::path(application.app_info.exec().c_str()).is_absolute())
       widget_app->exec = strdup(application.app_info.exec().c_str());
     else
       widget_app->exec = strdup((context_->root_application_path.get()
@@ -502,6 +496,8 @@ bool StepParseManifest::FillWidgetApplication(manifest_x* manifest) {
       return false;
     if (!FillMetadata(widget_app, application.meta_data))
       return false;
+    if (!FillResControl(widget_app, application.res_controls))
+      return false;
   }
   return true;
 }
@@ -536,8 +532,6 @@ bool StepParseManifest::FillServiceApplication(manifest_x* manifest) {
       service_app->type = strdup(application.app_info.type().c_str());
     else
       service_app->type = strdup("capp");
-    service_app->process_pool =
-        strdup(application.app_info.process_pool().c_str());
     service_app->component_type = strdup("svcapp");
     service_app->mainapp = strdup(application.app_info.mainapp().c_str());
     service_app->nodisplay = strdup("true");
@@ -555,9 +549,13 @@ bool StepParseManifest::FillServiceApplication(manifest_x* manifest) {
     service_app->package = strdup(manifest->package);
     service_app->support_disable = strdup(manifest->support_disable);
     service_app->launch_mode = strdup("single");
-    service_app->api_version = strdup(manifest->api_version);
+    if (!application.app_info.api_version().empty())
+      service_app->api_version =
+          strdup(application.app_info.api_version().c_str());
+    else
+      service_app->api_version = strdup(manifest->api_version);
     manifest->application = g_list_append(manifest->application, service_app);
-    if (bf::path(application.app_info.exec().c_str()).is_absolute())
+    if (fs::path(application.app_info.exec().c_str()).is_absolute())
       service_app->exec = strdup(application.app_info.exec().c_str());
     else
       service_app->exec = strdup((context_->root_application_path.get()
@@ -579,6 +577,8 @@ bool StepParseManifest::FillServiceApplication(manifest_x* manifest) {
     if (!FillBackgroundCategoryInfo(service_app,
         application.background_category))
       return false;
+    if (!FillResControl(service_app, application.res_controls))
+      return false;
   }
   return true;
 }
@@ -653,9 +653,12 @@ bool StepParseManifest::FillUIApplication(manifest_x* manifest) {
     ui_app->support_disable = strdup(manifest->support_disable);
     ui_app->splash_screen_display =
         strdup(application.app_info.splash_screen_display().c_str());
-    ui_app->api_version = strdup(manifest->api_version);
+    if (!application.app_info.api_version().empty())
+      ui_app->api_version = strdup(application.app_info.api_version().c_str());
+    else
+      ui_app->api_version = strdup(manifest->api_version);
     manifest->application = g_list_append(manifest->application, ui_app);
-    if (bf::path(application.app_info.exec().c_str()).is_absolute())
+    if (fs::path(application.app_info.exec().c_str()).is_absolute())
       ui_app->exec = strdup(application.app_info.exec().c_str());
     else
       ui_app->exec = strdup((context_->root_application_path.get()
@@ -681,6 +684,8 @@ bool StepParseManifest::FillUIApplication(manifest_x* manifest) {
       return false;
     if (!FillSplashScreen(ui_app, application.app_splashscreens))
       return false;
+    if (!FillResControl(ui_app, application.res_controls))
+      return false;
   }
   return true;
 }
@@ -705,7 +710,7 @@ bool StepParseManifest::FillWatchApplication(manifest_x* manifest) {
     }
     watch_app->appid = strdup(watch_application.app_info.appid().c_str());
 
-    if (bf::path(watch_application.app_info.exec().c_str()).is_absolute())
+    if (fs::path(watch_application.app_info.exec().c_str()).is_absolute())
       watch_app->exec = strdup(watch_application.app_info.exec().c_str());
     else
       watch_app->exec = strdup(
@@ -738,13 +743,18 @@ bool StepParseManifest::FillWatchApplication(manifest_x* manifest) {
         strdup((std::to_string(app_support_mode_val)).c_str());
     watch_app->ui_gadget = strdup("false");
     watch_app->launch_mode = strdup("single");
-    watch_app->api_version = strdup(manifest->api_version);
+    if (!watch_application.app_info.api_version().empty())
+      watch_app->api_version =
+          strdup(watch_application.app_info.api_version().c_str());
+    else
+      watch_app->api_version = strdup(manifest->api_version);
     watch_app->support_ambient =
         strdup(watch_application.app_info.ambient_support().c_str());
     watch_app->package = strdup(manifest->package);
     if (!watch_application.app_info.setup_appid().empty())
       watch_app->setup_appid =
           strdup(watch_application.app_info.setup_appid().c_str());
+    manifest->application = g_list_append(manifest->application, watch_app);
 
     if (!FillLabel(watch_app, watch_application.label))
       return false;
@@ -757,7 +767,8 @@ bool StepParseManifest::FillWatchApplication(manifest_x* manifest) {
     if (!FillBackgroundCategoryInfo(watch_app,
         watch_application.background_category))
       return false;
-    manifest->application = g_list_append(manifest->application, watch_app);
+    if (!FillResControl(watch_app, watch_application.res_controls))
+      return false;
   }
   return true;
 }
@@ -780,6 +791,50 @@ bool StepParseManifest::FillTrustAnchorInfo(manifest_x* manifest) {
   return true;
 }
 
+bool StepParseManifest::FillDependencyInfo(manifest_x* manifest) {
+  std::shared_ptr<const tpk::parse::DependenciesInfo> dependencies_info =
+      std::static_pointer_cast<const tpk::parse::DependenciesInfo>(
+          parser_->GetManifestData(app_keys::kDependenciesKey));
+  if (!dependencies_info)
+    return true;
+
+  for (const auto& dependency : dependencies_info->dependencies()) {
+    dependency_x* dep =
+        static_cast<dependency_x*>(calloc(1, sizeof(dependency_x)));
+    if (!dep) {
+      LOG(ERROR) << "Out of memory";
+      return false;
+    }
+    dep->depends_on = strdup(dependency.pkgid().c_str());
+    dep->type = strdup(dependency.type().c_str());
+    if (!dependency.required_version().empty())
+      dep->required_version = strdup(dependency.required_version().c_str());
+    manifest->dependencies = g_list_append(manifest->dependencies, dep);
+  }
+
+  return true;
+}
+
+bool StepParseManifest::FillLightUserInfo(manifest_x* manifest) {
+  std::shared_ptr<const tpk::parse::LightUserInfo> light_user_info =
+      std::static_pointer_cast<const tpk::parse::LightUserInfo>(
+          parser_->GetManifestData(tpk::parse::LightUserInfo::Key()));
+  if (!light_user_info) {
+    manifest->light_user_switch_mode = strdup("default");
+    return true;
+  }
+
+  if (light_user_info->switch_mode().empty()) {
+    LOG(ERROR) << "Invalid switch mode";
+    return false;
+  }
+
+  manifest->light_user_switch_mode =
+      strdup(light_user_info->switch_mode().c_str());
+
+  return true;
+}
+
 bool StepParseManifest::CheckFeatures() {
   auto feature_info =
         std::static_pointer_cast<const tpk::parse::FeatureInfo>(
@@ -819,6 +874,10 @@ bool StepParseManifest::FillAppControl(application_x* app,
       app_control->visibility = strdup(control.visibility().c_str());
     else
       app_control->visibility = strdup("local-only");
+    if (!control.id().empty())
+      app_control->id = strdup(control.id().c_str());
+    else
+      app_control->id = strdup("no-name-app-control");
     for (const auto& priv : control.privileges()) {
       app_control->privileges = g_list_append(app_control->privileges,
           strdup(priv.c_str()));
@@ -866,8 +925,8 @@ bool StepParseManifest::FillApplicationIconPaths(application_x* app,
       LOG(ERROR) << "Out of memory";
       return false;
     }
-    bf::path text;
-    if (bf::path(application_icon.path()).is_absolute()) {
+    fs::path text;
+    if (fs::path(application_icon.path()).is_absolute()) {
       text = application_icon.path();
     } else {
       text = context_->root_application_path.get()
@@ -955,11 +1014,11 @@ void StepParseManifest::AppendSplashScreen(application_x* app,
     LOG(ERROR) << "Out of memory";
     return;
   }
-  if (bf::path(src).is_absolute()) {
+  if (fs::path(src).is_absolute()) {
     splashscreen->src = strdup(src.c_str());
   } else {
-    bf::path full_path = context_->GetPkgPath() / src;
-    splashscreen->src = strdup(full_path.string().c_str());
+    fs::path full_path = context_->GetPkgPath() / src;
+    splashscreen->src = strdup(full_path.c_str());
   }
   if (src.substr(src.find_last_of(".") + 1) == "edj")
     splashscreen->type = strdup("edj");
@@ -995,7 +1054,7 @@ bool StepParseManifest::FillSplashScreen(application_x* app,
     if (context_->is_readonly_package.get())
       src = splash_screen.src();
     else
-      src = bf::path(context_->root_application_path.get()
+      src = fs::path(context_->root_application_path.get()
         / app->package / "shared" / "res" / splash_screen.src()).string();
 
     AppendSplashScreen(app, src, splash_screen.type(), splash_screen.dpi(),
@@ -1005,15 +1064,39 @@ bool StepParseManifest::FillSplashScreen(application_x* app,
   return true;
 }
 
+template <typename T>
+bool StepParseManifest::FillResControl(application_x* app,
+    const T& res_control_list) {
+  for (auto& res_control : res_control_list) {
+    if (res_control.resource_type().empty())
+      continue;
+
+    res_control_x* rc =
+        static_cast<res_control_x*>(calloc(1, sizeof(res_control_x)));
+    if (!rc) {
+      LOG(ERROR) << "Out of memory";
+      return false;
+    }
+
+    rc->res_type = strdup(res_control.resource_type().c_str());
+    if (!res_control.min_res_version().empty())
+      rc->min_res_version = strdup(res_control.min_res_version().c_str());
+    if (!res_control.max_res_version().empty())
+      rc->max_res_version = strdup(res_control.max_res_version().c_str());
+    if (!res_control.auto_close().empty())
+      rc->auto_close = strdup(res_control.auto_close().c_str());
+
+    app->res_control = g_list_prepend(app->res_control, rc);
+  }
+  return true;
+}
+
 void StepParseManifest::GetLegacySplashScreenFromMetadata(application_x* app,
     const std::string& key, const std::string& val) {
   std::string operation;
-  if (key.find(kOperationEffectKey) != std::string::npos) {
-    boost::char_separator<char> sep("=");
-    boost::tokenizer<boost::char_separator<char>> tokens(key, sep);
-    auto iter = tokens.begin();
-    iter++;
-    operation = *iter;
+  auto pos = key.find(kOperationEffectKey);
+  if (pos != std::string::npos) {
+    operation = key.substr(pos + 1, key.size());
   } else if (key.find(kLaunchEffectKey) != std::string::npos) {
     operation = std::string("launch-effect");
   } else {
@@ -1021,25 +1104,23 @@ void StepParseManifest::GetLegacySplashScreenFromMetadata(application_x* app,
     return;
   }
 
-  boost::char_separator<char> sep("=|");
-  boost::tokenizer<boost::char_separator<char>> tokens(val, sep);
-  auto iter = tokens.begin();
   std::string portrait_src;
   std::string landscape_src;
   std::string indicatordisplay;
-  while (iter != tokens.end()) {
-    if (!(*iter).compare(kPortraitEffectImageValue)) {
-      iter++;
-      portrait_src = *iter;
-    } else if (!(*iter).compare(kLandscapeEffectImageValue)) {
-      iter++;
-      landscape_src = *iter;
-    } else if (!(*iter).compare(kIndicatorDisplayValue)) {
-      iter++;
-      indicatordisplay = *iter;
-    }
-    iter++;
+
+  std::regex re("[=|]");
+  std::sregex_token_iterator first(val.begin(), val.end(), re, -1);
+  std::sregex_token_iterator last;
+  std::vector<std::string> tokens(first, last);
+  for (const auto& t : tokens) {
+    if (t.compare(kPortraitEffectImageValue))
+      portrait_src = t;
+    else if (t.compare(kLandscapeEffectImageValue))
+      landscape_src = t;
+    else if (t.compare(kIndicatorDisplayValue))
+      indicatordisplay = t;
   }
+
   if (!portrait_src.empty())
     AppendSplashScreen(app, portrait_src, {}, {}, kPortraitOrientation,
         indicatordisplay, operation, {});
@@ -1094,6 +1175,9 @@ bool StepParseManifest::FillExtraInfo(manifest_x* manifest) {
       manifest->zip_mount_file = strdup(zip_mount_file.c_str());
   }
 
+  if (manifest->application == nullptr)
+    return true;
+
   // in case of hybrid package, main app is already set by wgt-backend
   application_x* mainapp = nullptr;
   if (!context_->cross_app_rules.get()) {
@@ -1122,6 +1206,168 @@ bool StepParseManifest::FillExtraInfo(manifest_x* manifest) {
   return true;
 }
 
+bool StepParseManifest::FillComponentBasedApplicationInfo(
+    manifest_x* manifest) {
+  std::shared_ptr<const tpk::parse::ComponentBasedApplicationInfoList>
+      component_based_application_list = std::static_pointer_cast<
+          const tpk::parse::ComponentBasedApplicationInfoList>(
+              parser_->GetManifestData(
+                  app_keys::kComponentBasedApplicationKey));
+  if (!component_based_application_list)
+    return true;
+
+  for (const auto& application : component_based_application_list->items) {
+    int package_support_mode_val = atoi(manifest->support_mode);
+    int app_support_mode_val = package_support_mode_val |
+        GetSupportModeVal(application.app_info.support_mode());
+
+    application_x* app =
+        static_cast<application_x*>(calloc(1, sizeof(application_x)));
+    if (!app) {
+      LOG(ERROR) << "Out of memory";
+      return false;
+    }
+
+    app->appid = strdup(application.app_info.appid().c_str());
+    app->launch_mode = strdup(application.app_info.launch_mode().c_str());
+    app->multiple = strdup(application.app_info.multiple().c_str());
+    app->nodisplay = strdup(application.app_info.nodisplay().c_str());
+    app->support_mode = strdup((std::to_string(app_support_mode_val)).c_str());
+    app->taskmanage = strdup(application.app_info.taskmanage().c_str());
+    if (!application.app_info.type().empty())
+      app->type = strdup(application.app_info.type().c_str());
+    else
+      app->type = strdup("c++app");
+    app->indicatordisplay =
+        strdup(application.app_info.indicator_display().c_str());
+    app->component_type = strdup("componentbasedapp");
+    app->hwacceleration = strdup(application.app_info.hwacceleration().c_str());
+    app->onboot = strdup("false");
+    app->autorestart = strdup("false");
+    app->mainapp = strdup(application.app_info.mainapp().c_str());
+    app->screenreader = strdup("use-system-setting");
+    app->recentimage = strdup("false");
+    app->launchcondition = strdup("false");
+    app->guestmode_visibility = strdup("true");
+    app->permission_type = strdup("normal");
+    app->support_ambient = strdup("false");
+    app->effectimage_type = strdup("image");
+    app->submode = strdup("false");
+    app->process_pool = strdup("false");
+    app->package = strdup(manifest->package);
+    app->support_disable = strdup(manifest->support_disable);
+    app->launch_mode = strdup("single");
+    if (!application.app_info.api_version().empty())
+      app->api_version = strdup(application.app_info.api_version().c_str());
+    else
+      app->api_version = strdup(manifest->api_version);
+    app->splash_screen_display =
+        strdup(application.app_info.splash_screen_display().c_str());
+    manifest->application = g_list_append(manifest->application, app);
+    if (fs::path(application.app_info.exec().c_str()).is_absolute()) {
+      app->exec = strdup(application.app_info.exec().c_str());
+    } else {
+      app->exec = strdup((context_->root_application_path.get()
+                          / manifest->package / "bin"
+                          / application.app_info.exec()).c_str());
+    }
+    if (!FillLabel(app, application.label))
+      return false;
+    if (!FillImage(app, application.app_images))
+      return false;
+    if (!FillBackgroundCategoryInfo(app, application.background_category))
+      return false;
+    if (!FillAppControl(app, application.app_control))
+      return false;
+    if (!FillDataControl(app, application.data_control))
+      return false;
+    if (!FillMetadata(app, application.meta_data))
+      return false;
+    if (!FillCategories(app, application.categories))
+      return false;
+    if (!FillSplashScreen(app, application.app_splashscreens))
+      return false;
+    if (!FillResControl(app, application.res_controls))
+      return false;
+  }
+
+  return true;
+}
+
+bool StepParseManifest::FillRobotApplicationInfo(
+    manifest_x* manifest) {
+  std::shared_ptr<const tpk::parse::RobotApplicationInfoList>
+      robot_application_list = std::static_pointer_cast<
+          const tpk::parse::RobotApplicationInfoList>(
+              parser_->GetManifestData(
+                  app_keys::kRobotApplicationKey));
+  if (!robot_application_list)
+    return true;
+
+  for (const auto& application : robot_application_list->items) {
+    int package_support_mode_val = atoi(manifest->support_mode);
+    int app_support_mode_val = package_support_mode_val |
+        GetSupportModeVal(application.app_info.support_mode());
+
+    application_x* app =
+        static_cast<application_x*>(calloc(1, sizeof(application_x)));
+    if (!app) {
+      LOG(ERROR) << "Out of memory";
+      return false;
+    }
+
+    app->appid = strdup(application.app_info.appid().c_str());
+    app->multiple = strdup("false");
+    app->nodisplay = strdup("false");
+    app->support_mode = strdup((std::to_string(app_support_mode_val)).c_str());
+    app->taskmanage = strdup("false");
+    if (!application.app_info.type().empty())
+      app->type = strdup(application.app_info.type().c_str());
+    else
+      app->type = strdup("robotapp");
+    app->indicatordisplay = strdup("false");
+    app->component_type = strdup("robotapp");
+    app->hwacceleration = strdup("default");
+    app->onboot = strdup("false");
+    app->autorestart = strdup("false");
+    app->mainapp = strdup(application.app_info.mainapp().c_str());
+    app->screenreader = strdup("use-system-setting");
+    app->recentimage = strdup("false");
+    app->launchcondition = strdup("false");
+    app->guestmode_visibility = strdup("true");
+    app->permission_type = strdup("normal");
+    app->support_ambient = strdup("false");
+    app->effectimage_type = strdup("image");
+    app->submode = strdup("false");
+    app->process_pool = strdup("false");
+    app->package = strdup(manifest->package);
+    app->support_disable = strdup(manifest->support_disable);
+    app->launch_mode = strdup("single");
+    if (!application.app_info.api_version().empty())
+      app->api_version = strdup(application.app_info.api_version().c_str());
+    else
+      app->api_version = strdup(manifest->api_version);
+    manifest->application = g_list_append(manifest->application, app);
+    if (fs::path(application.app_info.exec().c_str()).is_absolute()) {
+      app->exec = strdup(application.app_info.exec().c_str());
+    } else {
+      app->exec = strdup((context_->root_application_path.get()
+                          / manifest->package / "bin"
+                          / application.app_info.exec()).c_str());
+    }
+    if (!FillApplicationIconPaths(app, application.app_icons))
+      return false;
+    if (!FillLabel(app, application.label))
+      return false;
+    if (!FillMetadata(app, application.meta_data))
+      return false;
+    if (!FillResControl(app, application.res_controls))
+      return false;
+  }
+
+  return true;
+}
+
 bool StepParseManifest::FillManifestX(manifest_x* manifest) {
   if (!FillPackageInfo(manifest))
     return false;
@@ -1135,6 +1381,10 @@ bool StepParseManifest::FillManifestX(manifest_x* manifest) {
     return false;
   if (!FillWatchApplication(manifest))
     return false;
+  if (!FillComponentBasedApplicationInfo(manifest))
+    return false;
+  if (!FillRobotApplicationInfo(manifest))
+    return false;
   if (!FillPrivileges(manifest))
     return false;
   if (!FillProvidesAppDefinedPrivileges(manifest))
@@ -1147,6 +1397,10 @@ bool StepParseManifest::FillManifestX(manifest_x* manifest) {
     return false;
   if (!FillTrustAnchorInfo(manifest))
     return false;
+  if (!FillDependencyInfo(manifest))
+    return false;
+  if (!FillLightUserInfo(manifest))
+    return false;
   return true;
 }
 
@@ -1166,7 +1420,7 @@ Step::Status StepParseManifest::process() {
   if (!parser_->ParseManifest(path_)) {
     if (manifest_location_ == ManifestLocation::RECOVERY) {
       LOG(DEBUG) << "Manifest for recovery is invalid";
-      bf::remove(path_);
+      fs::remove(path_);
       return Step::Status::OK;
     }
     LOG(ERROR) << "[Parse] Parse failed. " <<  parser_->GetErrorMessage();
@@ -1200,7 +1454,7 @@ Step::Status StepParseManifest::process() {
     context_->recovery_info.get().recovery_file->WriteAndCommitFileContent();
   }
 
-  LOG(DEBUG) << "Parsed package id: " << info->package();
+  LOG(INFO) << "Parsed package id: " << info->package();
 
   switch (store_location_) {
     case StoreLocation::NORMAL: