blob: 827e31a1bdcd9316c893b210c01730536cbbb9f1 [file] [log] [blame]
Prabir Pradhanbaa5c822019-08-30 15:27:05 -07001/*
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.
25#define DEBUG_RAW_EVENTS 0
26
27// Log debug messages about touch screen filtering hacks.
28#define DEBUG_HACKS 0
29
30// Log debug messages about virtual key processing.
31#define DEBUG_VIRTUAL_KEYS 0
32
33// Log debug messages about pointers.
34#define DEBUG_POINTERS 0
35
36// Log debug messages about pointer assignment calculations.
37#define DEBUG_POINTER_ASSIGNMENT 0
38
39// Log debug messages about gesture detection.
40#define DEBUG_GESTURES 0
41
42// Log debug messages about the vibrator.
43#define DEBUG_VIBRATOR 0
44
45// Log debug messages about fusing stylus data.
46#define DEBUG_STYLUS_FUSION 0
47
48#define INDENT " "
49#define INDENT2 " "
50#define INDENT3 " "
51#define INDENT4 " "
52#define INDENT5 " "
53
54#include <input/Input.h>
55
56namespace android {
57
58// --- Static Functions ---
59
60template <typename T>
61inline static T abs(const T& value) {
62 return value < 0 ? -value : value;
63}
64
65template <typename T>
66inline static T min(const T& a, const T& b) {
67 return a < b ? a : b;
68}
69
70inline static float avg(float x, float y) {
71 return (x + y) / 2;
72}
73
74static inline const char* toString(bool value) {
75 return value ? "true" : "false";
76}
77
78static inline bool sourcesMatchMask(uint32_t sources, uint32_t sourceMask) {
79 return (sources & sourceMask & ~AINPUT_SOURCE_CLASS_MASK) != 0;
80}
81
82} // namespace android
83
84#endif // _UI_INPUTREADER_MACROS_H