Siarhei Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 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 | { |
Peter Collingbourne | b04b9b8 | 2021-02-08 12:09:47 -0800 | [diff] [blame] | 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 |
Siarhei Vishniakou | 2508b87 | 2020-12-03 16:33:53 -1000 | [diff] [blame] | 27 | |
Siarhei Vishniakou | fc434ac | 2021-01-13 10:28:00 -1000 | [diff] [blame] | 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; |
Siarhei Vishniakou | 5d552c4 | 2021-05-21 05:02:22 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
Sandro Meier | d3d4060 | 2022-10-19 16:18:26 +0000 | [diff] [blame] | 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 | /** |
Siarhei Vishniakou | f00a4ec | 2021-06-16 03:55:32 +0000 | [diff] [blame] | 46 | * The input event was injected from accessibility. Used in policyFlags for input event |
| 47 | * injection. |
Siarhei Vishniakou | 5d552c4 | 2021-05-21 05:02:22 +0000 | [diff] [blame] | 48 | */ |
| 49 | const int POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY = 0x20000; |
Siarhei Vishniakou | f00a4ec | 2021-06-16 03:55:32 +0000 | [diff] [blame] | 50 | |
| 51 | /** |
| 52 | * The input event was generated or modified by accessibility service. |
| 53 | * Shared by both KeyEvent and MotionEvent flags, so this value should not overlap with either |
| 54 | * set of flags, including in input/Input.h and in android/input.h. |
| 55 | */ |
| 56 | const int INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT = 0x800; |
Prabir Pradhan | de78850 | 2021-12-22 00:26:07 -0800 | [diff] [blame] | 57 | |
Christine Franks | 46d8a1e | 2022-01-05 16:11:48 -0800 | [diff] [blame] | 58 | /* The default pointer acceleration value. */ |
| 59 | const int DEFAULT_POINTER_ACCELERATION = 3; |
Siarhei Vishniakou | f7436a1 | 2023-08-14 15:17:11 -0700 | [diff] [blame^] | 60 | |
| 61 | /** |
| 62 | * Use the default Velocity Tracker Strategy. Different axes may use different default |
| 63 | * strategies. |
| 64 | */ |
| 65 | const int VELOCITY_TRACKER_STRATEGY_DEFAULT = -1; |
| 66 | |
| 67 | /** |
| 68 | * Velocity Tracker Strategy: Impulse. |
| 69 | * Physical model of pushing an object. Quality: VERY GOOD. |
| 70 | * Works with duplicate coordinates, unclean finger liftoff. |
| 71 | */ |
| 72 | const int VELOCITY_TRACKER_STRATEGY_IMPULSE = 0; |
| 73 | |
| 74 | /** |
| 75 | * Velocity Tracker Strategy: LSQ1. |
| 76 | * 1st order least squares. Quality: POOR. |
| 77 | * Frequently underfits the touch data especially when the finger accelerates |
| 78 | * or changes direction. Often underestimates velocity. The direction |
| 79 | * is overly influenced by historical touch points. |
| 80 | */ |
| 81 | const int VELOCITY_TRACKER_STRATEGY_LSQ1 = 1; |
| 82 | |
| 83 | /** |
| 84 | * Velocity Tracker Strategy: LSQ2. |
| 85 | * 2nd order least squares. Quality: VERY GOOD. |
| 86 | * Pretty much ideal, but can be confused by certain kinds of touch data, |
| 87 | * particularly if the panel has a tendency to generate delayed, |
| 88 | * duplicate or jittery touch coordinates when the finger is released. |
| 89 | */ |
| 90 | const int VELOCITY_TRACKER_STRATEGY_LSQ2 = 2; |
| 91 | |
| 92 | /** |
| 93 | * Velocity Tracker Strategy: LSQ3. |
| 94 | * 3rd order least squares. Quality: UNUSABLE. |
| 95 | * Frequently overfits the touch data yielding wildly divergent estimates |
| 96 | * of the velocity when the finger is released. |
| 97 | */ |
| 98 | const int VELOCITY_TRACKER_STRATEGY_LSQ3 = 3; |
| 99 | |
| 100 | /** |
| 101 | * Velocity Tracker Strategy: WLSQ2_DELTA. |
| 102 | * 2nd order weighted least squares, delta weighting. Quality: EXPERIMENTAL |
| 103 | */ |
| 104 | const int VELOCITY_TRACKER_STRATEGY_WLSQ2_DELTA = 4; |
| 105 | |
| 106 | /** |
| 107 | * Velocity Tracker Strategy: WLSQ2_CENTRAL. |
| 108 | * 2nd order weighted least squares, central weighting. Quality: EXPERIMENTALe |
| 109 | */ |
| 110 | const int VELOCITY_TRACKER_STRATEGY_WLSQ2_CENTRAL = 5; |
| 111 | |
| 112 | /** |
| 113 | * Velocity Tracker Strategy: WLSQ2_RECENT. |
| 114 | * 2nd order weighted least squares, recent weighting. Quality: EXPERIMENTAL |
| 115 | */ |
| 116 | const int VELOCITY_TRACKER_STRATEGY_WLSQ2_RECENT = 6; |
| 117 | |
| 118 | /** |
| 119 | * Velocity Tracker Strategy: INT1. |
| 120 | * 1st order integrating filter. Quality: GOOD. |
| 121 | * Not as good as 'lsq2' because it cannot estimate acceleration but it is |
| 122 | * more tolerant of errors. Like 'lsq1', this strategy tends to underestimate |
| 123 | * the velocity of a fling but this strategy tends to respond to changes in |
| 124 | * direction more quickly and accurately. |
| 125 | */ |
| 126 | const int VELOCITY_TRACKER_STRATEGY_INT1 = 7; |
| 127 | |
| 128 | /** |
| 129 | * Velocity Tracker Strategy: INT2. |
| 130 | * 2nd order integrating filter. Quality: EXPERIMENTAL. |
| 131 | * For comparison purposes only. Unlike 'int1' this strategy can compensate |
| 132 | * for acceleration but it typically overestimates the effect. |
| 133 | */ |
| 134 | const int VELOCITY_TRACKER_STRATEGY_INT2 = 8; |
| 135 | |
| 136 | /** |
| 137 | * Velocity Tracker Strategy: Legacy. |
| 138 | * Legacy velocity tracker algorithm. Quality: POOR. |
| 139 | * For comparison purposes only. This algorithm is strongly influenced by |
| 140 | * old data points, consistently underestimates velocity and takes a very long |
| 141 | * time to adjust to changes in direction. |
| 142 | */ |
| 143 | const int VELOCITY_TRACKER_STRATEGY_LEGACY = 9; |
Siarhei Vishniakou | 7062295 | 2020-07-30 11:17:23 -0500 | [diff] [blame] | 144 | } |