From c333f64ec0c838c0b7609c8b524def3ae8b0528e Mon Sep 17 00:00:00 2001 From: chensihan Date: Wed, 13 Nov 2024 18:44:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Signed-off-by:=20chensihan?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backup_kit_inner/src/service_proxy.cpp | 6 ++++-- .../backup_sa/src/module_ipc/service_stub.cpp | 16 ++-------------- .../src/module_ipc/svc_backup_connection.cpp | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/frameworks/native/backup_kit_inner/src/service_proxy.cpp b/frameworks/native/backup_kit_inner/src/service_proxy.cpp index e05fb5138..ebf80bf70 100644 --- a/frameworks/native/backup_kit_inner/src/service_proxy.cpp +++ b/frameworks/native/backup_kit_inner/src/service_proxy.cpp @@ -201,13 +201,14 @@ ErrCode ServiceProxy::AppDone(ErrCode errCode) MessageParcel reply; MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); int32_t ret = Remote()->SendRequest(static_cast(IServiceInterfaceCode::SERVICE_CMD_APP_DONE), data, reply, option); if (ret != NO_ERROR) { string str = "Failed to send out the request because of " + to_string(ret); return BError(BError::Codes::SDK_INVAL_ARG, str.data()).GetCode(); } - return reply.ReadInt32(); + return ret; } ErrCode ServiceProxy::ServiceResultReport(const std::string restoreRetInfo, @@ -230,6 +231,7 @@ ErrCode ServiceProxy::ServiceResultReport(const std::string restoreRetInfo, } MessageParcel reply; MessageOption option; + option.SetFlags(MessageOption::TF_ASYNC); int32_t ret = Remote()->SendRequest(static_cast(IServiceInterfaceCode::SERVICE_CMD_RESULT_REPORT), data, reply, option); @@ -237,7 +239,7 @@ ErrCode ServiceProxy::ServiceResultReport(const std::string restoreRetInfo, string str = "Failed to send out the request because of " + to_string(ret); return BError(BError::Codes::SDK_INVAL_ARG, str.data()).GetCode(); } - return reply.ReadInt32(); + return ret; } ErrCode ServiceProxy::GetFileHandle(const string &bundleName, const string &fileName) diff --git a/services/backup_sa/src/module_ipc/service_stub.cpp b/services/backup_sa/src/module_ipc/service_stub.cpp index 20dedbbba..1efd2af05 100644 --- a/services/backup_sa/src/module_ipc/service_stub.cpp +++ b/services/backup_sa/src/module_ipc/service_stub.cpp @@ -236,13 +236,7 @@ int32_t ServiceStub::CmdAppDone(MessageParcel &data, MessageParcel &reply) if (!data.ReadInt32(errCode)) { return BError(BError::Codes::SA_INVAL_ARG, "Failed to receive errCode"); } - int res = AppDone(errCode); - if (!reply.WriteInt32(res)) { - stringstream ss; - ss << "Failed to send the result " << res; - return BError(BError::Codes::SA_BROKEN_IPC, ss.str()); - } - return BError(BError::Codes::OK); + return AppDone(errCode); } int32_t ServiceStub::CmdResultReport(MessageParcel &data, MessageParcel &reply) @@ -260,13 +254,7 @@ int32_t ServiceStub::CmdResultReport(MessageParcel &data, MessageParcel &reply) if (!data.ReadInt32(errCode)) { return BError(BError::Codes::SA_INVAL_ARG, "Failed to receive errCode"); } - int res = ServiceResultReport(restoreRetInfo, secenrioInfo, errCode); - if (!reply.WriteInt32(res)) { - stringstream ss; - ss << "Failed to send the result " << res; - return BError(BError::Codes::SA_BROKEN_IPC, ss.str()); - } - return BError(BError::Codes::OK); + return ServiceResultReport(restoreRetInfo, secenrioInfo, errCode); } int32_t ServiceStub::CmdGetFileHandle(MessageParcel &data, MessageParcel &reply) diff --git a/services/backup_sa/src/module_ipc/svc_backup_connection.cpp b/services/backup_sa/src/module_ipc/svc_backup_connection.cpp index 048d1f3aa..8fc298baa 100644 --- a/services/backup_sa/src/module_ipc/svc_backup_connection.cpp +++ b/services/backup_sa/src/module_ipc/svc_backup_connection.cpp @@ -125,7 +125,7 @@ ErrCode SvcBackupConnection::DisconnectBackupExtAbility() HILOGE("Dis connect failed"); return false; } - return extPtr->GetBackupExtProxy() == nullptr; + return extPtr->isConnected_.load() == false; }; if (condition_.wait_for(lock, std::chrono::seconds(WAIT_TIME), callback)) { HILOGI("Wait until the connection ends"); -- Gitee