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 }; 93 94 const std::string NULL_STRING = ""; 95 const std::string SPLIT_CHAR = "|"; 96 97 const std::string THUMBNAIL_ERROR_XML = "/data/storage/el2/base/preferences/thumbnail_error.xml"; 98 const std::string COMMON_BEHAVIOR_XML = "/data/storage/el2/base/preferences/common_behavior.xml"; 99 const std::string DELETE_BEHAVIOR_XML = "/data/storage/el2/base/preferences/delete_behavior.xml"; 100 const std::string ADAPTATION_TO_MOVING_PHOTO_XML = "/data/storage/el2/base/preferences/adaptation_to_moving_photo.xml"; 101 const std::string DFX_COMMON_XML = "/data/storage/el2/base/preferences/dfx_common.xml"; 102 const std::string LAST_REPORT_TIME = "last_report_time"; 103 const std::string LAST_MIDDLE_REPORT_TIME = "last_middle_report_time"; 104 const std::string LAST_HALF_DAY_REPORT_TIME = "last_half_day_report_time"; 105 const std::string THUMBNAIL_ERROR_VERSION = "thumbnail_error_version"; 106 const std::string DELETE_STATISTIC_VERSION = "delete_statistic_version"; 107 const std::string MOVING_PHOTO_KEY_UNADAPTED_NUM = "unadapted_app_num"; 108 const std::string MOVING_PHOTO_KEY_UNADAPTED_PACKAGE = "unadapted_app_package"; 109 const std::string MOVING_PHOTO_KEY_ADAPTED_NUM = "adapted_app_num"; 110 const std::string MOVING_PHOTO_KEY_ADAPTED_PACKAGE = "adapted_app_package"; 111 const std::string CLOUD_SYNC_START_TIME = "cloud_sync_start_time"; 112 const std::string CLOUDSYNC_STATUS_KEY = "persist.kernel.cloudsync.status"; 113 const std::string IS_REPORTED = "is_reported"; 114 115 const std::string CLOUD_PHOTO_PATH = "/storage/cloud/files/Photo/"; 116 const std::string CLOUD_FILE_PATH = "/storage/cloud/files/"; 117 const std::string GARBLE = "*"; 118 const std::string SPLIT_PATH = "/"; 119 const std::string DOT = "."; 120 121 struct ThumbnailErrorInfo { 122 int32_t method; 123 int32_t errCode; 124 int64_t time; 125 }; 126 127 struct CommonBehavior { 128 int32_t times; 129 }; 130 131 struct AlbumInfo { 132 int32_t count = 0; 133 int32_t imageCount = 0; 134 int32_t videoCount = 0; 135 bool isLocal = false; 136 }; 137 138 struct PhotoInfo { 139 std::string data; 140 int32_t dirty; 141 int32_t cloudVersion; 142 }; 143 144 struct PhotoRecordInfo { 145 int32_t imageCount; 146 int32_t videoCount; 147 int32_t abnormalSizeCount; 148 int32_t abnormalWidthOrHeightCount; 149 int32_t abnormalVideoDurationCount; 150 int32_t toBeUpdatedRecordCount; 151 int64_t dbFileSize; 152 }; 153 154 struct AdaptationToMovingPhotoInfo { 155 std::unordered_set<std::string> unadaptedAppPackages; 156 std::unordered_set<std::string> adaptedAppPackages; 157 }; 158 159 const std::unordered_map<int32_t, std::string> ALBUM_MAP = { 160 { static_cast<int32_t>(PhotoAlbumSubType::IMAGE), "IMAGE" }, 161 { static_cast<int32_t>(PhotoAlbumSubType::VIDEO), "VIDEO" }, 162 { static_cast<int32_t>(PhotoAlbumSubType::FAVORITE), "FAVORITE" }, 163 { static_cast<int32_t>(PhotoAlbumSubType::HIDDEN), "HIDDEN" }, 164 { static_cast<int32_t>(PhotoAlbumSubType::TRASH), "TRASH" }, 165 }; 166 } // namespace Media 167 } // namespace OHOS 168 169 #endif // OHOS_MEDIA_DFX_CONST_H