1 /* 2 * Copyright (c) 2021-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 #ifndef HIVIEWDFX_HIVIEW_FAULTLOGGER_H 16 #define HIVIEWDFX_HIVIEW_FAULTLOGGER_H 17 18 #include <string> 19 #include <unordered_map> 20 21 #include "page_history/page_history_manager.h" 22 #include "plugin.h" 23 24 #include "faultlog_info.h" 25 #include "faultlog_manager.h" 26 #include "faultlog_bootscan.h" 27 28 #include "faultlog_manager_service.h" 29 30 namespace OHOS { 31 namespace HiviewDFX { 32 33 class Faultlogger : public Plugin { 34 public: 35 ~Faultlogger() override = default; 36 bool OnEvent(std::shared_ptr<Event>& event) override; 37 void OnEventListeningCallback(const Event& event) override; 38 bool IsInterestedPipelineEvent(std::shared_ptr<Event> event) override; 39 bool CanProcessEvent(std::shared_ptr<Event> event) override; 40 bool ReadyToLoad() override; 41 void OnLoad() override; 42 43 void Dump(int fd, const std::vector<std::string>& cmds) override; 44 private: 45 bool hasInit_{false}; 46 std::shared_ptr<FaultLogManager> faultLogManager_; 47 std::shared_ptr<FaultLogBootScan> faultLogBootScan_; 48 }; 49 } // namespace HiviewDFX 50 } // namespace OHOS 51 #endif 52