From 538f92f4c9ea41babd89666f695284ae1afdbf85 Mon Sep 17 00:00:00 2001 From: "yaoruozi1@huawei.com" Date: Wed, 5 Mar 2025 16:43:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=BB=E4=BA=A1=E7=9B=91=E5=90=AC=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yaoruozi1@huawei.com --- .../src/b_incremental_backup_session.cpp | 19 ++----------------- .../src/b_incremental_restore_session.cpp | 19 ++----------------- .../b_incremental_session_restore_async.cpp | 18 +----------------- .../backup_kit_inner/src/b_session_backup.cpp | 19 ++----------------- .../src/b_session_restore.cpp | 2 +- .../src/b_session_restore_async.cpp | 18 +----------------- .../backup_kit_inner/src/service_proxy.cpp | 2 +- 7 files changed, 10 insertions(+), 87 deletions(-) diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_backup_session.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_backup_session.cpp index 97de333ab..3908144a5 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_backup_session.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_backup_session.cpp @@ -24,22 +24,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; -BIncrementalBackupSession::~BIncrementalBackupSession() -{ - if (!deathRecipient_) { - HILOGI("Death Recipient is nullptr"); - return; - } - auto proxy = ServiceProxy::GetServiceProxyPointer(); - if (proxy == nullptr) { - return; - } - auto remoteObject = proxy->AsObject(); - if (remoteObject != nullptr) { - remoteObject->RemoveDeathRecipient(deathRecipient_); - } - deathRecipient_ = nullptr; -} +BIncrementalBackupSession::~BIncrementalBackupSession() {} unique_ptr BIncrementalBackupSession::Init(Callbacks callbacks) { @@ -112,7 +97,7 @@ void BIncrementalBackupSession::RegisterBackupServiceDied(function funct auto callback = [functor](const wptr &obj) { ServiceProxy::InvaildInstance(); - HILOGI("Backup service died"); + HILOGI("RegisterBackupServiceDied, Backup service died"); functor(); }; deathRecipient_ = sptr(new SvcDeathRecipient(callback)); diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp index 97468695a..28dfb51bf 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_restore_session.cpp @@ -24,22 +24,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; -BIncrementalRestoreSession::~BIncrementalRestoreSession() -{ - if (!deathRecipient_) { - HILOGI("Death Recipient is nullptr"); - return; - } - auto proxy = ServiceProxy::GetServiceProxyPointer(); - if (proxy == nullptr) { - return; - } - auto remoteObject = proxy->AsObject(); - if (remoteObject != nullptr) { - remoteObject->RemoveDeathRecipient(deathRecipient_); - } - deathRecipient_ = nullptr; -} +BIncrementalRestoreSession::~BIncrementalRestoreSession() {} unique_ptr BIncrementalRestoreSession::Init(Callbacks callbacks) { @@ -206,7 +191,7 @@ void BIncrementalRestoreSession::RegisterBackupServiceDied(function func } auto callback = [functor](const wptr &obj) { - HILOGI("Backup service died"); + HILOGI("RegisterBackupServiceDied, Backup service died"); ServiceProxy::InvaildInstance(); functor(); }; diff --git a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp index 170a50db6..a8a50a864 100644 --- a/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_incremental_session_restore_async.cpp @@ -25,23 +25,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; -BIncrementalSessionRestoreAsync::~BIncrementalSessionRestoreAsync() -{ - if (!deathRecipient_) { - HILOGE("Death Recipient is nullptr"); - return; - } - auto proxy = ServiceProxy::GetServiceProxyPointer(); - if (proxy == nullptr) { - return; - } - auto remoteObject = proxy->AsObject(); - if (remoteObject != nullptr) { - remoteObject->RemoveDeathRecipient(deathRecipient_); - } - callbacks_ = {}; - deathRecipient_ = nullptr; -} +BIncrementalSessionRestoreAsync::~BIncrementalSessionRestoreAsync() {} shared_ptr BIncrementalSessionRestoreAsync::Init(Callbacks callbacks) { diff --git a/frameworks/native/backup_kit_inner/src/b_session_backup.cpp b/frameworks/native/backup_kit_inner/src/b_session_backup.cpp index 08e085331..258bed60c 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_backup.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_backup.cpp @@ -24,22 +24,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; -BSessionBackup::~BSessionBackup() -{ - if (!deathRecipient_) { - HILOGI("Death Recipient is nullptr"); - return; - } - auto proxy = ServiceProxy::GetServiceProxyPointer(); - if (proxy == nullptr) { - return; - } - auto remoteObject = proxy->AsObject(); - if (remoteObject != nullptr) { - remoteObject->RemoveDeathRecipient(deathRecipient_); - } - deathRecipient_ = nullptr; -} +BSessionBackup::~BSessionBackup() {} unique_ptr BSessionBackup::Init(Callbacks callbacks) { @@ -112,7 +97,7 @@ void BSessionBackup::RegisterBackupServiceDied(std::function functor) auto callback = [functor](const wptr &obj) { ServiceProxy::InvaildInstance(); - HILOGI("Backup service died"); + HILOGI("RegisterBackupServiceDied, Backup service died"); functor(); }; deathRecipient_ = sptr(new SvcDeathRecipient(callback)); diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp index 21fbc125f..0771c9721 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore.cpp @@ -185,7 +185,7 @@ void BSessionRestore::RegisterBackupServiceDied(std::function functor) } auto callback = [functor](const wptr &obj) { - HILOGI("Backup service died"); + HILOGI("RegisterBackupServiceDied, Backup service died"); ServiceProxy::InvaildInstance(); functor(); }; diff --git a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp index a60c56462..ccd0e62b9 100644 --- a/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp +++ b/frameworks/native/backup_kit_inner/src/b_session_restore_async.cpp @@ -26,23 +26,7 @@ namespace OHOS::FileManagement::Backup { using namespace std; -BSessionRestoreAsync::~BSessionRestoreAsync() -{ - if (!deathRecipient_) { - HILOGI("Death Recipient is nullptr"); - return; - } - auto proxy = ServiceProxy::GetServiceProxyPointer(); - if (proxy == nullptr) { - return; - } - auto remoteObject = proxy->AsObject(); - if (remoteObject != nullptr) { - remoteObject->RemoveDeathRecipient(deathRecipient_); - } - callbacks_ = {}; - deathRecipient_ = nullptr; -} +BSessionRestoreAsync::~BSessionRestoreAsync() {} shared_ptr BSessionRestoreAsync::Init(Callbacks callbacks) { diff --git a/frameworks/native/backup_kit_inner/src/service_proxy.cpp b/frameworks/native/backup_kit_inner/src/service_proxy.cpp index 187f69ef7..efdeaeede 100644 --- a/frameworks/native/backup_kit_inner/src/service_proxy.cpp +++ b/frameworks/native/backup_kit_inner/src/service_proxy.cpp @@ -560,7 +560,7 @@ void ServiceProxy::ServiceProxyLoadCallback::OnLoadSystemAbilitySuccess(int32_t auto callback = [](const wptr &obj) { ServiceProxy::InvaildInstance(); - HILOGE("Backup service died"); + HILOGE("OnLoadSystemAbilitySuccess, Backup service died"); }; sptr deathRecipient = sptr(new SvcDeathRecipient(callback)); remoteObj->AddDeathRecipient(deathRecipient); -- Gitee