1 /* 2 * Copyright (C) 2024 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 OHOS_MEDIA_DFX_CONST_H 17 #define OHOS_MEDIA_DFX_CONST_H 18 19 #include <string> 20 #include <unordered_set> 21 22 #include "userfile_manager_types.h" 23 24 namespace OHOS { 25 namespace Media { 26 constexpr int32_t IMAGE_MIN = 4096; 27 constexpr int32_t VIDEO_8K_MIN = 7680; 28 29 constexpr int32_t COMMON_TIME_OUT = 200; 30 constexpr int32_t OPEN_FILE_TIME_OUT = 500; 31 constexpr int32_t CLOUD_DEFAULT_TIME_OUT = 100; 32 constexpr int32_t CLOUD_LCD_TIME_OUT = 800; 33 constexpr int32_t RDB_TIME_OUT = 100; 34 constexpr int32_t TO_MILLION = 1000; 35 constexpr int32_t ONE_MINUTE = 60; 36 constexpr int32_t ONE_HOUR = 60 * 60; 37 constexpr int32_t FIVE_MINUTE = 5 * 60 * 1000; 38 constexpr int32_t SIX_HOUR = 6 * 60 * 60; 39 constexpr int32_t HALF_DAY = 12 * 60 * 60; 40 constexpr int32_t ONE_DAY = 24 * 60 * 60; 41 constexpr int32_t TWO_DAY = 48 * 60 * 60; 42 constexpr int32_t ONE_WEEK = 7 * 24 * 60 * 60; 43 constexpr int64_t THIRTY_DAYS = 30 * 24 * 60 * 60; 44 45 constexpr int32_t NOT_INIT = -1; 46 constexpr int32_t COMMON_IMAGE = 0; 47 constexpr int32_t COMMON_VIDEO = 1; 48 constexpr int32_t OTHER_FORMAT_IMAGE = 2; 49 constexpr int32_t BIG_IMAGE = 3; 50 constexpr int32_t BIG_VIDEO = 4; 51 52 constexpr int32_t INVALID_DFX = -1; 53 54 constexpr uint32_t GARBLE_SMALL = 3; 55 constexpr uint32_t GARBLE_LARGE = 8; 56 constexpr uint32_t GARBLE_LAST_TWO = 2; 57 constexpr uint32_t GARBLE_LAST_ONE = 1; 58 59 constexpr int32_t LATEST_THUMBNAIL_ERROR_VERSION = 1; 60 constexpr int32_t LATEST_DELETE_STATISTIC_VERSION = 1; 61 62 constexpr int32_t DIRTY_PHOTO_COUNT = 10; 63 64 /** 65 * the number from 0 ~ 1000 is reserved for operationtype 66 */ 67 enum DfxType { 68 ALBUM_REMOVE_PHOTOS = 17, 69 DELETE_LOCAL_ASSETS_PERMANENTLY = 18, 70 ALBUM_DELETE_ASSETS = 19, 71 TRASH_PHOTO = 20, 72 CLOUD_DEFAULT_OPEN = 1000, 73 CLOUD_LCD_OPEN, 74 RDB_INSERT = 1100, 75 RDB_DELETE, 76 RDB_UPDATE, 77 RDB_UPDATE_BY_CMD, 78 RDB_QUERY, 79 RDB_EXECUTE_SQL, 80 RDB_BATCHINSERT, 81 IMAGE_SOURCE_CREATE = 1200, 82 IMAGE_SOURCE_GET_INFO, 83 IMAGE_SOURCE_CREATE_PIXELMAP, 84 AV_SET_SOURCE = 1300, 85 AV_FETCH_FRAME, 86 START_SUCCESS = 1400, 87 START_CONTEXT_FAIL, 88 START_DATAMANAGER_FAIL, 89 START_RDB_STORE_FAIL, 90 START_DISTRIBUTE_FAIL, 91 START_DIR_SET_FAIL, 92 START_THUMBNAIL_SERVICE_FAIL, 93 START_SCANNER_FAIL, 94 CHECK_USER_UNLOCK_FAIL, 95 ADD_DATA_UNIQUE_INDEX_FAIL, 96 CHECK_MEDIA_PATH_UNLOCK_FAIL, 97 START_MOUNT_FUSE_FAIL, 98 START_FUSE_DAEMON_FAIL, 99 FUSE_OPEN = 1500, 100 FUSE_RELEASE, 101 FUSE_WRITE, 102 FUSE_READ 103 }; 104 105 const std::string NULL_STRING = ""; 106 const std::string SPLIT_CHAR = "|"; 107 108 const std::string THUMBNAIL_ERROR_XML = "/data/storage/el2/base/preferences/thumbnail_error.xml"; 109 const std::string COMMON_BEHAVIOR_XML = "/data/storage/el2/base/preferences/common_behavior.xml"; 110 const std::string DELETE_BEHAVIOR_XML = "/data/storage/el2/base/preferences/delete_behavior.xml"; 111 const std::string ADAPTATION_TO_MOVING_PHOTO_XML = "/data/storage/el2/base/preferences/adaptation_to_moving_photo.xml"; 112 const std::string DFX_COMMON_XML = "/data/storage/el2/base/preferences/dfx_common.xml"; 113 const std::string LAST_REPORT_TIME = "last_report_time"; 114 const std::string LAST_MIDDLE_REPORT_TIME = "last_middle_report_time"; 115 const std::string LAST_HALF_DAY_REPORT_TIME = "last_half_day_report_time"; 116 const std::string LAST_TWO_DAY_REPORT_TIME = "last_two_day_report_time"; 117 const std::string LAST_WEEK_REPORT_TIME = "last_week_report_time"; 118 const std::string THUMBNAIL_ERROR_VERSION = "thumbnail_error_version"; 119 const std::string DELETE_STATISTIC_VERSION = "delete_statistic_version"; 120 const std::string MOVING_PHOTO_KEY_UNADAPTED_NUM = "unadapted_app_num"; 121 const std::string MOVING_PHOTO_KEY_UNADAPTED_PACKAGE = "unadapted_app_package"; 122 const std::string MOVING_PHOTO_KEY_ADAPTED_NUM = "adapted_app_num"; 123 const std::string MOVING_PHOTO_KEY_ADAPTED_PACKAGE = "adapted_app_package"; 124 const std::string CLOUD_SYNC_START_TIME = "cloud_sync_start_time"; 125 const std::string CLOUDSYNC_STATUS_KEY = "persist.kernel.cloudsync.status"; 126 const std::string IS_REPORTED = "is_reported"; 127 const std::string LAST_CLEAR_DISK_DIRTY_DATA_TIME = "last_clear_disk_dirty_data_time"; 128 129 const std::string CLOUD_PHOTO_PATH = "/storage/cloud/files/Photo/"; 130 const std::string CLOUD_FILE_PATH = "/storage/cloud/files/"; 131 const std::string GARBLE = "*"; 132 const std::string SPLIT_PATH = "/"; 133 const std::string DOT = "."; 134 135 struct ThumbnailErrorInfo { 136 int32_t method; 137 int32_t errCode; 138 int64_t time; 139 }; 140 141 struct CommonBehavior { 142 int32_t times; 143 }; 144 145 struct AlbumInfo { 146 int32_t count = 0; 147 int32_t imageCount = 0; 148 int32_t videoCount = 0; 149 bool isLocal = false; 150 }; 151 152 struct PhotoInfo { 153 std::string data; 154 int32_t dirty; 155 int32_t cloudVersion; 156 }; 157 158 struct PhotoRecordInfo { 159 int32_t imageCount; 160 int32_t videoCount; 161 int32_t abnormalSizeCount; 162 int32_t abnormalWidthOrHeightCount; 163 int32_t abnormalVideoDurationCount; 164 int32_t toBeUpdatedRecordCount; 165 int64_t dbFileSize; 166 int64_t slaveDbFileSize; 167 int32_t duplicateLpathCount; 168 int32_t abnormalLpathCount; 169 }; 170 171 struct AdaptationToMovingPhotoInfo { 172 std::unordered_set<std::string> unadaptedAppPackages; 173 std::unordered_set<std::string> adaptedAppPackages; 174 }; 175 176 const std::unordered_map<int32_t, std::string> ALBUM_MAP = { 177 { static_cast<int32_t>(PhotoAlbumSubType::IMAGE), "IMAGE" }, 178 { static_cast<int32_t>(PhotoAlbumSubType::VIDEO), "VIDEO" }, 179 { static_cast<int32_t>(PhotoAlbumSubType::FAVORITE), "FAVORITE" }, 180 { static_cast<int32_t>(PhotoAlbumSubType::HIDDEN), "HIDDEN" }, 181 { static_cast<int32_t>(PhotoAlbumSubType::TRASH), "TRASH" }, 182 }; 183 184 struct OperationRecordInfo { 185 int32_t addTotalCount; 186 int32_t delTotalCount; 187 int32_t updateTotalCount; 188 int32_t totalCount; 189 }; 190 } // namespace Media 191 } // namespace OHOS 192 193 #endif // OHOS_MEDIA_DFX_CONST_H