/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H #define HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H #include #include #include "log_store_ex.h" #include "input_manager.h" #include "ffrt.h" namespace OHOS { namespace HiviewDFX { class ActiveKeyEvent { public: ActiveKeyEvent(); ~ActiveKeyEvent(); ActiveKeyEvent& operator=(const ActiveKeyEvent&) = delete; ActiveKeyEvent(const ActiveKeyEvent&) = delete; void Init(std::shared_ptr logStore); static int64_t SystemTimeMillisecond(); private: void InitSubscribe(std::set preKeys, int32_t finalKey, int32_t count, int32_t holdTime); void CombinationKeyHandle(std::shared_ptr keyEvent); void CombinationKeyCallback(std::shared_ptr keyEvent); void HitraceCapture(); void SysMemCapture(int fd); void DumpCapture(int fd); mutable ffrt::mutex mutex_; const uint64_t initDelay_ = 5000; std::list subscribeIds_; std::shared_ptr logStore_; uint64_t triggeringTime_; uint8_t taskOutDeps = 0; int reportLimit_ = 0; static const inline std::string CMD_LIST[] = { "cmd:w", "cmd:rs", "cmd:a", "k:SysRqFile", "cmd:p", "cmd:d", "cmd:c", }; }; } // namespace HiviewDFX } // namespace OHOS #endif // HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H