Prabir Pradhan | abcdf5c | 2023-12-15 07:30:22 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2024 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
| 19 | #include "../Entry.h" |
| 20 | |
| 21 | namespace android::inputdispatcher::trace { |
| 22 | |
| 23 | /** |
| 24 | * An interface for the tracing backend, used for setting a custom backend for testing. |
| 25 | */ |
| 26 | class InputTracingBackendInterface { |
| 27 | public: |
| 28 | virtual ~InputTracingBackendInterface() = default; |
| 29 | |
| 30 | /** Trace a KeyEvent. */ |
| 31 | virtual void traceKeyEvent(const KeyEntry&) const = 0; |
| 32 | |
| 33 | /** Trace a MotionEvent. */ |
| 34 | virtual void traceMotionEvent(const MotionEntry&) const = 0; |
| 35 | |
| 36 | /** Trace an event being sent to a window. */ |
| 37 | struct WindowDispatchArgs { |
| 38 | std::variant<MotionEntry, KeyEntry> eventEntry; |
| 39 | nsecs_t deliveryTime; |
| 40 | int32_t resolvedFlags; |
| 41 | gui::Uid targetUid; |
| 42 | int64_t vsyncId; |
| 43 | int32_t windowId; |
| 44 | ui::Transform transform; |
| 45 | ui::Transform rawTransform; |
| 46 | std::array<uint8_t, 32> hmac; |
| 47 | }; |
| 48 | virtual void traceWindowDispatch(const WindowDispatchArgs&) const = 0; |
| 49 | }; |
| 50 | |
| 51 | } // namespace android::inputdispatcher::trace |