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