1 /* 2 * Copyright (C) 2025 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_NOTIFY_INFO_INNER_H 17 #define OHOS_MEDIA_NOTIFY_INFO_INNER_H 18 19 #include <string> 20 #include <vector> 21 #include <variant> 22 23 #include "photo_asset_change_info.h" 24 #include "album_change_info.h" 25 26 namespace OHOS { 27 namespace Media { 28 namespace Notification { 29 enum NotifyTableType { 30 PHOTOS, 31 PHOTO_ALBUM, 32 ANALYSIS_ALBUM 33 }; 34 const int32_t ASSET_ADD = 0x100; 35 const int32_t ASSET_REMOVE = 0x200; 36 const int32_t ASSET_OPERATION_ADD_BASE = 0x10000; 37 const int32_t ASSET_OPERATION_REMOVE_BASE = 0x20000; 38 const int32_t ASSET_OPERATION_UPDATE_BASE = 0x40000; 39 const int32_t ASSET_OPERATION_UPDATE_HIDDEN_BASE = 0x80000; 40 const int32_t ASSET_OPERATION_UPDATE_TRASH_BASE = 0x100000; 41 const int32_t ASSET_OPERATION_OTHER_BASE = 0x200000; 42 enum AssetRefreshOperation { 43 ASSET_OPERATION_UNDEFINED, 44 // 普通资产 45 ASSET_OPERATION_ADD = ASSET_OPERATION_ADD_BASE | ASSET_ADD | 0X1, 46 ASSET_OPERATION_ADD_HIDDEN = ASSET_OPERATION_ADD_BASE | ASSET_ADD | 0x2, // 云同步 47 ASSET_OPERATION_ADD_TRASH = ASSET_OPERATION_ADD_BASE | ASSET_ADD | 0x4, // 回收站 48 49 ASSET_OPERATION_REMOVE = ASSET_OPERATION_REMOVE_BASE | ASSET_REMOVE | 0x1, 50 ASSET_OPERATION_REMOVE_HIDDEN = ASSET_OPERATION_REMOVE_BASE | ASSET_REMOVE | 0x2, 51 ASSET_OPERATION_REMOVE_TRASH = ASSET_OPERATION_REMOVE_BASE | ASSET_REMOVE | 0x4, 52 53 ASSET_OPERATION_UPDATE_NORMAL = ASSET_OPERATION_UPDATE_BASE | 0x1, 54 ASSET_OPERATION_UPDATE_ADD_NORMAL = ASSET_OPERATION_UPDATE_BASE | ASSET_ADD | 0x2, 55 ASSET_OPERATION_UPDATE_REMOVE_NORMAL = ASSET_OPERATION_UPDATE_BASE | ASSET_REMOVE | 0x4, 56 57 ASSET_OPERATION_UPDATE_HIDDEN = ASSET_OPERATION_UPDATE_HIDDEN_BASE | 0x1, 58 ASSET_OPERATION_UPDATE_ADD_HIDDEN = ASSET_OPERATION_UPDATE_HIDDEN_BASE | ASSET_ADD | 0x2, 59 ASSET_OPERATION_UPDATE_REMOVE_HIDDEN = ASSET_OPERATION_UPDATE_HIDDEN_BASE | ASSET_REMOVE | 0x4, 60 61 ASSET_OPERATION_UPDATE_TRASH = ASSET_OPERATION_UPDATE_TRASH_BASE | 0x1, 62 ASSET_OPERATION_UPDATE_ADD_TRASH = ASSET_OPERATION_UPDATE_TRASH_BASE | ASSET_ADD | 0x2, 63 ASSET_OPERATION_UPDATE_REMOVE_TRASH = ASSET_OPERATION_UPDATE_TRASH_BASE | ASSET_REMOVE | 0x4, 64 65 ASSET_OPERATION_TRASH = ASSET_OPERATION_OTHER_BASE, 66 ASSET_OPERATION_UNTRASH, 67 ASSET_OPERATION_HIDDEN, 68 ASSET_OPERATION_UNHIDDEN, 69 70 ASSET_OPERATION_RECHECK, 71 }; 72 73 enum AlbumRefreshOperation { 74 ALBUM_OPERATION_UNDEFINED, 75 ALBUM_OPERATION_ADD, 76 ALBUM_OPERATION_REMOVE, 77 ALBUM_OPERATION_UPDATE, 78 ALBUM_OPERATION_UPDATE_HIDDEN, 79 ALBUM_OPERATION_UPDATE_TRASH, 80 ALBUM_OPERATION_RECHECK, 81 }; 82 83 enum Priority { 84 NORMAL, 85 EMERGENCY, 86 }; 87 88 struct NotifyLevel { 89 Priority priority = Priority::NORMAL; 90 int32_t waitLoopCnt = 1; 91 }; 92 93 struct NotifyInfoInner { 94 NotifyTableType tableType; 95 std::vector<std::variant<AccurateRefresh::PhotoAssetChangeData, AccurateRefresh::AlbumChangeData>> infos; 96 std::variant<AssetRefreshOperation, AlbumRefreshOperation> operationType; 97 NotifyLevel notifyLevel; 98 }; 99 } // namespace Notification 100 } // namespace Media 101 } // namespace OHOS 102 103 #endif // OHOS_MEDIA_NOTIFY_INFO_INNER_H