Set gadget info to bundle object 52/304552/3
authorHwankyu Jhun <h.jhun@samsung.com>
Fri, 19 Jan 2024 09:38:13 +0000 (18:38 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 23 Jan 2024 00:43:54 +0000 (09:43 +0900)
The gadget informations are added to the bundle.
The launchpad attempts to mount with the set bundle information.

Change-Id: Ic204ed61ac0d9b7a78b27d860695c0ce1bcb7a19
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/launch/step_prepare_starting_app.cc
src/lib/res_info/res_mount_package_info.cc
src/lib/res_info/res_mount_package_info.hh

index 7fd47e5..859cd28 100644 (file)
@@ -645,16 +645,19 @@ int StepPrepareStartingApp::SetResPackagePaths(LaunchContext* context) {
     return 0;
 
   AddDataToBundle(info->GetPkgIds(), context->GetBundle(),
-      AUL_K_MOUNT_RES_PKGIDS);
+                  AUL_K_MOUNT_RES_PKGIDS);
   AddDataToBundle(info->GetAllowedPaths(), context->GetBundle(),
-      AUL_K_MOUNT_ALLOWED_RES_DIR);
+                  AUL_K_MOUNT_ALLOWED_RES_DIR);
   AddDataToBundle(info->GetGlobalPaths(), context->GetBundle(),
-      AUL_K_MOUNT_GLOBAL_RES_DIR);
+                  AUL_K_MOUNT_GLOBAL_RES_DIR);
   AddDataToBundle(info->GetAllowedLibPaths(), context->GetBundle(),
-      AUL_K_MOUNT_ALLOWED_LIB_RES_DIR);
+                  AUL_K_MOUNT_ALLOWED_LIB_RES_DIR);
   AddDataToBundle(info->GetGlobalLibPaths(), context->GetBundle(),
-      AUL_K_MOUNT_GLOBAL_LIB_RES_DIR);
-
+                  AUL_K_MOUNT_GLOBAL_LIB_RES_DIR);
+  AddDataToBundle(info->GetGadgetPkgIds(), context->GetBundle(),
+                  AUL_K_MOUNT_GADGET_PKGIDS);
+  AddDataToBundle(info->GetGadgetPaths(), context->GetBundle(),
+                  AUL_K_MOUNT_GADGET_PATHS);
   return 0;
 }
 
index cead4ed..688cb58 100644 (file)
@@ -27,6 +27,7 @@ namespace amd {
 
 constexpr const char ALLOWED_SUFFIX[] = "/res/allowed";
 constexpr const char GLOBAL_SUFFIX[] = "/res/global";
+constexpr const char kGadgetPrefix[] = "org.tizen.appfw.gadget.";
 
 ResMountPackageInfo::ResMountPackageInfo(
     const std::vector<std::shared_ptr<ResPkgInfo>>& allowed_packages,
@@ -38,7 +39,16 @@ ResMountPackageInfo::ResMountPackageInfo(
           pkg->GetRootPath() + ALLOWED_SUFFIX + "/" + pkg->GetResType());
     else
       allowed_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
+
+    if (pkg->GetResType().length() < strlen(kGadgetPrefix))
+      continue;
+
+    if (!pkg->GetResType().compare(0, strlen(kGadgetPrefix), kGadgetPrefix)) {
+      gadget_pkgids_.insert(pkg->GetPkgId());
+      gadget_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
+    }
   }
+
   for (const auto& pkg : global_packages) {
     pkgids_.insert(pkg->GetPkgId());
     if (pkg->IsLib())
index b7421a6..207aa5b 100644 (file)
@@ -38,25 +38,39 @@ class ResMountPackageInfo {
       std::optional<ResMountPackageInfo>* info);
 
   const std::set<std::string>& GetPkgIds() const { return pkgids_; }
+
   const std::vector<std::string>& GetAllowedPaths() const {
     return allowed_paths_;
   }
+
   const std::vector<std::string>& GetGlobalPaths() const {
     return global_paths_;
   }
+
   const std::vector<std::string>& GetAllowedLibPaths() const {
     return allowed_lib_paths_;
   }
+
   const std::vector<std::string>& GetGlobalLibPaths() const {
     return global_lib_paths_;
   }
 
+  const std::set<std::string>& GetGadgetPkgIds() const {
+    return gadget_pkgids_;
+  }
+
+  const std::vector<std::string>& GetGadgetPaths() const {
+    return gadget_paths_;
+  }
+
  private:
   std::set<std::string> pkgids_;
   std::vector<std::string> allowed_paths_;
   std::vector<std::string> global_paths_;
   std::vector<std::string> allowed_lib_paths_;
   std::vector<std::string> global_lib_paths_;
+  std::set<std::string> gadget_pkgids_;
+  std::vector<std::string> gadget_paths_;
 };
 
 }  // namespace amd