1 /* 2 * Copyright (c) 2024-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 BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DH_NOTIFICATION_CLONE_BUNDLE_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DH_NOTIFICATION_CLONE_BUNDLE_H 18 19 #include "notification_clone_template.h" 20 #include "ffrt.h" 21 #include "notification_bundle_option.h" 22 #include "notification_clone_bundle_info.h" 23 24 namespace OHOS { 25 namespace Notification { 26 class DhNotificationCloneBundle final : public NotificationCloneTemplate { 27 public: 28 DhNotificationCloneBundle(); 29 ~DhNotificationCloneBundle() override; 30 static std::shared_ptr<DhNotificationCloneBundle> GetInstance(); 31 ErrCode OnBackup(nlohmann::json &jsonObject) override; 32 void OnRestoreStart(const std::string bundleName, int32_t appIndex, int32_t userId, int32_t uid) override; 33 void OnRestore(const nlohmann::json &jsonObject) override; 34 void OnUserSwitch(int32_t userId) override; 35 bool isDhSource() override; 36 private: 37 std::vector<NotificationCloneBundleInfo> bundlesInfo_; 38 std::shared_ptr<ffrt::queue> dhCloneBundleQueue_ = nullptr; 39 ffrt::mutex lock_; 40 }; 41 } // namespace Notification 42 } // namespace OHOS 43 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_DH_NOTIFICATION_CLONE_BUNDLE_H