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