Parse robot-application 24/308924/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 2 Apr 2024 07:30:05 +0000 (16:30 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 2 Apr 2024 23:42:06 +0000 (08:42 +0900)
Change-Id: If15559eb6d5c7eefb9a0bc546ca812fa1dfb3a9a
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/configuration/step_parse_manifest.cc
src/common/step/configuration/step_parse_manifest.h

index e2ad305..70e1a86 100644 (file)
@@ -19,6 +19,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>
@@ -1293,6 +1294,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 (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 (!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;
@@ -1308,6 +1381,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 ba09c75..436e44d 100644 (file)
@@ -73,6 +73,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();