diff --git a/appdata-sandbox.json b/appdata-sandbox.json index 042036502fe442291b2fe85b6add334af4423603..c25d328951a08d624018a5ec2892bcc61ca73c6e 100755 --- a/appdata-sandbox.json +++ b/appdata-sandbox.json @@ -920,7 +920,7 @@ "src-path" : "", "sandbox-path" : "", "sandbox-flags" : [], - "dec-paths": [ "/mnt/data/fuse", "/mnt/sandbox/*//storage/Users/currentUser" ] + "dec-paths": [ "/mnt/data/fuse", "/mnt/sandbox///storage/Users/currentUser" ] } ] }], diff --git a/modules/sandbox/normal/sandbox_common.cpp b/modules/sandbox/normal/sandbox_common.cpp index 5552befe9b3abd258c54a9da4c363a64f6eec2d8..614e71dfda64c31150ce42d5933399067d1f2ca6 100644 --- a/modules/sandbox/normal/sandbox_common.cpp +++ b/modules/sandbox/normal/sandbox_common.cpp @@ -897,7 +897,8 @@ std::string SandboxCommon::ConvertToRealPathWithPermission(const AppSpawningCtx { AppSpawnMsgBundleInfo *info = reinterpret_cast(GetAppProperty(appProperty, TLV_BUNDLE_INFO)); - if (info == nullptr) { + AppSpawnMsgDacInfo *dacInfo = reinterpret_cast(GetAppProperty(appProperty, TLV_DAC_INFO)); + if (info == nullptr || dacInfo == nullptr) { return ""; } if (path.find(SandboxCommonDef::g_packageNameIndex) != std::string::npos) { @@ -915,6 +916,10 @@ std::string SandboxCommon::ConvertToRealPathWithPermission(const AppSpawningCtx if (path.find(SandboxCommonDef::g_userId) != std::string::npos) { path = ReplaceAllVariables(path, SandboxCommonDef::g_userId, "currentUser"); } + + if (path.find(SandboxCommonDef::g_permissionUserId) != std::string::npos) { + path = ReplaceAllVariables(path, SandboxCommonDef::g_permissionUserId, std::to_string(dacInfo->uid / UID_BASE)); + } return path; } diff --git a/modules/sandbox/normal/sandbox_def.h b/modules/sandbox/normal/sandbox_def.h index 06c81e7b0c798258b11e56010f96f188d5ce0d0a..e0dcfdc8c797c68fd03a01bcf0c69858b0e188bb 100644 --- a/modules/sandbox/normal/sandbox_def.h +++ b/modules/sandbox/normal/sandbox_def.h @@ -86,6 +86,7 @@ constexpr const char *g_gidPrefix = "gids"; // 可变参数 const std::string g_userId = ""; +const std::string g_permissionUserId = ""; const std::string g_permissionUser = ""; const std::string g_packageName = ""; const std::string g_packageNameIndex = "";