1 /** 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 17 package android.os; 18 19 20 /** @hide */ 21 interface IInputConstants 22 { 23 // 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 27 28 // 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; 36 37 /** 38 * 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 /** 46 * The input event was injected from accessibility. Used in policyFlags for input event 47 * injection. 48 */ 49 const int POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000; 50 51 /** 52 * This flag indicates that the window that received this motion event is partly 53 * or wholly obscured by another visible window above it and the event directly passed through 54 * the obscured area. 55 * 56 * A security sensitive application can check this flag to identify situations in which 57 * a malicious application may have covered up part of its content for the purpose 58 * of misleading the user or hijacking touches. An appropriate response might be 59 * to drop the suspect touches or to take additional precautions to confirm the user's 60 * actual intent. 61 */ 62 const int MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1; 63 64 /** 65 * This flag indicates that the window that received this motion event is partly 66 * or wholly obscured by another visible window above it and the event did not directly pass 67 * through the obscured area. 68 * 69 * A security sensitive application can check this flag to identify situations in which 70 * a malicious application may have covered up part of its content for the purpose 71 * of misleading the user or hijacking touches. An appropriate response might be 72 * to drop the suspect touches or to take additional precautions to confirm the user's 73 * actual intent. 74 * 75 * Unlike FLAG_WINDOW_IS_OBSCURED, this is only true if the window that received this event is 76 * obstructed in areas other than the touched location. 77 */ 78 const int MOTION_EVENT_FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 0x2; 79 80 /** 81 * This private flag is only set on {@link #ACTION_HOVER_MOVE} events and indicates that 82 * this event will be immediately followed by a {@link #ACTION_HOVER_EXIT}. It is used to 83 * prevent generating redundant {@link #ACTION_HOVER_ENTER} events. 84 * @hide 85 */ 86 const int MOTION_EVENT_FLAG_HOVER_EXIT_PENDING = 0x4; 87 88 /** 89 * This flag indicates that the event has been generated by a gesture generator. It 90 * provides a hint to the GestureDetector to not apply any touch slop. 91 * 92 * @hide 93 */ 94 const int MOTION_EVENT_FLAG_IS_GENERATED_GESTURE = 0x8; 95 96 /** 97 * This flag is only set for events with {@link #ACTION_POINTER_UP} and {@link #ACTION_CANCEL}. 98 * It indicates that the pointer going up was an unintentional user touch. When FLAG_CANCELED 99 * is set, the typical actions that occur in response for a pointer going up (such as click 100 * handlers, end of drawing) should be aborted. This flag is typically set when the user was 101 * accidentally touching the screen, such as by gripping the device, or placing the palm on the 102 * screen. 103 * 104 * @see #ACTION_POINTER_UP 105 * @see #ACTION_CANCEL 106 */ 107 const int INPUT_EVENT_FLAG_CANCELED = 0x20; 108 109 /** 110 * This flag indicates that the event will not cause a focus change if it is directed to an 111 * unfocused window, even if it an {@link #ACTION_DOWN}. This is typically used with pointer 112 * gestures to allow the user to direct gestures to an unfocused window without bringing the 113 * window into focus. 114 * @hide 115 */ 116 const int MOTION_EVENT_FLAG_NO_FOCUS_CHANGE = 0x40; 117 118 /** 119 * This flag indicates that the event has a valid value for AXIS_ORIENTATION. 120 * 121 * This is a private flag that is not used in Java. 122 * @hide 123 */ 124 const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_ORIENTATION = 0x80; 125 126 /** 127 * This flag indicates that the pointers' AXIS_ORIENTATION can be used to precisely determine 128 * the direction in which the tool is pointing. The value of the orientation axis will be in 129 * the range [-pi, pi], which represents a full circle. This is usually supported by devices 130 * like styluses. 131 * 132 * Conversely, AXIS_ORIENTATION cannot be used to tell which direction the tool is pointing 133 * when this flag is not set. In this case, the axis value will have a range of [-pi/2, pi/2], 134 * which represents half a circle. This is usually the case for devices like touchscreens and 135 * touchpads, for which it is difficult to tell which direction along the major axis of the 136 * touch ellipse the finger is pointing. 137 * 138 * This is a private flag that is not used in Java. 139 * @hide 140 */ 141 const int MOTION_EVENT_PRIVATE_FLAG_SUPPORTS_DIRECTIONAL_ORIENTATION = 0x100; 142 143 /** 144 * The input event was generated or modified by accessibility service. 145 * Shared by both KeyEvent and MotionEvent flags, so this value should not overlap with either 146 * set of flags, including in input/Input.h and in android/input.h. 147 */ 148 const int INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800; 149 150 /** 151 * Private flag that indicates when the system has detected that this motion event 152 * may be inconsistent with respect to the sequence of previously delivered motion events, 153 * such as when a pointer move event is sent but the pointer is not down. 154 * 155 * @hide 156 * @see #isTainted 157 * @see #setTainted 158 */ 159 const int INPUT_EVENT_FLAG_TAINTED = 0x80000000; 160 161 /** 162 * Private flag indicating that this event was synthesized by the system and should be delivered 163 * to the accessibility focused view first. When being dispatched such an event is not handled 164 * by predecessors of the accessibility focused view and after the event reaches that view the 165 * flag is cleared and normal event dispatch is performed. This ensures that the platform can 166 * click on any view that has accessibility focus which is semantically equivalent to asking the 167 * view to perform a click accessibility action but more generic as views not implementing click 168 * action correctly can still be activated. 169 * 170 * @hide 171 * @see #isTargetAccessibilityFocus() 172 * @see #setTargetAccessibilityFocus(boolean) 173 */ 174 const int MOTION_EVENT_FLAG_TARGET_ACCESSIBILITY_FOCUS = 0x40000000; 175 176 /* The default pointer acceleration value. */ 177 const int DEFAULT_POINTER_ACCELERATION = 3; 178 179 /** 180 * Use the default Velocity Tracker Strategy. Different axes may use different default 181 * strategies. 182 */ 183 const int VELOCITY_TRACKER_STRATEGY_DEFAULT = -1; 184 185 /** 186 * Velocity Tracker Strategy: Impulse. 187 * Physical model of pushing an object. Quality: VERY GOOD. 188 * Works with duplicate coordinates, unclean finger liftoff. 189 */ 190 const int VELOCITY_TRACKER_STRATEGY_IMPULSE = 0; 191 192 /** 193 * Velocity Tracker Strategy: LSQ1. 194 * 1st order least squares. Quality: POOR. 195 * Frequently underfits the touch data especially when the finger accelerates 196 * or changes direction. Often underestimates velocity. The direction 197 * is overly influenced by historical touch points. 198 */ 199 const int VELOCITY_TRACKER_STRATEGY_LSQ1 = 1; 200 201 /** 202 * Velocity Tracker Strategy: LSQ2. 203 * 2nd order least squares. Quality: VERY GOOD. 204 * Pretty much ideal, but can be confused by certain kinds of touch data, 205 * particularly if the panel has a tendency to generate delayed, 206 * duplicate or jittery touch coordinates when the finger is released. 207 */ 208 const int VELOCITY_TRACKER_STRATEGY_LSQ2 = 2; 209 210 /** 211 * Velocity Tracker Strategy: LSQ3. 212 * 3rd order least squares. Quality: UNUSABLE. 213 * Frequently overfits the touch data yielding wildly divergent estimates 214 * of the velocity when the finger is released. 215 */ 216 const int VELOCITY_TRACKER_STRATEGY_LSQ3 = 3; 217 218 /** 219 * Velocity Tracker Strategy: WLSQ2_DELTA. 220 * 2nd order weighted least squares, delta weighting. Quality: EXPERIMENTAL 221 */ 222 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_DELTA = 4; 223 224 /** 225 * Velocity Tracker Strategy: WLSQ2_CENTRAL. 226 * 2nd order weighted least squares, central weighting. Quality: EXPERIMENTALe 227 */ 228 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_CENTRAL = 5; 229 230 /** 231 * Velocity Tracker Strategy: WLSQ2_RECENT. 232 * 2nd order weighted least squares, recent weighting. Quality: EXPERIMENTAL 233 */ 234 const int VELOCITY_TRACKER_STRATEGY_WLSQ2_RECENT = 6; 235 236 /** 237 * Velocity Tracker Strategy: INT1. 238 * 1st order integrating filter. Quality: GOOD. 239 * Not as good as 'lsq2' because it cannot estimate acceleration but it is 240 * more tolerant of errors. Like 'lsq1', this strategy tends to underestimate 241 * the velocity of a fling but this strategy tends to respond to changes in 242 * direction more quickly and accurately. 243 */ 244 const int VELOCITY_TRACKER_STRATEGY_INT1 = 7; 245 246 /** 247 * Velocity Tracker Strategy: INT2. 248 * 2nd order integrating filter. Quality: EXPERIMENTAL. 249 * For comparison purposes only. Unlike 'int1' this strategy can compensate 250 * for acceleration but it typically overestimates the effect. 251 */ 252 const int VELOCITY_TRACKER_STRATEGY_INT2 = 8; 253 254 /** 255 * Velocity Tracker Strategy: Legacy. 256 * Legacy velocity tracker algorithm. Quality: POOR. 257 * For comparison purposes only. This algorithm is strongly influenced by 258 * old data points, consistently underestimates velocity and takes a very long 259 * time to adjust to changes in direction. 260 */ 261 const int VELOCITY_TRACKER_STRATEGY_LEGACY = 9; 262 263 264 /* 265 * Input device class: Keyboard 266 * The input device is a keyboard or has buttons. 267 * 268 * @hide 269 */ 270 const int DEVICE_CLASS_KEYBOARD = 0x00000001; 271 272 /* 273 * Input device class: Alphakey 274 * The input device is an alpha-numeric keyboard (not just a dial pad). 275 * 276 * @hide 277 */ 278 const int DEVICE_CLASS_ALPHAKEY = 0x00000002; 279 280 /* 281 * Input device class: Touch 282 * The input device is a touchscreen or a touchpad (either single-touch or multi-touch). 283 * 284 * @hide 285 */ 286 const int DEVICE_CLASS_TOUCH = 0x00000004; 287 288 /* 289 * Input device class: Cursor 290 * The input device is a cursor device such as a trackball or mouse. 291 * 292 * @hide 293 */ 294 const int DEVICE_CLASS_CURSOR = 0x00000008; 295 296 /* 297 * Input device class: Multi-touch 298 * The input device is a multi-touch touchscreen or touchpad. 299 * 300 * @hide 301 */ 302 const int DEVICE_CLASS_TOUCH_MT = 0x00000010; 303 304 /* 305 * Input device class: Dpad 306 * The input device is a directional pad (implies keyboard, has DPAD keys). 307 * 308 * @hide 309 */ 310 const int DEVICE_CLASS_DPAD = 0x00000020; 311 312 /* 313 * Input device class: Gamepad 314 * The input device is a gamepad (implies keyboard, has BUTTON keys). 315 * 316 * @hide 317 */ 318 const int DEVICE_CLASS_GAMEPAD = 0x00000040; 319 320 /* 321 * Input device class: Switch 322 * The input device has switches. 323 * 324 * @hide 325 */ 326 const int DEVICE_CLASS_SWITCH = 0x00000080; 327 328 /* 329 * Input device class: Joystick 330 * The input device is a joystick (implies gamepad, has joystick absolute axes). 331 * 332 * @hide 333 */ 334 const int DEVICE_CLASS_JOYSTICK = 0x00000100; 335 336 /* 337 * Input device class: Vibrator 338 * The input device has a vibrator (supports FF_RUMBLE). 339 * 340 * @hide 341 */ 342 const int DEVICE_CLASS_VIBRATOR = 0x00000200; 343 344 /* 345 * Input device class: Mic 346 * The input device has a microphone. 347 * 348 * @hide 349 */ 350 const int DEVICE_CLASS_MIC = 0x00000400; 351 352 /* 353 * Input device class: External Stylus 354 * The input device is an external stylus (has data we want to fuse with touch data). 355 * 356 * @hide 357 */ 358 const int DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800; 359 360 /* 361 * Input device class: Rotary Encoder 362 * The input device has a rotary encoder. 363 * 364 * @hide 365 */ 366 const int DEVICE_CLASS_ROTARY_ENCODER = 0x00001000; 367 368 /* 369 * Input device class: Sensor 370 * The input device has a sensor like accelerometer, gyro, etc. 371 * 372 * @hide 373 */ 374 const int DEVICE_CLASS_SENSOR = 0x00002000; 375 376 /* 377 * Input device class: Battery 378 * The input device has a battery. 379 * 380 * @hide 381 */ 382 const int DEVICE_CLASS_BATTERY = 0x00004000; 383 384 /* 385 * Input device class: Light 386 * The input device has sysfs controllable lights. 387 * 388 * @hide 389 */ 390 const int DEVICE_CLASS_LIGHT = 0x00008000; 391 392 /* 393 * Input device class: Touchpad 394 * The input device is a touchpad, requiring an on-screen cursor. 395 * 396 * @hide 397 */ 398 const int DEVICE_CLASS_TOUCHPAD = 0x00010000; 399 400 /* 401 * Input device class: Virtual 402 * The input device is virtual (not a real device, not part of UI configuration). 403 * 404 * @hide 405 */ 406 const int DEVICE_CLASS_VIRTUAL = 0x20000000; 407 408 /* 409 * Input device class: External 410 * The input device is external (not built-in). 411 * 412 * @hide 413 */ 414 const int DEVICE_CLASS_EXTERNAL = 0x40000000; 415 } 416