From 1813b395532f8dd2e48fa822a4ec572e4ba72279 Mon Sep 17 00:00:00 2001 From: wangchen Date: Fri, 7 Mar 2025 09:43:00 +0800 Subject: [PATCH] =?UTF-8?q?idl=E5=8C=96=E5=89=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close #IBRFFC Signed-off-by: wangchen --- .../src/policy_info_parcel.cpp | 20 +++++++++++++++++++ .../sandbox_manager/include/policy_info.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/frameworks/sandbox_manager/src/policy_info_parcel.cpp b/frameworks/sandbox_manager/src/policy_info_parcel.cpp index 09d66ff..c82ee06 100644 --- a/frameworks/sandbox_manager/src/policy_info_parcel.cpp +++ b/frameworks/sandbox_manager/src/policy_info_parcel.cpp @@ -13,12 +13,32 @@ * limitations under the License. */ +#include "policy_info.h" #include "policy_info_parcel.h" #include "parcel_utils.h" namespace OHOS { namespace AccessControl { namespace SandboxManager { +bool PolicyInfo::Marshalling(Parcel &out) const +{ + RETURN_IF_FALSE(out.WriteString(this->path)); + RETURN_IF_FALSE(out.WriteUint64(this->mode)); + return true; +} + +PolicyInfo* PolicyInfo::Unmarshalling(Parcel &in) +{ + PolicyInfo* policyInfo = new (std::nothrow) PolicyInfo(); + if (policyInfo == nullptr) { + return nullptr; + } + + policyInfo->path = in.ReadString(); + RELEASE_IF_FALSE(in.ReadUint64(policyInfo->mode), policyInfo); + return policyInfo; +} + bool PolicyInfoParcel::Marshalling(Parcel &out) const { RETURN_IF_FALSE(out.WriteString(policyInfo.path)); diff --git a/interfaces/inner_api/sandbox_manager/include/policy_info.h b/interfaces/inner_api/sandbox_manager/include/policy_info.h index 9d56d35..ef602ed 100644 --- a/interfaces/inner_api/sandbox_manager/include/policy_info.h +++ b/interfaces/inner_api/sandbox_manager/include/policy_info.h @@ -18,12 +18,15 @@ #include #include +#include "parcel.h" namespace OHOS { namespace AccessControl { namespace SandboxManager { struct PolicyInfo final { public: + bool Marshalling(Parcel &out) const override; + static PolicyInfo* Unmarshalling(Parcel &in); std::string path; uint64_t mode; }; -- Gitee