1 /* 2 * Copyright (c) 2021-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_NOTIFICATION_CLONE_MANAGER_H 17 #define BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_CLONE_MANAGER_H 18 19 #include <map> 20 #include <string> 21 22 #include "unique_fd.h" 23 #include "iremote_proxy.h" 24 #include "common_event_data.h" 25 #include "notification_clone_template.h" 26 namespace OHOS { 27 namespace Notification { 28 29 class NotificationCloneManager { 30 public: 31 static NotificationCloneManager& GetInstance(); 32 33 int32_t OnBackup(MessageParcel& data, MessageParcel& reply); 34 int32_t OnRestore(MessageParcel& data, MessageParcel& reply); 35 void OnUserSwitch(int32_t userId); 36 void OnRestoreStart(EventFwk::Want want); 37 38 private: 39 NotificationCloneManager(); 40 ~NotificationCloneManager(); 41 42 void RemoveBackUpFile(); 43 ErrCode LoadConfig(UniqueFd &fd, std::string& config); 44 ErrCode SaveConfig(const std::string& config); 45 std::map<std::string, std::shared_ptr<NotificationCloneTemplate>> cloneTemplates; 46 }; 47 } // namespace Notification 48 } // namespace OHOS 49 #endif // BASE_NOTIFICATION_DISTRIBUTED_NOTIFICATION_SERVICE_SERVICES_ANS_INCLUDE_NOTIFICATION_CLONE_MANAGER_H 50