• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H
16 #define HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H
17 #ifdef MULTIMODALINPUT_INPUT_ENABLE
18 #include <memory>
19 #include <string>
20 #include <list>
21 
22 #include "log_store_ex.h"
23 #include "input_manager.h"
24 #include "ffrt.h"
25 
26 namespace OHOS {
27 namespace HiviewDFX {
28 class ActiveKeyEvent {
29 public:
30     ActiveKeyEvent();
31     ~ActiveKeyEvent();
32     ActiveKeyEvent& operator=(const ActiveKeyEvent&) = delete;
33     ActiveKeyEvent(const ActiveKeyEvent&) = delete;
34     void Init(std::shared_ptr<LogStoreEx> logStore);
35     static int64_t SystemTimeMillisecond();
36 
37 private:
38     void InitSubscribe(std::set<int32_t> preKeys, int32_t finalKey, int32_t count, int32_t holdTime);
39     void CombinationKeyHandle(std::shared_ptr<MMI::KeyEvent> keyEvent);
40     void CombinationKeyCallback(std::shared_ptr<MMI::KeyEvent> keyEvent);
41 
42 #ifdef HITRACE_CATCHER_ENABLE
43     void HitraceCapture();
44 #endif // HITRACE_CATCHER_ENABLE
45     void SysMemCapture(int fd);
46     void DumpCapture(int fd);
47 
48     mutable ffrt::mutex mutex_;
49     const uint64_t initDelay_ = 5000;
50     std::list<int32_t> subscribeIds_;
51     std::shared_ptr<LogStoreEx> logStore_;
52     uint64_t triggeringTime_;
53     uint8_t taskOutDeps = 0;
54     int reportLimit_ = 0;
55 };
56 } // namespace HiviewDFX
57 } // namespace OHOS
58 #endif // MULTIMODALINPUT_INPUT_ENABLE
59 #endif // HIVIEW_EVENT_LOG_ACTIVE_KEY_EVENT_H
60