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 #ifndef FAULTLOG_MANAGER_SERVICE_H 16 #define FAULTLOG_MANAGER_SERVICE_H 17 18 #include "i_faultlog_manager_service.h" 19 20 #include "faultlog_manager.h" 21 namespace OHOS { 22 namespace HiviewDFX { 23 class FaultLogManagerService : public IFaultLogManagerService { 24 public: FaultLogManagerService(std::shared_ptr<EventLoop> workloop,std::shared_ptr<FaultLogManager> faultLogManager)25 FaultLogManagerService(std::shared_ptr<EventLoop> workloop, std::shared_ptr<FaultLogManager> faultLogManager) 26 : workLoop_(workloop), faultLogManager_(faultLogManager) {} 27 void Dump(int fd, const std::vector<std::string> &cmds) override; 28 void AddFaultLog(FaultLogInfo& info) override; 29 std::unique_ptr<FaultLogQueryResultInner> QuerySelfFaultLog(int32_t uid, 30 int32_t pid, int32_t faultType, int32_t maxNum) override; 31 bool EnableGwpAsanGrayscale(bool alwaysEnabled, double sampleRate, 32 double maxSimutaneousAllocations, int32_t duration, int32_t uid) override; 33 void DisableGwpAsanGrayscale(int32_t uid) override; 34 uint32_t GetGwpAsanGrayscaleState(int32_t uid) override; 35 private: 36 std::shared_ptr<EventLoop> workLoop_; 37 std::shared_ptr<FaultLogManager> faultLogManager_; 38 }; 39 } // namespace HiviewDFX 40 } // namespace OHOS 41 #endif 42