Parse values for using library resource package 87/304387/15
authorIlho Kim <ilho159.kim@samsung.com>
Tue, 16 Jan 2024 10:44:16 +0000 (19:44 +0900)
committerilho kim <ilho159.kim@samsung.com>
Tue, 23 Jan 2024 00:37:41 +0000 (00:37 +0000)
Requires:
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/304365

Change-Id: I824fa2a4d95ee8682ae001d572ccaffd544a99bb
Signed-off-by: Ilho Kim <ilho159.kim@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 50a2926c91fe025e1d27866f6519447c583b60b8..7fd47e5f3433bdfdb61d1d9f31f6767430763de4 100644 (file)
@@ -650,6 +650,10 @@ int StepPrepareStartingApp::SetResPackagePaths(LaunchContext* context) {
       AUL_K_MOUNT_ALLOWED_RES_DIR);
   AddDataToBundle(info->GetGlobalPaths(), context->GetBundle(),
       AUL_K_MOUNT_GLOBAL_RES_DIR);
+  AddDataToBundle(info->GetAllowedLibPaths(), context->GetBundle(),
+      AUL_K_MOUNT_ALLOWED_LIB_RES_DIR);
+  AddDataToBundle(info->GetGlobalLibPaths(), context->GetBundle(),
+      AUL_K_MOUNT_GLOBAL_LIB_RES_DIR);
 
   return 0;
 }
index 0ae986a4221bda7dea9a59453eef4afca343535e..cead4ed47c74774315485e05ec4e25a18d77a39d 100644 (file)
@@ -33,11 +33,19 @@ ResMountPackageInfo::ResMountPackageInfo(
     const std::vector<std::shared_ptr<ResPkgInfo>>& global_packages) {
   for (const auto& pkg : allowed_packages) {
     pkgids_.insert(pkg->GetPkgId());
-    allowed_paths_.emplace_back(pkg->GetRootPath() + ALLOWED_SUFFIX);
+    if (pkg->IsLib())
+      allowed_lib_paths_.emplace_back(
+          pkg->GetRootPath() + ALLOWED_SUFFIX + "/" + pkg->GetResType());
+    else
+      allowed_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);
+    if (pkg->IsLib())
+      global_lib_paths_.emplace_back(
+          pkg->GetRootPath() + GLOBAL_SUFFIX + "/" + pkg->GetResType());
+    else
+      global_paths_.emplace_back(pkg->GetRootPath() + GLOBAL_SUFFIX);
   }
 }
 
index 285c6e76d0c9d03ad3879e3d8022183e73bca64c..b7421a6cd5a56290b65c11a61d212a0bebf404ee 100644 (file)
@@ -44,11 +44,19 @@ class ResMountPackageInfo {
   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_;
+  }
 
  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_;
 };
 
 }  // namespace amd
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_;
 };