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