1 /* 2 * Copyright (c) 2022 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 BYTRACE_ADAPTER_H 16 #define BYTRACE_ADAPTER_H 17 18 #include <memory> 19 20 #include "key_event.h" 21 #include "pointer_event.h" 22 23 namespace OHOS { 24 namespace MMI { 25 class BytraceAdapter { 26 public: 27 enum TraceBtn { 28 TRACE_STOP = 0, 29 TRACE_START = 1 30 }; 31 enum HandlerType { 32 KEY_INTERCEPT_EVENT = 1, 33 KEY_LAUNCH_EVENT = 2, 34 KEY_SUBSCRIBE_EVENT = 3, 35 KEY_DISPATCH_EVENT = 4, 36 POINT_INTERCEPT_EVENT = 5, 37 POINT_DISPATCH_EVENT = 6 38 }; 39 enum EventType { 40 START_EVENT = 1, 41 LAUNCH_EVENT = 2, 42 STOP_EVENT = 3 43 }; 44 45 static void StartBytrace(std::shared_ptr<KeyEvent> keyEvent); 46 static void StartBytrace(std::shared_ptr<KeyEvent> key, HandlerType handlerType); 47 static void StartBytrace(std::shared_ptr<PointerEvent> pointerEvent, TraceBtn traceBtn); 48 static void StartBytrace(std::shared_ptr<KeyEvent> keyEvent, TraceBtn traceBtn, HandlerType handlerType); 49 static void StartBytrace(std::shared_ptr<PointerEvent> pointerEvent, TraceBtn traceBtn, HandlerType handlerType); 50 static void StartBytrace(TraceBtn traceBtn, EventType eventType); 51 }; 52 } // namespace MMI 53 } // namespace OHOS 54 #endif // BYTRACE_ADAPTER_H 55