Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | #ifndef _UI_INPUTREADER_MACROS_H |
| 18 | #define _UI_INPUTREADER_MACROS_H |
| 19 | |
| 20 | #define LOG_TAG "InputReader" |
| 21 | |
| 22 | //#define LOG_NDEBUG 0 |
| 23 | |
| 24 | // Log debug messages for each raw event received from the EventHub. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 25 | static constexpr bool DEBUG_RAW_EVENTS = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 26 | |
| 27 | // Log debug messages about virtual key processing. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 28 | static constexpr bool DEBUG_VIRTUAL_KEYS = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 29 | |
| 30 | // Log debug messages about pointers. |
Siarhei Vishniakou | e3ce49d | 2020-09-29 19:08:13 -0500 | [diff] [blame] | 31 | static constexpr bool DEBUG_POINTERS = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 32 | |
| 33 | // Log debug messages about pointer assignment calculations. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 34 | static constexpr bool DEBUG_POINTER_ASSIGNMENT = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 35 | |
| 36 | // Log debug messages about gesture detection. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 37 | static constexpr bool DEBUG_GESTURES = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 38 | |
| 39 | // Log debug messages about the vibrator. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 40 | static constexpr bool DEBUG_VIBRATOR = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 41 | |
| 42 | // Log debug messages about fusing stylus data. |
Siarhei Vishniakou | 465e1c0 | 2021-12-09 10:47:29 -0800 | [diff] [blame^] | 43 | static constexpr bool DEBUG_STYLUS_FUSION = false; |
Prabir Pradhan | baa5c82 | 2019-08-30 15:27:05 -0700 | [diff] [blame] | 44 | |
| 45 | #define INDENT " " |
| 46 | #define INDENT2 " " |
| 47 | #define INDENT3 " " |
| 48 | #define INDENT4 " " |
| 49 | #define INDENT5 " " |
| 50 | |
| 51 | #include <input/Input.h> |
| 52 | |
| 53 | namespace android { |
| 54 | |
| 55 | // --- Static Functions --- |
| 56 | |
| 57 | template <typename T> |
| 58 | inline static T abs(const T& value) { |
| 59 | return value < 0 ? -value : value; |
| 60 | } |
| 61 | |
| 62 | template <typename T> |
| 63 | inline static T min(const T& a, const T& b) { |
| 64 | return a < b ? a : b; |
| 65 | } |
| 66 | |
| 67 | inline static float avg(float x, float y) { |
| 68 | return (x + y) / 2; |
| 69 | } |
| 70 | |
| 71 | static inline const char* toString(bool value) { |
| 72 | return value ? "true" : "false"; |
| 73 | } |
| 74 | |
| 75 | static inline bool sourcesMatchMask(uint32_t sources, uint32_t sourceMask) { |
| 76 | return (sources & sourceMask & ~AINPUT_SOURCE_CLASS_MASK) != 0; |
| 77 | } |
| 78 | |
| 79 | } // namespace android |
| 80 | |
| 81 | #endif // _UI_INPUTREADER_MACROS_H |