return 0;
}
-int _resinfo_get_res_package_paths(const char* appid, uid_t uid,
- GList** allowed_paths, GList** global_paths) {
+int _resinfo_get_res_packages_info(const char* appid, uid_t uid,
+ GList** pkgids, GList** allowed_paths, GList** global_paths) {
amd::ResInfoManager& manager = amd::ResInfoManager::GetInst();
- std::vector<std::string> allowed_p, global_p;
+ std::vector<std::string> pkgid_v, allowed_p, global_p;
std::shared_ptr<amd::ResInfo> resinfo = manager.GetUserResInfo(uid);
if (!resinfo)
res_appinfo->ClearResControlMountInfo();
res_appinfo->UpdateResControlMountInfo(resinfo->GetResPkgs());
- res_appinfo->GetMountPackagePaths(&allowed_p, &global_p);
+ res_appinfo->GetMountPackagesInfo(&pkgid_v, &allowed_p, &global_p);
+
+ for (const std::string& pkgid : pkgid_v)
+ *pkgids = g_list_append(*pkgids, strdup(pkgid.c_str()));
for (const std::string& root_path : allowed_p) {
std::string p = root_path + "/res/allowed/";
int _resinfo_init(void);
-int _resinfo_get_res_package_paths(const char *appid, uid_t uid,
- GList **allowed_paths, GList **global_paths);
+int _resinfo_get_res_packages_info(const char *appid, uid_t uid,
+ GList **pkgids, GList **allowed_paths, GList **global_paths);
#ifdef __cplusplus
}
constexpr const char OSP_K_LAUNCH_TYPE[] = "__OSP_LAUNCH_TYPE__";
constexpr const char OSP_V_LAUNCH_TYPE_DATACONTROL[] = "datacontrol";
-void AddResPaths(GList* list, bundle* b, const char* key) {
+void AddDataToBundle(GList* list, bundle* b, const char* key) {
bundle_del(b, key);
guint length = g_list_length(list);
if (length == 0)
}
int StepPrepareStartingApp::SetResPackagePaths(LaunchContext* context) {
+ GList* res_pkgids = nullptr;
GList* allowed_paths = nullptr;
GList* global_paths = nullptr;
- if (_resinfo_get_res_package_paths(context->GetAppId().c_str(),
- context->GetTargetUid(), &allowed_paths, &global_paths) < 0) {
+ if (_resinfo_get_res_packages_info(context->GetAppId().c_str(),
+ context->GetTargetUid(), &res_pkgids, &allowed_paths,
+ &global_paths) < 0) {
_E("Failed to get res package paths");
return -1;
}
- AddResPaths(allowed_paths, context->GetBundle(), AUL_K_MOUNT_ALLOWED_RES_DIR);
- AddResPaths(global_paths, context->GetBundle(), AUL_K_MOUNT_GLOBAL_RES_DIR);
+ AddDataToBundle(res_pkgids, context->GetBundle(), AUL_K_MOUNT_RES_PKGIDS);
+ AddDataToBundle(allowed_paths, context->GetBundle(),
+ AUL_K_MOUNT_ALLOWED_RES_DIR);
+ AddDataToBundle(global_paths, context->GetBundle(),
+ AUL_K_MOUNT_GLOBAL_RES_DIR);
+ g_list_free_full(res_pkgids, free);
g_list_free_full(allowed_paths, free);
g_list_free_full(global_paths, free);
return 0;
}
}
-void ResAppInfo::GetMountPackagePaths(std::vector<std::string>* allowed_paths,
+void ResAppInfo::GetMountPackagesInfo(std::vector<std::string>* pkgids,
+ std::vector<std::string>* allowed_paths,
std::vector<std::string>* global_paths) {
for (const auto& res_control : res_control_list_) {
- if (res_control.allowed_package)
+ if (res_control.allowed_package) {
+ pkgids->push_back(res_control.allowed_package->GetPkgId());
allowed_paths->push_back(res_control.allowed_package->GetRootPath());
- if (res_control.global_package)
+ }
+ if (res_control.global_package) {
+ pkgids->push_back(res_control.global_package->GetPkgId());
global_paths->push_back(res_control.global_package->GetRootPath());
+ }
}
}
const std::unordered_map<std::string,
std::shared_ptr<ResPkgInfo>>& res_pkgs);
void UpdateResControlMountInfo(std::shared_ptr<ResPkgInfo> res_pkginfo);
- void GetMountPackagePaths(std::vector<std::string>* allowed_paths,
+ void GetMountPackagesInfo(std::vector<std::string>* pkgids,
+ std::vector<std::string>* allowed_paths,
std::vector<std::string>* global_paths);
private: