1 /* 2 * Copyright (C) 2021-2022 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 INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_ 17 #define INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_ 18 19 #include <unordered_set> 20 21 #include "userfile_manager_types.h" 22 23 namespace OHOS { 24 namespace Media { 25 enum { 26 MEDIA_GET_MEDIA_ASSETS = 0, 27 MEDIA_GET_IMAGE_ASSETS = 1, 28 MEDIA_GET_AUDIO_ASSETS = 2, 29 MEDIA_GET_VIDEO_ASSETS = 3, 30 MEDIA_GET_IMAGEALBUM_ASSETS = 4, 31 MEDIA_GET_VIDEOALBUM_ASSETS = 5, 32 MEDIA_CREATE_MEDIA_ASSET = 6, 33 MEDIA_DELETE_MEDIA_ASSET = 7, 34 MEDIA_MODIFY_MEDIA_ASSET = 8, 35 MEDIA_COPY_MEDIA_ASSET = 9, 36 MEDIA_CREATE_MEDIA_ALBUM_ASSET = 10, 37 MEDIA_DELETE_MEDIA_ALBUM_ASSET = 11, 38 MEDIA_MODIFY_MEDIA_ALBUM_ASSET = 12, 39 }; 40 41 /* ENUM Asset types */ 42 enum AssetType { 43 ASSET_MEDIA = 0, 44 ASSET_IMAGE, 45 ASSET_AUDIO, 46 ASSET_VIDEO, 47 ASSET_GENERIC_ALBUM, 48 ASSET_IMAGEALBUM, 49 ASSET_VIDEOALBUM, 50 ASSET_NONE 51 }; 52 53 enum DirType { 54 DIR_CAMERA = 0, 55 DIR_VIDEO, 56 DIR_IMAGE, 57 DIR_AUDIOS, 58 DIR_DOCUMENTS, 59 DIR_DOWNLOAD, 60 DIR_TYPE_MAX 61 }; 62 63 enum class CloudSyncErrType : int32_t { 64 OTHER_ERROR = 0, 65 CONTENT_NOT_FOUND, 66 THM_NOT_FOUND, 67 LCD_NOT_FOUND, 68 LCD_SIZE_IS_TOO_LARGE, 69 CONTENT_SIZE_IS_ZERO, 70 ALBUM_NOT_FOUND 71 }; 72 73 enum PrivateAlbumType { 74 TYPE_FAVORITE = 0, 75 TYPE_TRASH, 76 TYPE_HIDE, 77 TYPE_SMART, 78 TYPE_SEARCH 79 }; 80 81 enum class DataType : int32_t { 82 TYPE_NULL = 0, 83 TYPE_INT, 84 TYPE_LONG, 85 TYPE_DOUBLE, 86 TYPE_STRING, 87 TYPE_BOOL 88 }; 89 90 enum class FetchResType : int32_t { 91 TYPE_FILE = 1, 92 TYPE_ALBUM, 93 TYPE_SMARTALBUM, 94 TYPE_PHOTOALBUM 95 }; 96 97 enum class DirtyType : int32_t { 98 TYPE_SYNCED, 99 TYPE_NEW, 100 TYPE_MDIRTY, 101 TYPE_FDIRTY, 102 TYPE_DELETED, 103 TYPE_RETRY, 104 TYPE_SDIRTY, 105 TYPE_COPY 106 }; 107 108 enum class CloudEnhancementAvailableType : int32_t { 109 NOT_SUPPORT = 0, 110 SUPPORT, 111 PROCESSING, 112 FAILED_RETRY, 113 FAILED, 114 SUCCESS, 115 EDIT, 116 TRASH, 117 FINISH = 120, 118 }; 119 120 enum class CEErrorCodeType : int32_t { 121 // failed retry 122 LIMIT_USAGE = 100, 123 LIMIT_REQUEST, 124 TASK_CACHE_TIMEOUT, 125 NETWORK_UNAVAILABLE, 126 TEMPERATURES_GUARD, 127 NETWORK_WEAK, 128 // failed 129 EXECUTE_FAILED, 130 // failed retry 131 DO_AUTH_FAILED, 132 TASK_CANNOT_EXECUTE, 133 // failed 134 NON_RECOVERABLE = 200, 135 }; 136 137 enum class StrongAssociationType : int32_t { 138 NORMAL = 0, 139 CLOUD_ENHANCEMENT 140 }; 141 142 enum class SyncStatusType : int32_t { 143 TYPE_VISIBLE = 0, 144 TYPE_DOWNLOAD, 145 TYPE_UPLOAD, 146 }; 147 148 enum class ThumbStatus : int32_t { 149 DOWNLOADED, 150 TO_DOWNLOAD, 151 }; 152 153 enum class TableType : int32_t { 154 TYPE_FILES = 0, 155 TYPE_PHOTOS, 156 TYPE_AUDIOS, 157 }; 158 159 enum ResultSetDataType { 160 TYPE_NULL = 0, 161 TYPE_STRING, 162 TYPE_INT32, 163 TYPE_INT64, 164 TYPE_DOUBLE 165 }; 166 167 enum class CleanType : int32_t { 168 TYPE_NOT_CLEAN = 0, 169 TYPE_NEED_CLEAN 170 }; 171 172 enum class MultiStagesPhotoQuality : int32_t { 173 FULL = 0, 174 LOW, 175 }; 176 177 constexpr int32_t DEFAULT_INT32 = 0; 178 constexpr int64_t DEFAULT_INT64 = 0; 179 constexpr int64_t DEFAULT_DOUBLE = 0; 180 const std::string DEFAULT_STR = ""; 181 const bool DEFAULT_BOOL = false; 182 const std::string DEFAULT_MEDIA_PATH = ""; 183 184 const int32_t DEFAULT_ALBUM_ID = 0; 185 const std::string DEFAULT_ALBUM_NAME = "Unknown"; 186 const std::string DEFAULT_ALBUM_PATH = ""; 187 const std::string DEFAULT_ALBUM_URI = ""; 188 const std::string DEFAULT_SMART_ALBUM_TAG = ""; 189 const PrivateAlbumType DEFAULT_SMART_ALBUM_PRIVATE_TYPE = TYPE_SMART; 190 const int32_t DEFAULT_SMART_ALBUM_ALBUMCAPACITY = 0; 191 const int32_t DEFAULT_SMART_ALBUM_CATEGORYID = 0; 192 const int64_t DEFAULT_SMART_ALBUM_DATE_MODIFIED = 0; 193 const std::string DEFAULT_SMART_ALBUM_CATEGORYNAME = ""; 194 const int64_t DEFAULT_ALBUM_DATE_MODIFIED = 0; 195 const int32_t DEFAULT_COUNT = 0; 196 const std::string DEFAULT_ALBUM_RELATIVE_PATH = ""; 197 const std::string DEFAULT_COVERURI = ""; 198 const int32_t DEFAULT_MEDIA_PARENT = 0; 199 const std::string DEFAULT_DESCRIPTION; 200 constexpr int32_t DEFAULT_EXPIREDTIME = 0; 201 const bool DEFAULT_ALBUM_VIRTUAL = false; 202 const uint64_t DEFAULT_MEDIA_DATE_TAKEN = 0; 203 const std::string DEFAULT_MEDIA_ALBUM_URI = ""; 204 const bool DEFAULT_MEDIA_IS_PENDING = false; 205 const int32_t DEFAULT_DIR_TYPE = -1; 206 const std::string DEFAULT_DIRECTORY = ""; 207 const std::string DEFAULT_STRING_MEDIA_TYPE = ""; 208 const std::string DEFAULT_EXTENSION = ""; 209 const int32_t DEFAULT_MEDIAVOLUME = 0; 210 const std::string ROOT_MEDIA_DIR = "/storage/cloud/files/"; 211 const std::string ROOT_SANDBOX_DIR = "/storage/Share/"; 212 const std::string FS_TYPE_EPFS = "epfs"; 213 const std::string EPFS_MOUNT_POINT = "/storage/cloud/epfs"; 214 const std::string MEDIA_CACHE_DIR = ROOT_MEDIA_DIR + ".cache/"; 215 const std::string MEDIA_EDIT_DATA_DIR = ROOT_MEDIA_DIR + ".editData/"; 216 const char SLASH_CHAR = '/'; 217 const std::string SLASH_STR = "/"; 218 219 const std::string SKIPLIST_FILE_PATH = "/data/SkipScanFile.txt"; 220 221 const std::string DOCS_PATH = "Docs/"; 222 const int CAMERA_DIRECTORY_TYPE_VALUES = DIR_CAMERA; 223 const std::string CAMERA_DIR_VALUES = "Camera/"; 224 const std::string CAMERA_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE) + "?" + std::to_string(MEDIA_TYPE_VIDEO); 225 const int VIDEO_DIRECTORY_TYPE_VALUES = DIR_VIDEO; 226 const std::string VIDEO_DIR_VALUES = "Videos/"; 227 const std::string VIDEO_TYPE_VALUES = std::to_string(MEDIA_TYPE_VIDEO); 228 const int PIC_DIRECTORY_TYPE_VALUES = DIR_IMAGE; 229 const std::string PIC_DIR_VALUES = "Pictures/"; 230 const std::string PIC_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE); 231 const int AUDIO_DIRECTORY_TYPE_VALUES = DIR_AUDIOS; 232 const std::string AUDIO_DIR_VALUES = "Audios/"; 233 const std::string AUDIO_TYPE_VALUES = std::to_string(MEDIA_TYPE_AUDIO); 234 const int DOC_DIRECTORY_TYPE_VALUES = DIR_DOCUMENTS; 235 const std::string DOC_DIR_VALUES = "Documents/"; 236 const int DOWNLOAD_DIRECTORY_TYPE_VALUES = DIR_DOWNLOAD; 237 const std::string DOWNLOAD_DIR_VALUES = "Download/"; 238 const std::string DOCUMENT_BUCKET = "Document"; 239 const std::string PHOTO_BUCKET = "Photo"; 240 const std::string AUDIO_BUCKET = "Audio"; 241 const std::string PRE_PATH_VALUES = "/storage/cloud/"; 242 const std::string DOCUMENT_URI_AUTHORITY = "docs"; 243 const std::string BACKUP_DATA_DIR_VALUE = "data/"; 244 const std::string BACKUP_SINGLE_DATA_DIR_VALUE = ".backup/"; 245 const std::string THUMB_DIR_VALUE = ".thumbs/Photo"; 246 const std::string EDIT_DATA_DIR_VALUE = ".editData"; 247 const std::string MEDIALIBRARY_TEMP_DIR = ".medialibrarytemp"; 248 const std::string CACHE_DIR_VALUE = ".cache"; 249 const std::string CLOUD_ENHANCEMENT_WATER_MARK_DIR = "/sys_prod/resource/camera"; 250 251 const std::vector<std::string> PRESET_ROOT_DIRS = { 252 CAMERA_DIR_VALUES, VIDEO_DIR_VALUES, PIC_DIR_VALUES, AUDIO_DIR_VALUES, 253 PHOTO_BUCKET + "/", AUDIO_BUCKET + "/", BACKUP_DATA_DIR_VALUE, EDIT_DATA_DIR_VALUE + "/", 254 BACKUP_SINGLE_DATA_DIR_VALUE, CACHE_DIR_VALUE 255 }; 256 257 const std::vector<std::string> E_POLICY_DIRS = { 258 ROOT_MEDIA_DIR + CAMERA_DIR_VALUES, 259 ROOT_MEDIA_DIR + VIDEO_DIR_VALUES, 260 ROOT_MEDIA_DIR + PIC_DIR_VALUES, 261 ROOT_MEDIA_DIR + PHOTO_BUCKET, 262 ROOT_MEDIA_DIR + BACKUP_SINGLE_DATA_DIR_VALUE, 263 ROOT_MEDIA_DIR + THUMB_DIR_VALUE, 264 ROOT_MEDIA_DIR + CACHE_DIR_VALUE, 265 ROOT_MEDIA_DIR + EDIT_DATA_DIR_VALUE, 266 }; 267 268 const int TRASH_ALBUM_ID_VALUES = 2; 269 const int FAVOURITE_ALBUM_ID_VALUES = 1; 270 const int TRASH_ALBUM_TYPE_VALUES = 2; 271 const int FAVOURITE_ALBUM_TYPE_VALUES = 1; 272 const std::string TRASH_ALBUM_NAME_VALUES = "TrashAlbum"; 273 const std::string FAVOURTIE_ALBUM_NAME_VALUES = "FavoritAlbum"; 274 275 static constexpr int UNCREATE_FILE_TIMEPENDING = -1; 276 static constexpr int UNCLOSE_FILE_TIMEPENDING = -2; 277 static constexpr int UNOPEN_FILE_COMPONENT_TIMEPENDING = -3; 278 } // namespace OHOS 279 } // namespace Media 280 281 #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_ 282