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