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 c0bbd4118f7b4714c84e220279952a17cc5a86a8..0fb129e8f1432c0a1e8f60b4f4d0e419b82216de 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::HandleBundleName(const DownloadFileStatInfo &info) void GalleryDownloadFileStat::OutputToFile() { + std::lock_guard lck(mutex_); DownloadFileStatInfo tmpInfo = ReadVecFromLocal(); HandleBundleName(tmpInfo); @@ -307,6 +308,7 @@ int32_t GalleryDownloadFileStat::ReportDownloadFileStat(const DownloadFileStatIn 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 97c2589d8bc5cb7243f6e943f92199f534bf55e5..3268f0acc6b823e74a204703d86b43055e25355f 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 @@ -84,7 +84,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"); CLOUD_SYNC_FAULT_REPORT({"", CloudFile::FaultScenarioCode::CLOUD_SWITCH_CLOSE, CloudFile::FaultType::TIMEOUT, E_TIMEOUT, "media clean time is: " + closeSwitchTime + " over 12h"}); 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 967d0992622cccb9c57852d1a94d1ebf9913156f..1c30900d7d6828de7e1665b062d837ae32b56e96 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 HandleBundleName(const DownloadFileStatInfo &info); DownloadFileStatInfo stat_; + std::mutex mutex_; }; } // CloudFile } // FileManagement