diff --git a/frameworks/native/backup_kit_inner/src/service_proxy.cpp b/frameworks/native/backup_kit_inner/src/service_proxy.cpp index e05fb51381c173b4f8be2c2fa6348fe17f04bfbf..ebf80bf707fcef251cc7188b0c1b9a96b9624be8 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 20dedbbba63d611e3bba1ef1d20f69e42768cb8d..1efd2af05f1b33b946368720ae4ee05b53daf2e8 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 048d1f3aa099545b8e988274940dc321709c0844..8fc298baad2d4f88f65a5afeb56611aca122c5a5 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");