Parse robot-application 70/311670/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 2 Apr 2024 07:30:05 +0000 (16:30 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 28 May 2024 06:31:37 +0000 (15:31 +0900)
Change-Id: If15559eb6d5c7eefb9a0bc546ca812fa1dfb3a9a
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
(cherry picked from commit a5e4ef9c5cb617aef8dd3a668800da1b2025ac07)

src/common/step/configuration/step_parse_manifest.cc
src/common/step/configuration/step_parse_manifest.h

index 3c6d0796d889f9b5bc44117f8446cc9b9d3eec5e..9cbf871646cfd05ac2b0bd174ea2e18e0b965771 100644 (file)
@@ -21,6 +21,7 @@
 #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>
@@ -1277,6 +1278,78 @@ bool StepParseManifest::FillComponentBasedApplicationInfo(
   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 (bf::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 (!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;
@@ -1292,6 +1365,8 @@ bool StepParseManifest::FillManifestX(manifest_x* manifest) {
     return false;
   if (!FillComponentBasedApplicationInfo(manifest))
     return false;
+  if (!FillRobotApplicationInfo(manifest))
+    return false;
   if (!FillPrivileges(manifest))
     return false;
   if (!FillProvidesAppDefinedPrivileges(manifest))
index 58f360b487c140d79808a481e825d5a978b0854e..d4e92182ef17a3fbb1e4d8dadef53088e7d06dd6 100644 (file)
@@ -74,6 +74,7 @@ class StepParseManifest : public common_installer::Step {
   bool FillTrustAnchorInfo(manifest_x* manifest);
   bool FillDependencyInfo(manifest_x* manifest);
   bool FillComponentBasedApplicationInfo(manifest_x* manifest);
+  bool FillRobotApplicationInfo(manifest_x* manifest);
   bool FillLightUserInfo(manifest_x* manifest);
   int GetSupportModeVal(std::string support_mode);
   bool CheckFeatures();