From d0d6f3ff2e4043682956f9f323a075812d74bda5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B8=8A?= Date: Fri, 12 Sep 2025 18:49:42 +0800 Subject: [PATCH] fix warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘渊 --- frameworks/native/backup_ext/src/ext_extension.cpp | 8 ++++++-- .../app_gallery_service_connection.cpp | 1 + services/backup_sa/src/module_ipc/sub_service.cpp | 10 +++++----- .../src/module_ipc/svc_restore_deps_manager.cpp | 2 ++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index b60105562..3a3d5e1ed 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -1602,11 +1602,15 @@ void BackupExtExtension::AsyncTaskIncreRestoreSpecialVersion() auto ptr = obj.promote(); BExcepUltils::BAssert(ptr, BError::Codes::EXT_BROKEN_FRAMEWORK, "Ext extension handle have been released"); try { - if (ptr != nullptr && ptr->isDebug_) { + if (ptr == nullptr) { + HILOGE("extension is null"); + return; + } + if (ptr->isDebug_) { ptr->CheckTmpDirFileInfos(true); } int ret = ptr->RestoreFilesForSpecialCloneCloud(); - if (ptr != nullptr && ptr->isDebug_) { + if (ptr->isDebug_) { ptr->CheckRestoreFileInfos(); } if (ret == ERR_OK) { diff --git a/services/backup_sa/src/module_app_gallery/app_gallery_service_connection.cpp b/services/backup_sa/src/module_app_gallery/app_gallery_service_connection.cpp index 67989821c..8ea55a0a4 100644 --- a/services/backup_sa/src/module_app_gallery/app_gallery_service_connection.cpp +++ b/services/backup_sa/src/module_app_gallery/app_gallery_service_connection.cpp @@ -29,6 +29,7 @@ void AppGalleryConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &e { std::string uri = element.GetURI(); HILOGI("OnAbilityConnectDone, uri = %{public}s", uri.c_str()); + std::lock_guard autoLock(appRemoteObjLock_); appRemoteObj_ = remoteObject; conditionVal_.notify_one(); } diff --git a/services/backup_sa/src/module_ipc/sub_service.cpp b/services/backup_sa/src/module_ipc/sub_service.cpp index 18a8c5978..a0503c4f2 100644 --- a/services/backup_sa/src/module_ipc/sub_service.cpp +++ b/services/backup_sa/src/module_ipc/sub_service.cpp @@ -155,14 +155,14 @@ bool Service::IsReportFileReadyFail(const std::string &bundleName) auto it = fileReadyRadarMap_.find(bundleName); if (it != fileReadyRadarMap_.end()) { it->second++; + if (it->second > MAX_FILE_READY_REPORT_TIME) { + HILOGI("FileReady radar report more than %{public}d times, bundleName = %{public}s", + MAX_FILE_READY_REPORT_TIME, bundleName.c_str()); + return false; + } } else { fileReadyRadarMap_[bundleName] = 1; } - if (it->second > MAX_FILE_READY_REPORT_TIME) { - HILOGI("FileReady radar report more than %{public}d times, bundleName = %{public}s", - MAX_FILE_READY_REPORT_TIME, bundleName.c_str()); - return false; - } return true; } diff --git a/services/backup_sa/src/module_ipc/svc_restore_deps_manager.cpp b/services/backup_sa/src/module_ipc/svc_restore_deps_manager.cpp index 10932eb32..432d5763e 100644 --- a/services/backup_sa/src/module_ipc/svc_restore_deps_manager.cpp +++ b/services/backup_sa/src/module_ipc/svc_restore_deps_manager.cpp @@ -138,11 +138,13 @@ void SvcRestoreDepsManager::AddRestoredBundles(const string &bundleName) vector SvcRestoreDepsManager::GetAllBundles() const { + shared_lock lock(lock_); return allBundles_; } bool SvcRestoreDepsManager::IsAllBundlesRestored() const { + shared_lock lock(lock_); return toRestoreBundleMap_.empty(); } -- Gitee