Set gadget info to bundle object
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 03:56:12 +0000 (12:56 +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 50a2926c91fe025e1d27866f6519447c583b60b8..bf66ce6804fb137473d6a184be85830bcefdfecf 100644 (file)
@@ -645,12 +645,15 @@ 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->GetGadgetPkgIds(), context->GetBundle(),
+                  AUL_K_MOUNT_GADGET_PKGIDS);
+  AddDataToBundle(info->GetGadgetPaths(), context->GetBundle(),
+                  AUL_K_MOUNT_GADGET_PATHS);
   return 0;
 }
 
index 0ae986a4221bda7dea9a59453eef4afca343535e..3a592cfd6a8ba9b4d380baee92ed4e71ea8a876f 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,
@@ -34,7 +35,16 @@ ResMountPackageInfo::ResMountPackageInfo(
   for (const auto& pkg : allowed_packages) {
     pkgids_.insert(pkg->GetPkgId());
     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());
     global_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX);
index 285c6e76d0c9d03ad3879e3d8022183e73bca64c..a10d0ddd626c1fbad6e2209ffae9daabbdd86602 100644 (file)
@@ -38,17 +38,29 @@ 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::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::set<std::string> gadget_pkgids_;
+  std::vector<std::string> gadget_paths_;
 };
 
 }  // namespace amd