1 /* 2 * Copyright (C) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_FILE_UTILS_H_ 17 #define FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_FILE_UTILS_H_ 18 19 #include "thumbnail_data.h" 20 21 namespace OHOS { 22 namespace Media { 23 #define EXPORT __attribute__ ((visibility ("default"))) 24 class ThumbnailFileUtils { 25 public: 26 EXPORT ThumbnailFileUtils() = delete; 27 EXPORT virtual ~ThumbnailFileUtils() = delete; 28 29 EXPORT static std::string GetThumbnailSuffix(ThumbnailType type); 30 EXPORT static std::string GetThumbnailDir(const ThumbnailData &data); 31 EXPORT static std::string GetThumbExDir(const ThumbnailData &data); 32 EXPORT static bool GetThumbFileSize(const ThumbnailData &data, const ThumbnailType type, size_t& size); 33 EXPORT static bool DeleteThumbnailDir(const ThumbnailData &data); 34 EXPORT static bool DeleteAllThumbFiles(const ThumbnailData &data); 35 EXPORT static bool DeleteMonthAndYearAstc(const ThumbnailData &data); 36 EXPORT static bool BatchDeleteMonthAndYearAstc(const ThumbnailDataBatch &dataBatch); 37 EXPORT static bool DeleteThumbFile(const ThumbnailData &data, ThumbnailType type); 38 EXPORT static bool DeleteThumbExDir(const ThumbnailData &data); 39 EXPORT static bool DeleteBeginTimestampDir(const ThumbnailData &data); 40 EXPORT static bool CheckRemainSpaceMeetCondition(int32_t freeSizePercentLimit); 41 EXPORT static bool DeleteAstcDataFromKvStore(const ThumbnailData &data, const ThumbnailType &type); 42 EXPORT static bool BatchDeleteAstcData(const ThumbnailDataBatch &dataBatch, const ThumbnailType &type); 43 EXPORT static bool RemoveDirectoryAndFile(const std::string &path); 44 EXPORT static bool IsWifiConnected(); 45 }; 46 } // namespace Media 47 } // namespace OHOS 48 49 #endif // FRAMEWORKS_SERVICES_THUMBNAIL_SERVICE_INCLUDE_THUMBNAIL_FILE_UTILS_H_ 50