diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index b601055620cc1d8b7004aba9ef3b9336bee80176..3a3d5e1ed1939e274cd13bf888a5cf9b1c7887b6 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 67989821c59ee32b4b8ec3817c26cb7e224c1de7..8ea55a0a4891904a3871f5343df9bb73b748c255 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 18a8c5978747bbae083989aac7ccfb29376a4aec..a0503c4f2a5ca31fb1cc4935443a4849a5bf3f8f 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 10932eb329b039ae4f6395bcece62558ec9bf7c2..432d5763ef00883f1f93411d24bdd47d1cb637d2 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(); }