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 ALBUM_DELETE_ASSETS = 19, 67 TRASH_PHOTO = 20, 68 CLOUD_DEFAULT_OPEN = 1000, 69 CLOUD_LCD_OPEN, 70 RDB_INSERT = 1100, 71 RDB_DELETE, 72 RDB_UPDATE, 73 RDB_UPDATE_BY_CMD, 74 RDB_QUERY, 75 RDB_EXECUTE_SQL, 76 RDB_BATCHINSERT, 77 IMAGE_SOURCE_CREATE = 1200, 78 IMAGE_SOURCE_GET_INFO, 79 IMAGE_SOURCE_CREATE_PIXELMAP, 80 AV_SET_SOURCE = 1300, 81 AV_FETCH_FRAME, 82 START_SUCCESS = 1400, 83 START_CONTEXT_FAIL, 84 START_DATAMANAGER_FAIL, 85 START_RDB_STORE_FAIL, 86 START_DISTRIBUTE_FAIL, 87 START_DIR_SET_FAIL, 88 START_THUMBNAIL_SERVICE_FAIL, 89 START_SCANNER_FAIL, 90 CHECK_USER_UNLOCK_FAIL, 91 ADD_DATA_UNIQUE_INDEX_FAIL, 92 CHECK_MEDIA_PATH_UNLOCK_FAIL 93 }; 94 95 const std::string NULL_STRING = ""; 96 const std::string SPLIT_CHAR = "|"; 97 98 const std::string THUMBNAIL_ERROR_XML = "/data/storage/el2/base/preferences/thumbnail_error.xml"; 99 const std::string COMMON_BEHAVIOR_XML = "/data/storage/el2/base/preferences/common_behavior.xml"; 100 const std::string DELETE_BEHAVIOR_XML = "/data/storage/el2/base/preferences/delete_behavior.xml"; 101 const std::string ADAPTATION_TO_MOVING_PHOTO_XML = "/data/storage/el2/base/preferences/adaptation_to_moving_photo.xml"; 102 const std::string DFX_COMMON_XML = "/data/storage/el2/base/preferences/dfx_common.xml"; 103 const std::string LAST_REPORT_TIME = "last_report_time"; 104 const std::string LAST_MIDDLE_REPORT_TIME = "last_middle_report_time"; 105 const std::string LAST_HALF_DAY_REPORT_TIME = "last_half_day_report_time"; 106 const std::string THUMBNAIL_ERROR_VERSION = "thumbnail_error_version"; 107 const std::string DELETE_STATISTIC_VERSION = "delete_statistic_version"; 108 const std::string MOVING_PHOTO_KEY_UNADAPTED_NUM = "unadapted_app_num"; 109 const std::string MOVING_PHOTO_KEY_UNADAPTED_PACKAGE = "unadapted_app_package"; 110 const std::string MOVING_PHOTO_KEY_ADAPTED_NUM = "adapted_app_num"; 111 const std::string MOVING_PHOTO_KEY_ADAPTED_PACKAGE = "adapted_app_package"; 112 const std::string CLOUD_SYNC_START_TIME = "cloud_sync_start_time"; 113 const std::string CLOUDSYNC_STATUS_KEY = "persist.kernel.cloudsync.status"; 114 const std::string IS_REPORTED = "is_reported"; 115 116 const std::string CLOUD_PHOTO_PATH = "/storage/cloud/files/Photo/"; 117 const std::string CLOUD_FILE_PATH = "/storage/cloud/files/"; 118 const std::string GARBLE = "*"; 119 const std::string SPLIT_PATH = "/"; 120 const std::string DOT = "."; 121 122 struct ThumbnailErrorInfo { 123 int32_t method; 124 int32_t errCode; 125 int64_t time; 126 }; 127 128 struct CommonBehavior { 129 int32_t times; 130 }; 131 132 struct AlbumInfo { 133 int32_t count = 0; 134 int32_t imageCount = 0; 135 int32_t videoCount = 0; 136 bool isLocal = false; 137 }; 138 139 struct PhotoInfo { 140 std::string data; 141 int32_t dirty; 142 int32_t cloudVersion; 143 }; 144 145 struct PhotoRecordInfo { 146 int32_t imageCount; 147 int32_t videoCount; 148 int32_t abnormalSizeCount; 149 int32_t abnormalWidthOrHeightCount; 150 int32_t abnormalVideoDurationCount; 151 int32_t toBeUpdatedRecordCount; 152 int64_t dbFileSize; 153 int64_t slaveDbFileSize; 154 int32_t duplicateLpathCount; 155 int32_t abnormalLpathCount; 156 }; 157 158 struct AdaptationToMovingPhotoInfo { 159 std::unordered_set<std::string> unadaptedAppPackages; 160 std::unordered_set<std::string> adaptedAppPackages; 161 }; 162 163 const std::unordered_map<int32_t, std::string> ALBUM_MAP = { 164 { static_cast<int32_t>(PhotoAlbumSubType::IMAGE), "IMAGE" }, 165 { static_cast<int32_t>(PhotoAlbumSubType::VIDEO), "VIDEO" }, 166 { static_cast<int32_t>(PhotoAlbumSubType::FAVORITE), "FAVORITE" }, 167 { static_cast<int32_t>(PhotoAlbumSubType::HIDDEN), "HIDDEN" }, 168 { static_cast<int32_t>(PhotoAlbumSubType::TRASH), "TRASH" }, 169 }; 170 } // namespace Media 171 } // namespace OHOS 172 173 #endif // OHOS_MEDIA_DFX_CONST_H