From d017b2a31b66bba4fce1a2a2a8c9a6b3c84f5de6 Mon Sep 17 00:00:00 2001 From: yujiahe Date: Sat, 30 Aug 2025 15:10:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=AE=BF=E9=97=AE=E8=AF=BB?= =?UTF-8?q?=E5=86=99=E5=8A=A0=E9=94=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yujiahe --- .../src/big_data_statistics/gallery_download_file_stat.cpp | 2 ++ .../cloud_file_kit_inner/src/data_sync/sync_state_manager.cpp | 1 - .../big_data_statistics/gallery_download_file_stat.h | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frameworks/native/cloud_file_kit_inner/src/big_data_statistics/gallery_download_file_stat.cpp b/frameworks/native/cloud_file_kit_inner/src/big_data_statistics/gallery_download_file_stat.cpp index f8368e2a7..897e7bdaf 100644 --- a/frameworks/native/cloud_file_kit_inner/src/big_data_statistics/gallery_download_file_stat.cpp +++ b/frameworks/native/cloud_file_kit_inner/src/big_data_statistics/gallery_download_file_stat.cpp @@ -219,6 +219,7 @@ void GalleryDownloadFileStat::IsSameBundleName(DownloadFileStatInfo info) void GalleryDownloadFileStat::OutputToFile() { + std::lock_guard lck(mutex_); DownloadFileStatInfo tmpInfo = ReadVecFromLocal(); IsSameBundleName(tmpInfo); @@ -307,6 +308,7 @@ int32_t GalleryDownloadFileStat::ReportDownloadFileStat(DownloadFileStatInfo inf void GalleryDownloadFileStat::Report() { + std::lock_guard lck(mutex_); const std::string path = DOWNLOAD_FILE_STAT_LOCAL_PATH + DOWNLOAD_FILE_STAT_NAME; if (access(path.c_str(), F_OK) == -1) { LOGE("download file statistics data file not exists"); diff --git a/frameworks/native/cloud_file_kit_inner/src/data_sync/sync_state_manager.cpp b/frameworks/native/cloud_file_kit_inner/src/data_sync/sync_state_manager.cpp index 06f37afea..4e89ccc7f 100644 --- a/frameworks/native/cloud_file_kit_inner/src/data_sync/sync_state_manager.cpp +++ b/frameworks/native/cloud_file_kit_inner/src/data_sync/sync_state_manager.cpp @@ -82,7 +82,6 @@ bool SyncStateManager::CheckMediaLibCleaning() uint64_t intervalTime = curTime - prevTime; LOGI("media clean time: %{public}s, cur: %{public}s", closeSwitchTime.c_str(), std::to_string(curTime).c_str()); if (prevTime > curTime || intervalTime >= TWELVE_HOURS_MILLISECOND) { - LOGE("prev closeSwitch over 12h, reset to 0"); system::SetParameter(CLOUDSYNC_SWITCH_STATUS, "0"); return false; } diff --git a/interfaces/inner_api/native/cloud_file_kit_inner/big_data_statistics/gallery_download_file_stat.h b/interfaces/inner_api/native/cloud_file_kit_inner/big_data_statistics/gallery_download_file_stat.h index c0421807d..51e59025c 100644 --- a/interfaces/inner_api/native/cloud_file_kit_inner/big_data_statistics/gallery_download_file_stat.h +++ b/interfaces/inner_api/native/cloud_file_kit_inner/big_data_statistics/gallery_download_file_stat.h @@ -14,6 +14,7 @@ */ #ifndef OHOS_CLOUD_FILE_SERVICE_GALLERY_DOWNLOAD_FILE_STAT_H #define OHOS_CLOUD_FILE_SERVICE_GALLERY_DOWNLOAD_FILE_STAT_H +#include #include #include @@ -68,6 +69,7 @@ private: void IsSameBundleName(DownloadFileStatInfo info); DownloadFileStatInfo stat_; + std::mutex mutex_; }; } // CloudFile } // FileManagement -- Gitee