From 37d1f9ac546d21a4020bc4d6b1a987e3f09291b3 Mon Sep 17 00:00:00 2001 From: baoyang Date: Mon, 19 Aug 2024 02:57:08 +0000 Subject: [PATCH] =?UTF-8?q?remove=20serialize=20and=20deserialize=20for=20?= =?UTF-8?q?VerifySavePermission=20=EF=BC=88cherry=20picked=20commit=20from?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security_component/src/sec_comp_proxy.cpp | 19 ++----------------- .../sa/sa_main/sec_comp_stub.cpp | 15 ++------------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp b/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp index 85e4819..f8eb802 100644 --- a/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp +++ b/interfaces/inner_api/security_component/src/sec_comp_proxy.cpp @@ -283,25 +283,17 @@ int32_t SecCompProxy::ReportSecurityComponentClickEvent(int32_t scId, bool SecCompProxy::VerifySavePermission(AccessToken::AccessTokenID tokenId) { std::lock_guard lock(useIPCMutex_); - MessageParcel rawData; MessageParcel data; if (!data.WriteInterfaceToken(SecCompProxy::GetDescriptor())) { SC_LOG_ERROR(LABEL, "Verify write descriptor failed."); return false; } - - if (!rawData.WriteUint32(tokenId)) { + if (!data.WriteUint32(tokenId)) { SC_LOG_ERROR(LABEL, "Verify write tokenId failed."); return false; } - if (!SecCompEnhanceAdapter::EnhanceClientSerialize(rawData, data)) { - SC_LOG_ERROR(LABEL, "Verify serialize session info failed."); - return false; - } - MessageParcel reply; - MessageParcel deserializedReply; MessageOption option(MessageOption::TF_SYNC); sptr remote = Remote(); if (remote == nullptr) { @@ -311,19 +303,12 @@ bool SecCompProxy::VerifySavePermission(AccessToken::AccessTokenID tokenId) int32_t requestResult = remote->SendRequest( static_cast(SecurityComponentServiceInterfaceCode::VERIFY_TEMP_SAVE_PERMISSION), data, reply, option); - - if (!SecCompEnhanceAdapter::EnhanceClientDeserialize(reply, deserializedReply)) { - SC_LOG_ERROR(LABEL, "Verify deserialize session info failed."); - return false; - } - if (requestResult != SC_OK) { SC_LOG_ERROR(LABEL, "Verify request failed, result: %{public}d.", requestResult); return false; } - bool res; - if (!deserializedReply.ReadBool(res)) { + if (!reply.ReadBool(res)) { SC_LOG_ERROR(LABEL, "Verify read res failed."); return false; } diff --git a/services/security_component_service/sa/sa_main/sec_comp_stub.cpp b/services/security_component_service/sa/sa_main/sec_comp_stub.cpp index b9aaabc..b50d932 100644 --- a/services/security_component_service/sa/sa_main/sec_comp_stub.cpp +++ b/services/security_component_service/sa/sa_main/sec_comp_stub.cpp @@ -232,13 +232,8 @@ int32_t SecCompStub::VerifySavePermissionInner(MessageParcel& data, MessageParce SC_LOG_ERROR(LABEL, "Not medialibrary called"); return SC_SERVICE_ERROR_CALLER_INVALID; } - MessageParcel deserializedData; - if (!SecCompEnhanceAdapter::EnhanceSrvDeserialize(data, deserializedData, reply)) { - SC_LOG_ERROR(LABEL, "Verify deserialize session info failed"); - return SC_SERVICE_ERROR_PARCEL_OPERATE_FAIL; - } uint32_t tokenId; - if (!deserializedData.ReadUint32(tokenId)) { + if (!data.ReadUint32(tokenId)) { SC_LOG_ERROR(LABEL, "Verify read component id failed"); return SC_SERVICE_ERROR_PARCEL_OPERATE_FAIL; } @@ -249,17 +244,11 @@ int32_t SecCompStub::VerifySavePermissionInner(MessageParcel& data, MessageParce } bool res = this->VerifySavePermission(tokenId); - MessageParcel rawReply; - if (!rawReply.WriteBool(res)) { + if (!reply.WriteBool(res)) { SC_LOG_ERROR(LABEL, "Verify temp save permission result failed"); return SC_SERVICE_ERROR_PARCEL_OPERATE_FAIL; } - if (!SecCompEnhanceAdapter::EnhanceSrvSerialize(rawReply, reply)) { - SC_LOG_ERROR(LABEL, "Verify serialize session info failed"); - return SC_SERVICE_ERROR_PARCEL_OPERATE_FAIL; - } - return SC_OK; } -- Gitee