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_MANUAL, 112 FAILED_RETRY, 113 FAILED, 114 SUCCESS, 115 EDIT, 116 TRASH, 117 PROCESSING_AUTO, 118 FINISH = 120, 119 }; 120 121 enum class CloudEnhancementIsAutoType : int32_t { 122 NOT_AUTO = 0, 123 AUTO, 124 }; 125 126 enum class CloudEnhancementTriggerModeType : int32_t { 127 TRIGGER_MANUAL = 0, 128 TRIGGER_AUTO, 129 }; 130 131 enum class CEErrorCodeType : int32_t { 132 // failed retry 133 LIMIT_USAGE = 100, 134 LIMIT_REQUEST, 135 TASK_CACHE_TIMEOUT, 136 NETWORK_UNAVAILABLE, 137 TEMPERATURES_GUARD, 138 NETWORK_WEAK, 139 // failed 140 EXECUTE_FAILED, 141 // failed retry 142 DO_AUTH_FAILED, 143 TASK_CANNOT_EXECUTE, 144 // failed 145 NON_RECOVERABLE = 200, 146 }; 147 148 enum class StrongAssociationType : int32_t { 149 NORMAL = 0, 150 CLOUD_ENHANCEMENT 151 }; 152 153 enum class SyncStatusType : int32_t { 154 TYPE_BACKUP = -1, // Only for clone! Set backup data invisible before moving 155 TYPE_VISIBLE = 0, 156 TYPE_DOWNLOAD, 157 TYPE_UPLOAD, 158 }; 159 160 enum class ThumbStatus : int32_t { 161 DOWNLOADED, 162 TO_DOWNLOAD, 163 }; 164 165 enum class TableType : int32_t { 166 TYPE_FILES = 0, 167 TYPE_PHOTOS, 168 TYPE_AUDIOS, 169 }; 170 171 enum ResultSetDataType { 172 TYPE_NULL = 0, 173 TYPE_STRING, 174 TYPE_INT32, 175 TYPE_INT64, 176 TYPE_DOUBLE 177 }; 178 179 enum class CleanType : int32_t { 180 TYPE_NOT_CLEAN = 0, 181 TYPE_NEED_CLEAN 182 }; 183 184 enum class MultiStagesPhotoQuality : int32_t { 185 FULL = 0, 186 LOW, 187 }; 188 189 enum class StageVideoTaskStatus : int32_t { 190 NO_NEED_TO_STAGE = 0, 191 NEED_TO_STAGE, 192 STAGE_TASK_TO_DELIVER, 193 STAGE_TASK_DELIVERED, 194 STAGE_TASK_FAIL, 195 STAGE_TASK_SUCCESS, 196 }; 197 198 enum class FirstStageModifyType : int32_t { 199 NOT_MODIFIED = 0, 200 EDITED, 201 TRASHED, 202 }; 203 204 constexpr int32_t DEFAULT_INT32 = 0; 205 constexpr int64_t DEFAULT_INT64 = 0; 206 constexpr int64_t DEFAULT_DOUBLE = 0; 207 const std::string DEFAULT_STR = ""; 208 const bool DEFAULT_BOOL = false; 209 const std::string DEFAULT_MEDIA_PATH = ""; 210 211 const int32_t DEFAULT_ALBUM_ID = 0; 212 const std::string DEFAULT_ALBUM_NAME = "Unknown"; 213 const std::string DEFAULT_ALBUM_PATH = ""; 214 const std::string DEFAULT_ALBUM_URI = ""; 215 const std::string DEFAULT_SMART_ALBUM_TAG = ""; 216 const PrivateAlbumType DEFAULT_SMART_ALBUM_PRIVATE_TYPE = TYPE_SMART; 217 const int32_t DEFAULT_SMART_ALBUM_ALBUMCAPACITY = 0; 218 const int32_t DEFAULT_SMART_ALBUM_CATEGORYID = 0; 219 const int64_t DEFAULT_SMART_ALBUM_DATE_MODIFIED = 0; 220 const std::string DEFAULT_SMART_ALBUM_CATEGORYNAME = ""; 221 const int64_t DEFAULT_ALBUM_DATE_MODIFIED = 0; 222 const int32_t DEFAULT_COUNT = 0; 223 const std::string DEFAULT_ALBUM_RELATIVE_PATH = ""; 224 const std::string DEFAULT_COVERURI = ""; 225 const int32_t DEFAULT_MEDIA_PARENT = 0; 226 const std::string DEFAULT_DESCRIPTION; 227 constexpr int32_t DEFAULT_EXPIREDTIME = 0; 228 const bool DEFAULT_ALBUM_VIRTUAL = false; 229 const uint64_t DEFAULT_MEDIA_DATE_TAKEN = 0; 230 const std::string DEFAULT_MEDIA_ALBUM_URI = ""; 231 const bool DEFAULT_MEDIA_IS_PENDING = false; 232 const int32_t DEFAULT_DIR_TYPE = -1; 233 const std::string DEFAULT_DIRECTORY = ""; 234 const std::string DEFAULT_STRING_MEDIA_TYPE = ""; 235 const std::string DEFAULT_EXTENSION = ""; 236 const int32_t DEFAULT_MEDIAVOLUME = 0; 237 const std::string ROOT_MEDIA_DIR = "/storage/cloud/files/"; 238 const std::string ROOT_SANDBOX_DIR = "/storage/Share/"; 239 const std::string FS_TYPE_EPFS = "epfs"; 240 const std::string EPFS_MOUNT_POINT = "/storage/cloud/epfs"; 241 const std::string MEDIA_CACHE_DIR = ROOT_MEDIA_DIR + ".cache/"; 242 const std::string MEDIA_EDIT_DATA_DIR = ROOT_MEDIA_DIR + ".editData/"; 243 const std::string META_RECOVERY_PHOTO_RELATIVE_PATH = "/Photo/"; 244 const std::string META_RECOVERY_META_RELATIVE_PATH = "/.meta/Photo/"; 245 const std::string META_RECOVERY_META_FILE_SUFFIX = ".json"; 246 const std::string ASTC_JSON_FILE_PATH = "/data/storage/el2/base/preferences/astcphase.json"; 247 const char SLASH_CHAR = '/'; 248 const std::string SLASH_STR = "/"; 249 const int32_t KEY_FRAME_LCD = 1; 250 const int32_t KEY_FRAME_THM = 2; 251 const int32_t KEY_FRAME_THM_ASTC = 3; 252 253 const std::string SKIPLIST_FILE_PATH = "/data/SkipScanFile.txt"; 254 255 const std::string DOCS_PATH = "Docs/"; 256 const int CAMERA_DIRECTORY_TYPE_VALUES = DIR_CAMERA; 257 const std::string CAMERA_DIR_VALUES = "Camera/"; 258 const std::string CAMERA_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE) + "?" + std::to_string(MEDIA_TYPE_VIDEO); 259 const int VIDEO_DIRECTORY_TYPE_VALUES = DIR_VIDEO; 260 const std::string VIDEO_DIR_VALUES = "Videos/"; 261 const std::string VIDEO_TYPE_VALUES = std::to_string(MEDIA_TYPE_VIDEO); 262 const int PIC_DIRECTORY_TYPE_VALUES = DIR_IMAGE; 263 const std::string PIC_DIR_VALUES = "Pictures/"; 264 const std::string PIC_TYPE_VALUES = std::to_string(MEDIA_TYPE_IMAGE); 265 const int AUDIO_DIRECTORY_TYPE_VALUES = DIR_AUDIOS; 266 const std::string AUDIO_DIR_VALUES = "Audios/"; 267 const std::string AUDIO_TYPE_VALUES = std::to_string(MEDIA_TYPE_AUDIO); 268 const int DOC_DIRECTORY_TYPE_VALUES = DIR_DOCUMENTS; 269 const std::string DOC_DIR_VALUES = "Documents/"; 270 const int DOWNLOAD_DIRECTORY_TYPE_VALUES = DIR_DOWNLOAD; 271 const std::string DOWNLOAD_DIR_VALUES = "Download/"; 272 const std::string DOCUMENT_BUCKET = "Document"; 273 const std::string PHOTO_BUCKET = "Photo"; 274 const std::string AUDIO_BUCKET = "Audio"; 275 const std::string PRE_PATH_VALUES = "/storage/cloud/"; 276 const std::string DOCUMENT_URI_AUTHORITY = "docs"; 277 const std::string BACKUP_DATA_DIR_VALUE = "data/"; 278 const std::string BACKUP_SINGLE_DATA_DIR_VALUE = ".backup/"; 279 const std::string THUMB_DIR_VALUE = ".thumbs/Photo"; 280 const std::string EDIT_DATA_DIR_VALUE = ".editData"; 281 const std::string MEDIALIBRARY_TEMP_DIR = ".medialibrarytemp"; 282 const std::string CLOUD_ENHANCEMENT_WATER_MARK_DIR = "/sys_prod/resource/camera"; 283 const std::string CACHE_DIR_VALUE = ".cache"; 284 const std::string HIGHLIGHT_INFO_OLD = ".thumbs/highlight"; 285 const std::string HIGHLIGHT_INFO_NEW = "highlight"; 286 const std::string MEDIA_PHOTO_URI = "file://media/Photo/"; 287 const std::string HMDFS = "/mnt/hmdfs/"; 288 const std::string CLOUD_MERGE_VIEW = "/account/cloud_merge_view/files/"; 289 const std::string CUSTOM_RESTORE_VALUES = "custom_restore"; 290 291 const std::vector<std::string> PRESET_ROOT_DIRS = { 292 CAMERA_DIR_VALUES, VIDEO_DIR_VALUES, PIC_DIR_VALUES, AUDIO_DIR_VALUES, 293 PHOTO_BUCKET + "/", AUDIO_BUCKET + "/", BACKUP_DATA_DIR_VALUE, EDIT_DATA_DIR_VALUE + "/", 294 BACKUP_SINGLE_DATA_DIR_VALUE, CACHE_DIR_VALUE, CUSTOM_RESTORE_VALUES 295 }; 296 297 const std::vector<std::string> E_POLICY_DIRS = { 298 ROOT_MEDIA_DIR + CAMERA_DIR_VALUES, 299 ROOT_MEDIA_DIR + VIDEO_DIR_VALUES, 300 ROOT_MEDIA_DIR + PIC_DIR_VALUES, 301 ROOT_MEDIA_DIR + PHOTO_BUCKET, 302 ROOT_MEDIA_DIR + BACKUP_SINGLE_DATA_DIR_VALUE, 303 ROOT_MEDIA_DIR + THUMB_DIR_VALUE, 304 ROOT_MEDIA_DIR + CACHE_DIR_VALUE, 305 ROOT_MEDIA_DIR + EDIT_DATA_DIR_VALUE, 306 }; 307 308 const int TRASH_ALBUM_ID_VALUES = 2; 309 const int FAVOURITE_ALBUM_ID_VALUES = 1; 310 const int TRASH_ALBUM_TYPE_VALUES = 2; 311 const int FAVOURITE_ALBUM_TYPE_VALUES = 1; 312 const std::string TRASH_ALBUM_NAME_VALUES = "TrashAlbum"; 313 const std::string FAVOURTIE_ALBUM_NAME_VALUES = "FavoritAlbum"; 314 315 static constexpr int UNCREATE_FILE_TIMEPENDING = -1; 316 static constexpr int UNCLOSE_FILE_TIMEPENDING = -2; 317 static constexpr int UNOPEN_FILE_COMPONENT_TIMEPENDING = -3; 318 319 const std::string PHOTO_OPTION_WLAN_ONLY = "WLAN only"; 320 const std::string PHOTO_OPTION_WLAN_AND_NETWORK = "WLAN and networks"; 321 const std::string PHOTO_OPTION_CLOSE = "close"; 322 323 constexpr const char *SETTINGS_DATA_EXT_URI = "datashare:///com.ohos.settingsdata.DataAbility"; 324 constexpr const char *SETTINGS_DATASHARE_AUTO_OPTION_URI = 325 "datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true&key=persist.photos.ce.auto.option"; 326 const std::string SETTINGS_DATASHARE_URI = 327 "datashare:///com.ohos.settingsdata/entry/settingsdata/SETTINGSDATA?Proxy=true"; 328 const std::string SETTINGS_DATASHARE_WATER_MARK_URI = SETTINGS_DATASHARE_URI + 329 "&key=persist.photos.ce.watermark.enable"; 330 const std::string SETTING_KEY = "KEYWORD"; 331 const std::string SETTING_VALUE = "VALUE"; 332 const std::string WATER_MARK_ENABLED = "true"; 333 constexpr int PHOTOS_STORAGE_MANAGER_ID = 5003; 334 } // namespace OHOS 335 } // namespace Media 336 337 #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_MEDIA_LIB_SERVICE_CONST_H_ 338