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