blob: e23fc94c5e0f5bbb1421e261da97c7ad84fbe4a4 [file] [log] [blame]
Siarhei Vishniakou70622952020-07-30 11:17:23 -05001/**
2 * Copyright (c) 2020, 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
17package android.os;
18
19
20/** @hide */
21interface IInputConstants
22{
Peter Collingbourneb04b9b82021-02-08 12:09:47 -080023 // This should be multiplied by the value of the system property ro.hw_timeout_multiplier before
24 // use. A pre-multiplied constant is available in Java in
25 // android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS.
26 const int UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS = 5000; // 5 seconds
Siarhei Vishniakou2508b872020-12-03 16:33:53 -100027
Siarhei Vishniakoufc434ac2021-01-13 10:28:00 -100028 // Indicate invalid battery capacity
29 const int INVALID_BATTERY_CAPACITY = -1;
30
31 /**
32 * Every input event has an id. This constant value is used when a valid input event id is not
33 * available.
34 */
35 const int INVALID_INPUT_EVENT_ID = 0;
Siarhei Vishniakou5d552c42021-05-21 05:02:22 +000036
37 /**
Sandro Meierd3d40602022-10-19 16:18:26 +000038 * Every input device has an id. This constant value is used when a valid input device id is not
39 * available.
40 * The virtual keyboard uses -1 as the input device id. Therefore, we use -2 as the value for
41 * an invalid input device.
42 */
43 const int INVALID_INPUT_DEVICE_ID = -2;
44
45 /**
Siarhei Vishniakouf00a4ec2021-06-16 03:55:32 +000046 * The input event was injected from accessibility. Used in policyFlags for input event
47 * injection.
Siarhei Vishniakou5d552c42021-05-21 05:02:22 +000048 */
49 const int POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000;
Siarhei Vishniakouf00a4ec2021-06-16 03:55:32 +000050
51 /**
Prabir Pradhan29814f22024-06-18 14:53:10 +000052 * Common input event flag used for both motion and key events for a gesture or pointer being
53 * canceled.
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -070054 */
55 const int INPUT_EVENT_FLAG_CANCELED = 0x20;
56
57 /**
Prabir Pradhan29814f22024-06-18 14:53:10 +000058 * Common input event flag used for both motion and key events, indicating that the event
59 * was generated or modified by accessibility service.
Siarhei Vishniakouf00a4ec2021-06-16 03:55:32 +000060 */
61 const int INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800;
Prabir Pradhande788502021-12-22 00:26:07 -080062
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -070063 /**
Prabir Pradhan29814f22024-06-18 14:53:10 +000064 * Common input event flag used for both motion and key events, indicating that the system has
65 * detected this event may be inconsistent with the current event sequence or gesture, such as
66 * when a pointer move event is sent but the pointer is not down.
Siarhei Vishniakouc40f6e02024-04-25 15:49:29 -070067 */
68 const int INPUT_EVENT_FLAG_TAINTED = 0x80000000;
69
Christine Franks46d8a1e2022-01-05 16:11:48 -080070 /* The default pointer acceleration value. */
71 const int DEFAULT_POINTER_ACCELERATION = 3;
Siarhei Vishniakouf7436a12023-08-14 15:17:11 -070072
73 /**
74 * Use the default Velocity Tracker Strategy. Different axes may use different default
75 * strategies.
76 */
77 const int VELOCITY_TRACKER_STRATEGY_DEFAULT = -1;
78
79 /**
80 * Velocity Tracker Strategy: Impulse.
81 * Physical model of pushing an object. Quality: VERY GOOD.
82 * Works with duplicate coordinates, unclean finger liftoff.
83 */
84 const int VELOCITY_TRACKER_STRATEGY_IMPULSE = 0;
85
86 /**
87 * Velocity Tracker Strategy: LSQ1.
88 * 1st order least squares. Quality: POOR.
89 * Frequently underfits the touch data especially when the finger accelerates
90 * or changes direction. Often underestimates velocity. The direction
91 * is overly influenced by historical touch points.
92 */
93 const int VELOCITY_TRACKER_STRATEGY_LSQ1 = 1;
94
95 /**
96 * Velocity Tracker Strategy: LSQ2.
97 * 2nd order least squares. Quality: VERY GOOD.
98 * Pretty much ideal, but can be confused by certain kinds of touch data,
99 * particularly if the panel has a tendency to generate delayed,
100 * duplicate or jittery touch coordinates when the finger is released.
101 */
102 const int VELOCITY_TRACKER_STRATEGY_LSQ2 = 2;
103
104 /**
105 * Velocity Tracker Strategy: LSQ3.
106 * 3rd order least squares. Quality: UNUSABLE.
107 * Frequently overfits the touch data yielding wildly divergent estimates
108 * of the velocity when the finger is released.
109 */
110 const int VELOCITY_TRACKER_STRATEGY_LSQ3 = 3;
111
112 /**
113 * Velocity Tracker Strategy: WLSQ2_DELTA.
114 * 2nd order weighted least squares, delta weighting. Quality: EXPERIMENTAL
115 */
116 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_DELTA = 4;
117
118 /**
119 * Velocity Tracker Strategy: WLSQ2_CENTRAL.
120 * 2nd order weighted least squares, central weighting. Quality: EXPERIMENTALe
121 */
122 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_CENTRAL = 5;
123
124 /**
125 * Velocity Tracker Strategy: WLSQ2_RECENT.
126 * 2nd order weighted least squares, recent weighting. Quality: EXPERIMENTAL
127 */
128 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_RECENT = 6;
129
130 /**
131 * Velocity Tracker Strategy: INT1.
132 * 1st order integrating filter. Quality: GOOD.
133 * Not as good as 'lsq2' because it cannot estimate acceleration but it is
134 * more tolerant of errors. Like 'lsq1', this strategy tends to underestimate
135 * the velocity of a fling but this strategy tends to respond to changes in
136 * direction more quickly and accurately.
137 */
138 const int VELOCITY_TRACKER_STRATEGY_INT1 = 7;
139
140 /**
141 * Velocity Tracker Strategy: INT2.
142 * 2nd order integrating filter. Quality: EXPERIMENTAL.
143 * For comparison purposes only. Unlike 'int1' this strategy can compensate
144 * for acceleration but it typically overestimates the effect.
145 */
146 const int VELOCITY_TRACKER_STRATEGY_INT2 = 8;
147
148 /**
149 * Velocity Tracker Strategy: Legacy.
150 * Legacy velocity tracker algorithm. Quality: POOR.
151 * For comparison purposes only. This algorithm is strongly influenced by
152 * old data points, consistently underestimates velocity and takes a very long
153 * time to adjust to changes in direction.
154 */
155 const int VELOCITY_TRACKER_STRATEGY_LEGACY = 9;
Vaibhav Devmurarie58ffb92024-05-22 17:38:25 +0000156
157
158 /*
159 * Input device class: Keyboard
160 * The input device is a keyboard or has buttons.
161 *
162 * @hide
163 */
164 const int DEVICE_CLASS_KEYBOARD = 0x00000001;
165
166 /*
167 * Input device class: Alphakey
168 * The input device is an alpha-numeric keyboard (not just a dial pad).
169 *
170 * @hide
171 */
172 const int DEVICE_CLASS_ALPHAKEY = 0x00000002;
173
174 /*
175 * Input device class: Touch
176 * The input device is a touchscreen or a touchpad (either single-touch or multi-touch).
177 *
178 * @hide
179 */
180 const int DEVICE_CLASS_TOUCH = 0x00000004;
181
182 /*
183 * Input device class: Cursor
184 * The input device is a cursor device such as a trackball or mouse.
185 *
186 * @hide
187 */
188 const int DEVICE_CLASS_CURSOR = 0x00000008;
189
190 /*
191 * Input device class: Multi-touch
192 * The input device is a multi-touch touchscreen or touchpad.
193 *
194 * @hide
195 */
196 const int DEVICE_CLASS_TOUCH_MT = 0x00000010;
197
198 /*
199 * Input device class: Dpad
200 * The input device is a directional pad (implies keyboard, has DPAD keys).
201 *
202 * @hide
203 */
204 const int DEVICE_CLASS_DPAD = 0x00000020;
205
206 /*
207 * Input device class: Gamepad
208 * The input device is a gamepad (implies keyboard, has BUTTON keys).
209 *
210 * @hide
211 */
212 const int DEVICE_CLASS_GAMEPAD = 0x00000040;
213
214 /*
215 * Input device class: Switch
216 * The input device has switches.
217 *
218 * @hide
219 */
220 const int DEVICE_CLASS_SWITCH = 0x00000080;
221
222 /*
223 * Input device class: Joystick
224 * The input device is a joystick (implies gamepad, has joystick absolute axes).
225 *
226 * @hide
227 */
228 const int DEVICE_CLASS_JOYSTICK = 0x00000100;
229
230 /*
231 * Input device class: Vibrator
232 * The input device has a vibrator (supports FF_RUMBLE).
233 *
234 * @hide
235 */
236 const int DEVICE_CLASS_VIBRATOR = 0x00000200;
237
238 /*
239 * Input device class: Mic
240 * The input device has a microphone.
241 *
242 * @hide
243 */
244 const int DEVICE_CLASS_MIC = 0x00000400;
245
246 /*
247 * Input device class: External Stylus
248 * The input device is an external stylus (has data we want to fuse with touch data).
249 *
250 * @hide
251 */
252 const int DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800;
253
254 /*
255 * Input device class: Rotary Encoder
256 * The input device has a rotary encoder.
257 *
258 * @hide
259 */
260 const int DEVICE_CLASS_ROTARY_ENCODER = 0x00001000;
261
262 /*
263 * Input device class: Sensor
264 * The input device has a sensor like accelerometer, gyro, etc.
265 *
266 * @hide
267 */
268 const int DEVICE_CLASS_SENSOR = 0x00002000;
269
270 /*
271 * Input device class: Battery
272 * The input device has a battery.
273 *
274 * @hide
275 */
276 const int DEVICE_CLASS_BATTERY = 0x00004000;
277
278 /*
279 * Input device class: Light
280 * The input device has sysfs controllable lights.
281 *
282 * @hide
283 */
284 const int DEVICE_CLASS_LIGHT = 0x00008000;
285
286 /*
287 * Input device class: Touchpad
288 * The input device is a touchpad, requiring an on-screen cursor.
289 *
290 * @hide
291 */
292 const int DEVICE_CLASS_TOUCHPAD = 0x00010000;
293
294 /*
295 * Input device class: Virtual
296 * The input device is virtual (not a real device, not part of UI configuration).
297 *
298 * @hide
299 */
300 const int DEVICE_CLASS_VIRTUAL = 0x20000000;
301
302 /*
303 * Input device class: External
304 * The input device is external (not built-in).
305 *
306 * @hide
307 */
308 const int DEVICE_CLASS_EXTERNAL = 0x40000000;
Siarhei Vishniakou70622952020-07-30 11:17:23 -0500309}