From 0841dcbf9e61da5b9f249e9c8364781bf5a8941e Mon Sep 17 00:00:00 2001 From: y30045862 Date: Wed, 1 Nov 2023 12:12:07 +0800 Subject: [PATCH] testDiscon Signed-off-by: yangjingbo10 Change-Id: Id49341f801a8a1552bfcad4c00042a1f4d6137b6 --- .../src/module_ipc/svc_backup_connection.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) 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 4da0013a6..0e368f13f 100644 --- a/services/backup_sa/src/module_ipc/svc_backup_connection.cpp +++ b/services/backup_sa/src/module_ipc/svc_backup_connection.cpp @@ -21,7 +21,7 @@ #include "module_ipc/svc_session_manager.h" namespace OHOS::FileManagement::Backup { -constexpr int WAIT_TIME = 3; +// constexpr int WAIT_TIME = 3; using namespace std; void SvcBackupConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element, @@ -70,23 +70,23 @@ ErrCode SvcBackupConnection::ConnectBackupExtAbility(AAFwk::Want &want, int32_t ErrCode SvcBackupConnection::DisconnectBackupExtAbility() { - HILOGI("called begin"); - isConnectedDone_.store(true); - std::unique_lock lock(mutex_); - ErrCode ret = AppExecFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(this); - auto callback = [extConn {wptr(this)}] { - auto extPtr = extConn.promote(); - if (!extPtr) { - HILOGE("Dis connect failed"); - return false; - } - return extPtr->GetBackupExtProxy() == nullptr; - }; - if (condition_.wait_for(lock, std::chrono::seconds(WAIT_TIME), callback)) { - HILOGI("Wait until the connection ends"); - } - HILOGI("called end, ret=%{public}d", ret); - return ret; + HILOGI("called begin"); + // isConnectedDone_.store(true); + // std::unique_lock lock(mutex_); + // ErrCode ret = AppExecFwk::AbilityManagerClient::GetInstance()->DisconnectAbility(this); + // auto callback = [extConn {wptr(this)}] { + // auto extPtr = extConn.promote(); + // if (!extPtr) { + // HILOGE("Dis connect failed"); + // return false; + // } + // return extPtr->GetBackupExtProxy() == nullptr; + // }; + // if (condition_.wait_for(lock, std::chrono::seconds(WAIT_TIME), callback)) { + // HILOGI("Wait until the connection ends"); + // } + // HILOGI("called end, ret=%{public}d", ret); + return 0; } bool SvcBackupConnection::IsExtAbilityConnected() -- Gitee