From 2b78c54ab9a4e426ebfd40a9c5be5406f19d71fb Mon Sep 17 00:00:00 2001 From: huaqingsimeng <1004904143@qq.com> Date: Thu, 23 Mar 2023 01:41:39 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E6=81=A2=E5=A4=8D=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E8=BF=94=E5=9B=9E=E5=80=BC=E8=A7=84=E8=8C=83=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huaqingsimeng --- .../native/backup_ext/src/ext_extension_stub.cpp | 15 +++++++-------- .../backup_kit_inner/src/service_reverse_stub.cpp | 14 ++++++-------- .../backup_sa/src/module_ipc/service_stub.cpp | 15 +++++++-------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/frameworks/native/backup_ext/src/ext_extension_stub.cpp b/frameworks/native/backup_ext/src/ext_extension_stub.cpp index f78037b07..ea15ecb6d 100644 --- a/frameworks/native/backup_ext/src/ext_extension_stub.cpp +++ b/frameworks/native/backup_ext/src/ext_extension_stub.cpp @@ -39,20 +39,19 @@ int32_t ExtExtensionStub::OnRemoteRequest(uint32_t code, MessageParcel &reply, MessageOption &option) { - HILOGI("Begin to call procedure indexed %{public}u", code); - auto interfaceIndex = opToInterfaceMap_.find(code); - if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { - stringstream ss; - ss << "Cannot response request " << code << ": unknown procedure"; - return BError(BError::Codes::EXT_INVAL_ARG, ss.str()); - } - const std::u16string descriptor = ExtExtensionStub::GetDescriptor(); const std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { return BError(BError::Codes::EXT_INVAL_ARG, "Invalid remote descriptor"); } + HILOGI("Begin to call procedure indexed %{public}u", code); + auto interfaceIndex = opToInterfaceMap_.find(code); + if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { + HILOGE("Cannot response request %{public}d : unknown procedure", code); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + return ExceptionCatcherLocked([&]() { return ErrCode((this->*(interfaceIndex->second))(data, reply)); }); } diff --git a/frameworks/native/backup_kit_inner/src/service_reverse_stub.cpp b/frameworks/native/backup_kit_inner/src/service_reverse_stub.cpp index 9445a28de..b9299c68f 100644 --- a/frameworks/native/backup_kit_inner/src/service_reverse_stub.cpp +++ b/frameworks/native/backup_kit_inner/src/service_reverse_stub.cpp @@ -29,20 +29,18 @@ int32_t ServiceReverseStub::OnRemoteRequest(uint32_t code, MessageParcel &reply, MessageOption &option) { - HILOGI("Begin to call procedure indexed %{public}u", code); - auto interfaceIndex = opToInterfaceMap_.find(code); - if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { - stringstream ss; - ss << "Cannot response request " << code << ": unknown procedure"; - return BError(BError::Codes::SA_INVAL_ARG, ss.str()); - } - const std::u16string descriptor = ServiceReverseStub::GetDescriptor(); const std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { return BError(BError::Codes::SA_INVAL_ARG, "Invalid remote descriptor"); } + HILOGI("Begin to call procedure indexed %{public}u", code); + auto interfaceIndex = opToInterfaceMap_.find(code); + if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { + HILOGE("Cannot response request %{public}d : unknown procedure", code); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } return (this->*(interfaceIndex->second))(data, reply); } diff --git a/services/backup_sa/src/module_ipc/service_stub.cpp b/services/backup_sa/src/module_ipc/service_stub.cpp index 8134ca92a..21f25220f 100644 --- a/services/backup_sa/src/module_ipc/service_stub.cpp +++ b/services/backup_sa/src/module_ipc/service_stub.cpp @@ -44,20 +44,19 @@ ServiceStub::ServiceStub() int32_t ServiceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - HILOGI("Begin to call procedure indexed %{public}u", code); - auto interfaceIndex = opToInterfaceMap_.find(code); - if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { - stringstream ss; - ss << "Cannot response request " << code << ": unknown procedure"; - return BError(BError::Codes::SA_INVAL_ARG, ss.str()); - } - const std::u16string descriptor = ServiceStub::GetDescriptor(); const std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { return BError(BError::Codes::SA_INVAL_ARG, "Invalid remote descriptor"); } + HILOGI("Begin to call procedure indexed %{public}u", code); + auto interfaceIndex = opToInterfaceMap_.find(code); + if (interfaceIndex == opToInterfaceMap_.end() || !interfaceIndex->second) { + HILOGE("Cannot response request %{public}d : unknown procedure", code); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + } + return (this->*(interfaceIndex->second))(data, reply); } -- Gitee