Parse values for using library resource package 11/311911/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 30 May 2024 07:00:32 +0000 (16:00 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 30 May 2024 07:00:32 +0000 (16:00 +0900)
Requires:
 - https://review.tizen.org/gerrit/c/platform/core/appfw/aul-1/+/311903

Change-Id: I11207dc1a0510a84ca6574d438a7ea208bdb3495
Signed-off-by: Sangyoon Jang <jeremy.jang@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
src/lib/res_info/res_pkg_info.cc
src/lib/res_info/res_pkg_info.hh

index c857b7632b4dbf22e83f8d34464b2dea01ac5aff..2bb71626680f30a7596496d3c311a33b68eb9dbc 100644 (file)
@@ -609,6 +609,8 @@ int StepPrepareStartingApp::SetResPackagePaths(LaunchContext* context) {
                   AUL_K_MOUNT_ALLOWED_RES_DIR);
   AddDataToBundle(info->GetGlobalPaths(), context->GetBundle(),
                   AUL_K_MOUNT_GLOBAL_RES_DIR);
+  AddDataToBundle(info->GetLibPaths(), context->GetBundle(),
+                  AUL_K_MOUNT_LIB_DIR);
   AddDataToBundle(info->GetGadgetPkgIds(), context->GetBundle(),
                   AUL_K_MOUNT_GADGET_PKGIDS);
   AddDataToBundle(info->GetGadgetPaths(), context->GetBundle(),
index 7334645f762af11bee9b6e08c5ec3066efac57b2..266a52d2635034c521366d4481d17cc536061f44 100644 (file)
@@ -28,6 +28,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.";
+constexpr const char kLibDir[] = "/lib";
 
 ResMountPackageInfo::ResMountPackageInfo(
     const std::vector<std::shared_ptr<ResPkgInfo>>& allowed_packages,
@@ -40,6 +41,9 @@ ResMountPackageInfo::ResMountPackageInfo(
                                  pkg->GetResType());
     }
 
+    if (pkg->IsLib())
+      lib_paths_.emplace_back(pkg->GetRootPath() + kLibDir);
+
     allowed_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
   }
 
@@ -126,6 +130,10 @@ const std::vector<std::string>& ResMountPackageInfo::GetGlobalPaths() const {
   return global_paths_;
 }
 
+const std::vector<std::string>& ResMountPackageInfo::GetLibPaths() const {
+  return lib_paths_;
+}
+
 const std::set<std::string>& ResMountPackageInfo::GetGadgetPkgIds() const {
   return gadget_pkgids_;
 }
index 73df5a8bf923178c82e0c8d63207ac9018d7d4b5..85825ea33f15de5a8870a87bab1ce9a13b2ecf3b 100644 (file)
@@ -38,12 +38,14 @@ class ResMountPackageInfo {
                                  std::optional<ResMountPackageInfo>* info);
   const std::vector<std::string>& GetAllowedPaths() const;
   const std::vector<std::string>& GetGlobalPaths() const;
+  const std::vector<std::string>& GetLibPaths() const;
   const std::set<std::string>& GetGadgetPkgIds() const;
   const std::vector<std::string>& GetGadgetPaths() const;
 
  private:
   std::vector<std::string> allowed_paths_;
   std::vector<std::string> global_paths_;
+  std::vector<std::string> lib_paths_;
   std::set<std::string> gadget_pkgids_;
   std::vector<std::string> gadget_paths_;
 };
index 571881a91ac37cd6c266a539c9359b899f643d2a..e4c2d3c68f3fa975870f488b2e3e54f4c8dfc7e6 100644 (file)
@@ -38,6 +38,10 @@ const std::string& ResPkgInfo::GetRootPath() {
   return root_path_;
 }
 
+bool ResPkgInfo::IsLib() {
+  return is_lib_;
+}
+
 bool ResPkgInfo::IsBlocked() {
   return is_blocked_;
 }
@@ -76,6 +80,7 @@ std::shared_ptr<ResPkgInfo> ResPkgInfo::CreateResPkgInfo(
   char* res_type;
   char* res_version;
   char* root_path;
+  bool is_lib;
   AllowedPkgPrivList allowed_pkg_priv_list;
 
   if (pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid) != PMINFO_R_OK)
@@ -90,6 +95,9 @@ std::shared_ptr<ResPkgInfo> ResPkgInfo::CreateResPkgInfo(
   if (pkgmgrinfo_pkginfo_get_root_path(handle, &root_path) != PMINFO_R_OK)
     return nullptr;
 
+  if (pkgmgrinfo_pkginfo_is_lib(handle, &is_lib) != PMINFO_R_OK)
+    return nullptr;
+
   if (pkgmgrinfo_pkginfo_foreach_res_allowed_package(handle,
       [](const char* allowed_package, required_privilege_h privilege_handle,
           void* user_data) -> int {
@@ -121,7 +129,7 @@ std::shared_ptr<ResPkgInfo> ResPkgInfo::CreateResPkgInfo(
     return nullptr;
 
   return std::shared_ptr<ResPkgInfo>(new ResPkgInfo(pkgid, res_type,
-      res_version, root_path, std::move(allowed_pkg_priv_list)));
+      res_version, root_path, is_lib, std::move(allowed_pkg_priv_list)));
 }
 
 std::shared_ptr<ResPkgInfo> ResPkgInfo::CreateResPkgInfo(
index 8f12efb9a3f8ffedf7158254f79e6c310d718d8e..c1923f701f84c55181193432ce5fba64fd72d65f 100644 (file)
@@ -41,6 +41,7 @@ class ResPkgInfo {
   const std::string& GetResType();
   const std::string& GetResVersion();
   const std::string& GetRootPath();
+  bool IsLib();
   bool IsBlocked();
   bool IsAllowedPkg(const std::string& pkgid,
       const std::set<std::string>& app_priv);
@@ -49,11 +50,12 @@ class ResPkgInfo {
 
  private:
   ResPkgInfo(std::string pkgid, std::string res_type, std::string res_version,
-      std::string root_path, AllowedPkgPrivList priv_list)
+      std::string root_path, bool is_lib, AllowedPkgPrivList priv_list)
           : pkgid_(std::move(pkgid)),
             res_type_(std::move(res_type)),
             res_version_(std::move(res_version)),
             root_path_(std::move(root_path)),
+            is_lib_(is_lib),
             allowed_pkg_priv_list_(std::move(priv_list)),
             is_blocked_(false) {}
 
@@ -61,6 +63,7 @@ class ResPkgInfo {
   std::string res_type_;
   std::string res_version_;
   std::string root_path_;
+  bool is_lib_;
   AllowedPkgPrivList allowed_pkg_priv_list_;
   bool is_blocked_;
 };