blob: f8e505299cede9dc2475c49d0ffaef6d2ed28b63 [file] [log] [blame]
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +01001/*
2 * Copyright (C) 2017 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#define LOG_TAG "VelocityTracker_test"
18
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +000019#include <math.h>
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -070020#include <array>
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -070021#include <chrono>
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +000022#include <limits>
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010023
24#include <android-base/stringprintf.h>
chaviw09c8d2d2020-08-24 15:48:26 -070025#include <attestation/HmacKeyManager.h>
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010026#include <gtest/gtest.h>
chaviw3277faf2021-05-19 16:45:23 -050027#include <gui/constants.h>
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010028#include <input/VelocityTracker.h>
29
Siarhei Vishniakou9f26fc32022-06-17 22:13:57 +000030using std::literals::chrono_literals::operator""ms;
31using std::literals::chrono_literals::operator""ns;
32using std::literals::chrono_literals::operator""us;
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010033using android::base::StringPrintf;
34
35namespace android {
36
Siarhei Vishniakou777a10b2018-01-31 16:45:06 -080037constexpr int32_t DISPLAY_ID = ADISPLAY_ID_DEFAULT; // default display id
38
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010039constexpr int32_t DEFAULT_POINTER_ID = 0; // pointer ID used for manually defined tests
40
41// velocity must be in the range (1-tol)*EV <= velocity <= (1+tol)*EV
42// here EV = expected value, tol = VELOCITY_TOLERANCE
43constexpr float VELOCITY_TOLERANCE = 0.2;
44
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -070045// estimate coefficients must be within 0.001% of the target value
46constexpr float COEFFICIENT_TOLERANCE = 0.00001;
47
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010048// --- VelocityTrackerTest ---
49class VelocityTrackerTest : public testing::Test { };
50
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -070051/*
52 * Similar to EXPECT_NEAR, but ensures that the difference between the two float values
53 * is at most a certain fraction of the target value.
54 * If fraction is zero, require exact match.
55 */
56static void EXPECT_NEAR_BY_FRACTION(float actual, float target, float fraction) {
57 float tolerance = fabsf(target * fraction);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010058
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -070059 if (target == 0 && fraction != 0) {
60 // If target is zero, this would force actual == target, which is too harsh.
61 // Relax this requirement a little. The value is determined empirically from the
62 // coefficients computed by the quadratic least squares algorithms.
63 tolerance = 1E-6;
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010064 }
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -070065 EXPECT_NEAR(actual, target, tolerance);
66}
67
68static void checkVelocity(float Vactual, float Vtarget) {
69 EXPECT_NEAR_BY_FRACTION(Vactual, Vtarget, VELOCITY_TOLERANCE);
70}
71
72static void checkCoefficient(float actual, float target) {
73 EXPECT_NEAR_BY_FRACTION(actual, target, COEFFICIENT_TOLERANCE);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010074}
75
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010076struct Position {
Siarhei Vishniakou01ca4862019-03-06 13:22:13 -080077 float x;
78 float y;
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -070079
80 /**
81 * If both values are NAN, then this is considered to be an empty entry (no pointer data).
82 * If only one of the values is NAN, this is still a valid entry,
83 * because we may only care about a single axis.
84 */
85 bool isValid() const {
86 return !(isnan(x) && isnan(y));
87 }
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +010088};
89
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -070090struct MotionEventEntry {
91 std::chrono::nanoseconds eventTime;
92 std::vector<Position> positions;
93};
94
95static BitSet32 getValidPointers(const std::vector<Position>& positions) {
96 BitSet32 pointers;
97 for (size_t i = 0; i < positions.size(); i++) {
98 if (positions[i].isValid()) {
99 pointers.markBit(i);
100 }
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100101 }
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700102 return pointers;
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100103}
104
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700105static uint32_t getChangingPointerId(BitSet32 pointers, BitSet32 otherPointers) {
106 BitSet32 difference(pointers.value ^ otherPointers.value);
107 uint32_t pointerId = difference.clearFirstMarkedBit();
108 EXPECT_EQ(0U, difference.value) << "Only 1 pointer can enter or leave at a time";
109 return pointerId;
110}
111
112static int32_t resolveAction(const std::vector<Position>& lastPositions,
113 const std::vector<Position>& currentPositions,
114 const std::vector<Position>& nextPositions) {
115 BitSet32 pointers = getValidPointers(currentPositions);
116 const uint32_t pointerCount = pointers.count();
117
118 BitSet32 lastPointers = getValidPointers(lastPositions);
119 const uint32_t lastPointerCount = lastPointers.count();
120 if (lastPointerCount < pointerCount) {
121 // A new pointer is down
122 uint32_t pointerId = getChangingPointerId(pointers, lastPointers);
123 return AMOTION_EVENT_ACTION_POINTER_DOWN |
124 (pointerId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
125 }
126
127 BitSet32 nextPointers = getValidPointers(nextPositions);
128 const uint32_t nextPointerCount = nextPointers.count();
129 if (pointerCount > nextPointerCount) {
130 // An existing pointer is leaving
131 uint32_t pointerId = getChangingPointerId(pointers, nextPointers);
132 return AMOTION_EVENT_ACTION_POINTER_UP |
133 (pointerId << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT);
134 }
135
136 return AMOTION_EVENT_ACTION_MOVE;
137}
138
139static std::vector<MotionEvent> createMotionEventStream(
140 const std::vector<MotionEventEntry>& motions) {
141 if (motions.empty()) {
142 ADD_FAILURE() << "Need at least 1 sample to create a MotionEvent. Received empty vector.";
143 }
144
145 std::vector<MotionEvent> events;
146 for (size_t i = 0; i < motions.size(); i++) {
147 const MotionEventEntry& entry = motions[i];
148 BitSet32 pointers = getValidPointers(entry.positions);
149 const uint32_t pointerCount = pointers.count();
150
151 int32_t action;
152 if (i == 0) {
153 action = AMOTION_EVENT_ACTION_DOWN;
154 EXPECT_EQ(1U, pointerCount) << "First event should only have 1 pointer";
Siarhei Vishniakou9f26fc32022-06-17 22:13:57 +0000155 } else if ((i == motions.size() - 1) && pointerCount == 1) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700156 action = AMOTION_EVENT_ACTION_UP;
157 } else {
158 const MotionEventEntry& previousEntry = motions[i-1];
159 const MotionEventEntry& nextEntry = motions[i+1];
160 action = resolveAction(previousEntry.positions, entry.positions, nextEntry.positions);
161 }
162
163 PointerCoords coords[pointerCount];
164 PointerProperties properties[pointerCount];
165 uint32_t pointerIndex = 0;
166 while(!pointers.isEmpty()) {
167 uint32_t pointerId = pointers.clearFirstMarkedBit();
168
169 coords[pointerIndex].clear();
170 // We are treating column positions as pointerId
171 EXPECT_TRUE(entry.positions[pointerId].isValid()) <<
172 "The entry at pointerId must be valid";
173 coords[pointerIndex].setAxisValue(AMOTION_EVENT_AXIS_X, entry.positions[pointerId].x);
174 coords[pointerIndex].setAxisValue(AMOTION_EVENT_AXIS_Y, entry.positions[pointerId].y);
175
176 properties[pointerIndex].id = pointerId;
177 properties[pointerIndex].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER;
178 pointerIndex++;
179 }
180 EXPECT_EQ(pointerIndex, pointerCount);
181
182 MotionEvent event;
chaviw9eaa22c2020-07-01 16:21:27 -0700183 ui::Transform identityTransform;
Garfield Tan4cc839f2020-01-24 11:26:14 -0800184 event.initialize(InputEvent::nextId(), 0 /*deviceId*/, AINPUT_SOURCE_TOUCHSCREEN,
185 DISPLAY_ID, INVALID_HMAC, action, 0 /*actionButton*/, 0 /*flags*/,
186 AMOTION_EVENT_EDGE_FLAG_NONE, AMETA_NONE, 0 /*buttonState*/,
chaviw9eaa22c2020-07-01 16:21:27 -0700187 MotionClassification::NONE, identityTransform, 0 /*xPrecision*/,
188 0 /*yPrecision*/, AMOTION_EVENT_INVALID_CURSOR_POSITION,
Prabir Pradhanb9b18502021-08-26 12:30:32 -0700189 AMOTION_EVENT_INVALID_CURSOR_POSITION, identityTransform, 0 /*downTime*/,
Evan Rosky09576692021-07-01 12:22:09 -0700190 entry.eventTime.count(), pointerCount, properties, coords);
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700191
192 events.emplace_back(event);
193 }
194
195 return events;
196}
197
Chris Yef8591482020-04-17 11:49:17 -0700198static void computeAndCheckVelocity(const VelocityTracker::Strategy strategy,
199 const std::vector<MotionEventEntry>& motions, int32_t axis,
Siarhei Vishniakou9f26fc32022-06-17 22:13:57 +0000200 float targetVelocity, uint32_t pointerId = DEFAULT_POINTER_ID) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700201 VelocityTracker vt(strategy);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100202
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700203 std::vector<MotionEvent> events = createMotionEventStream(motions);
204 for (MotionEvent event : events) {
205 vt.addMovement(&event);
206 }
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100207
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +0000208 checkVelocity(vt.getVelocity(axis, pointerId).value_or(0), targetVelocity);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100209}
210
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700211static void computeAndCheckQuadraticEstimate(const std::vector<MotionEventEntry>& motions,
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -0700212 const std::array<float, 3>& coefficients) {
Chris Yef8591482020-04-17 11:49:17 -0700213 VelocityTracker vt(VelocityTracker::Strategy::LSQ2);
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700214 std::vector<MotionEvent> events = createMotionEventStream(motions);
215 for (MotionEvent event : events) {
216 vt.addMovement(&event);
217 }
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +0000218 VelocityTracker::Estimator estimatorX;
219 VelocityTracker::Estimator estimatorY;
220 EXPECT_TRUE(vt.getEstimator(AMOTION_EVENT_AXIS_X, 0, &estimatorX));
221 EXPECT_TRUE(vt.getEstimator(AMOTION_EVENT_AXIS_Y, 0, &estimatorY));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -0700222 for (size_t i = 0; i< coefficients.size(); i++) {
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +0000223 checkCoefficient(estimatorX.coeff[i], coefficients[i]);
224 checkCoefficient(estimatorY.coeff[i], coefficients[i]);
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -0700225 }
226}
227
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100228/*
229 * ================== VelocityTracker tests generated manually =====================================
230 */
Yeabkal Wubshit384ab0f2022-09-09 16:39:18 +0000231TEST_F(VelocityTrackerTest, TestComputedVelocity) {
232 VelocityTracker::ComputedVelocity computedVelocity;
233
234 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 0 /*id*/, 200 /*velocity*/);
235 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 26U /*id*/, 400 /*velocity*/);
236 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, 27U /*id*/, 650 /*velocity*/);
237 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID, 750 /*velocity*/);
238 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 0 /*id*/, 1000 /*velocity*/);
239 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 26U /*id*/, 2000 /*velocity*/);
240 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, 27U /*id*/, 3000 /*velocity*/);
241 computedVelocity.addVelocity(AMOTION_EVENT_AXIS_Y, MAX_POINTER_ID, 4000 /*velocity*/);
242
243 // Check the axes/indices with velocity.
244 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 0U /*id*/)), 200);
245 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 26U /*id*/)), 400);
246 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, 27U /*id*/)), 650);
247 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID)), 750);
248 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 0U /*id*/)), 1000);
249 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 26U /*id*/)), 2000);
250 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, 27U /*id*/)), 3000);
251 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, MAX_POINTER_ID)), 4000);
252 for (uint32_t id = 0; id <= MAX_POINTER_ID; id++) {
253 // Since no data was added for AXIS_SCROLL, expect empty value for the axis for any id.
254 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_SCROLL, id))
255 << "Empty scroll data expected at id=" << id;
256 if (id == 0 || id == 26U || id == 27U || id == MAX_POINTER_ID) {
257 // Already checked above; continue.
258 continue;
259 }
260 // No data was added to X/Y for this id, expect empty value.
261 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, id))
262 << "Empty X data expected at id=" << id;
263 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, id))
264 << "Empty Y data expected at id=" << id;
265 }
266 // Out-of-bounds ids should given empty values.
267 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, -1));
268 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, MAX_POINTER_ID + 1));
269}
270
271TEST_F(VelocityTrackerTest, TestGetComputedVelocity) {
272 std::vector<MotionEventEntry> motions = {
273 {235089067457000ns, {{528.00, 0}}}, {235089084684000ns, {{527.00, 0}}},
274 {235089093349000ns, {{527.00, 0}}}, {235089095677625ns, {{527.00, 0}}},
275 {235089101859000ns, {{527.00, 0}}}, {235089110378000ns, {{528.00, 0}}},
276 {235089112497111ns, {{528.25, 0}}}, {235089118760000ns, {{531.00, 0}}},
277 {235089126686000ns, {{535.00, 0}}}, {235089129316820ns, {{536.33, 0}}},
278 {235089135199000ns, {{540.00, 0}}}, {235089144297000ns, {{546.00, 0}}},
279 {235089146136443ns, {{547.21, 0}}}, {235089152923000ns, {{553.00, 0}}},
280 {235089160784000ns, {{559.00, 0}}}, {235089162955851ns, {{560.66, 0}}},
281 {235089162955851ns, {{560.66, 0}}}, // ACTION_UP
282 };
283 VelocityTracker vt(VelocityTracker::Strategy::IMPULSE);
284 std::vector<MotionEvent> events = createMotionEventStream(motions);
285 for (const MotionEvent& event : events) {
286 vt.addMovement(&event);
287 }
288
289 float maxFloat = std::numeric_limits<float>::max();
290 VelocityTracker::ComputedVelocity computedVelocity;
291 computedVelocity = vt.getComputedVelocity(1000 /* units */, maxFloat);
292 checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)),
293 764.345703);
294
295 // Expect X velocity to be scaled with respective to provided units.
296 computedVelocity = vt.getComputedVelocity(1000000 /* units */, maxFloat);
297 checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)),
298 764345.703);
299
300 // Expect X velocity to be clamped by provided max velocity.
301 computedVelocity = vt.getComputedVelocity(1000000 /* units */, 1000);
302 checkVelocity(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_X, DEFAULT_POINTER_ID)), 1000);
303
304 // All 0 data for Y; expect 0 velocity.
305 EXPECT_EQ(*(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_Y, DEFAULT_POINTER_ID)), 0);
306
307 // No data for scroll-axis; expect empty velocity.
308 EXPECT_FALSE(computedVelocity.getVelocity(AMOTION_EVENT_AXIS_SCROLL, DEFAULT_POINTER_ID));
309}
310
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700311TEST_F(VelocityTrackerTest, ThreePointsPositiveVelocityTest) {
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100312 // Same coordinate is reported 2 times in a row
313 // It is difficult to determine the correct answer here, but at least the direction
314 // of the reported velocity should be positive.
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700315 std::vector<MotionEventEntry> motions = {
chaviw9eaa22c2020-07-01 16:21:27 -0700316 {0ms, {{273, 0}}},
317 {12585us, {{293, 0}}},
318 {14730us, {{293, 0}}},
319 {14730us, {{293, 0}}}, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100320 };
Chris Yef8591482020-04-17 11:49:17 -0700321 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
322 1600);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100323}
324
325TEST_F(VelocityTrackerTest, ThreePointsZeroVelocityTest) {
326 // Same coordinate is reported 3 times in a row
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700327 std::vector<MotionEventEntry> motions = {
chaviw9eaa22c2020-07-01 16:21:27 -0700328 {0ms, {{293, 0}}},
329 {6132us, {{293, 0}}},
330 {11283us, {{293, 0}}},
331 {11283us, {{293, 0}}}, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100332 };
Chris Yef8591482020-04-17 11:49:17 -0700333 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 0);
334 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 0);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100335}
336
337TEST_F(VelocityTrackerTest, ThreePointsLinearVelocityTest) {
338 // Fixed velocity at 5 points per 10 milliseconds
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700339 std::vector<MotionEventEntry> motions = {
chaviw9eaa22c2020-07-01 16:21:27 -0700340 {0ms, {{0, 0}}}, {10ms, {{5, 0}}}, {20ms, {{10, 0}}}, {20ms, {{10, 0}}}, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100341 };
Chris Yef8591482020-04-17 11:49:17 -0700342 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 500);
343 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 500);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100344}
345
346
347/**
348 * ================== VelocityTracker tests generated by recording real events =====================
349 *
350 * To add a test, record the input coordinates and event times to all calls
351 * to void VelocityTracker::addMovement(const MotionEvent* event).
352 * Also record all calls to VelocityTracker::clear().
353 * Finally, record the output of VelocityTracker::getVelocity(...)
354 * This will give you the necessary data to create a new test.
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700355 *
356 * Another good way to generate this data is to use 'dumpsys input' just after the event has
357 * occurred.
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100358 */
359
360// --------------- Recorded by hand on swordfish ---------------------------------------------------
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700361TEST_F(VelocityTrackerTest, SwordfishFlingDown) {
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100362 // Recording of a fling on Swordfish that could cause a fling in the wrong direction
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700363 std::vector<MotionEventEntry> motions = {
364 { 0ms, {{271, 96}} },
365 { 16071042ns, {{269.786346, 106.922775}} },
366 { 35648403ns, {{267.983063, 156.660034}} },
367 { 52313925ns, {{262.638397, 220.339081}} },
368 { 68976522ns, {{266.138824, 331.581116}} },
369 { 85639375ns, {{274.79245, 428.113159}} },
370 { 96948871ns, {{274.79245, 428.113159}} },
371 { 96948871ns, {{274.79245, 428.113159}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100372 };
Chris Yef8591482020-04-17 11:49:17 -0700373 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
374 623.577637);
375 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
376 5970.7309);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100377}
378
379// --------------- Recorded by hand on sailfish, generated by a script -----------------------------
380// For some of these tests, the X-direction velocity checking has been removed, because the lsq2
381// and the impulse VelocityTrackerStrategies did not agree within 20%.
382// Since the flings were recorded in the Y-direction, the intentional user action should only
383// be relevant for the Y axis.
384// There have been also cases where lsq2 and impulse disagreed more than 20% in the Y-direction.
385// Those recordings have been discarded because we didn't feel one strategy's interpretation was
386// more correct than another's but didn't want to increase the tolerance for the entire test suite.
387//
388// There are 18 tests total below: 9 in the positive Y direction and 9 in the opposite.
389// The recordings were loosely binned into 3 categories - slow, faster, and fast, which roughly
390// characterizes the velocity of the finger motion.
391// These can be treated approximately as:
392// slow - less than 1 page gets scrolled
393// faster - more than 1 page gets scrolled, but less than 3
394// fast - entire list is scrolled (fling is done as hard as possible)
395
396TEST_F(VelocityTrackerTest, SailfishFlingUpSlow1) {
397 // Sailfish - fling up - slow - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700398 std::vector<MotionEventEntry> motions = {
399 { 235089067457000ns, {{528.00, 983.00}} },
400 { 235089084684000ns, {{527.00, 981.00}} },
401 { 235089093349000ns, {{527.00, 977.00}} },
402 { 235089095677625ns, {{527.00, 975.93}} },
403 { 235089101859000ns, {{527.00, 970.00}} },
404 { 235089110378000ns, {{528.00, 960.00}} },
405 { 235089112497111ns, {{528.25, 957.51}} },
406 { 235089118760000ns, {{531.00, 946.00}} },
407 { 235089126686000ns, {{535.00, 931.00}} },
408 { 235089129316820ns, {{536.33, 926.02}} },
409 { 235089135199000ns, {{540.00, 914.00}} },
410 { 235089144297000ns, {{546.00, 896.00}} },
411 { 235089146136443ns, {{547.21, 892.36}} },
412 { 235089152923000ns, {{553.00, 877.00}} },
413 { 235089160784000ns, {{559.00, 851.00}} },
414 { 235089162955851ns, {{560.66, 843.82}} },
415 { 235089162955851ns, {{560.66, 843.82}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100416 };
Chris Yef8591482020-04-17 11:49:17 -0700417 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
Siarhei Vishniakoue37bcec2021-09-28 14:24:32 -0700418 764.345703);
Chris Yef8591482020-04-17 11:49:17 -0700419 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
420 951.698181);
421 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
422 -3604.819336);
423 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
424 -3044.966064);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100425}
426
427
428TEST_F(VelocityTrackerTest, SailfishFlingUpSlow2) {
429 // Sailfish - fling up - slow - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700430 std::vector<MotionEventEntry> motions = {
431 { 235110560704000ns, {{522.00, 1107.00}} },
432 { 235110575764000ns, {{522.00, 1107.00}} },
433 { 235110584385000ns, {{522.00, 1107.00}} },
434 { 235110588421179ns, {{521.52, 1106.52}} },
435 { 235110592830000ns, {{521.00, 1106.00}} },
436 { 235110601385000ns, {{520.00, 1104.00}} },
437 { 235110605088160ns, {{519.14, 1102.27}} },
438 { 235110609952000ns, {{518.00, 1100.00}} },
439 { 235110618353000ns, {{517.00, 1093.00}} },
440 { 235110621755146ns, {{516.60, 1090.17}} },
441 { 235110627010000ns, {{517.00, 1081.00}} },
442 { 235110634785000ns, {{518.00, 1063.00}} },
443 { 235110638422450ns, {{518.87, 1052.58}} },
444 { 235110643161000ns, {{520.00, 1039.00}} },
445 { 235110651767000ns, {{524.00, 1011.00}} },
446 { 235110655089581ns, {{525.54, 1000.19}} },
447 { 235110660368000ns, {{530.00, 980.00}} },
448 { 235110660368000ns, {{530.00, 980.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100449 };
Chris Yef8591482020-04-17 11:49:17 -0700450 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
451 -4096.583008);
452 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
453 -3455.094238);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100454}
455
456
457TEST_F(VelocityTrackerTest, SailfishFlingUpSlow3) {
458 // Sailfish - fling up - slow - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700459 std::vector<MotionEventEntry> motions = {
460 { 792536237000ns, {{580.00, 1317.00}} },
461 { 792541538987ns, {{580.63, 1311.94}} },
462 { 792544613000ns, {{581.00, 1309.00}} },
463 { 792552301000ns, {{583.00, 1295.00}} },
464 { 792558362309ns, {{585.13, 1282.92}} },
465 { 792560828000ns, {{586.00, 1278.00}} },
466 { 792569446000ns, {{589.00, 1256.00}} },
467 { 792575185095ns, {{591.54, 1241.41}} },
468 { 792578491000ns, {{593.00, 1233.00}} },
469 { 792587044000ns, {{597.00, 1211.00}} },
470 { 792592008172ns, {{600.28, 1195.92}} },
471 { 792594616000ns, {{602.00, 1188.00}} },
472 { 792603129000ns, {{607.00, 1167.00}} },
473 { 792608831290ns, {{609.48, 1155.83}} },
474 { 792612321000ns, {{611.00, 1149.00}} },
475 { 792620768000ns, {{615.00, 1131.00}} },
476 { 792625653873ns, {{617.32, 1121.73}} },
477 { 792629200000ns, {{619.00, 1115.00}} },
478 { 792629200000ns, {{619.00, 1115.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100479 };
Chris Yef8591482020-04-17 11:49:17 -0700480 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
481 574.33429);
482 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
483 617.40564);
484 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
485 -2361.982666);
486 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
487 -2500.055664);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100488}
489
490
491TEST_F(VelocityTrackerTest, SailfishFlingUpFaster1) {
492 // Sailfish - fling up - faster - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700493 std::vector<MotionEventEntry> motions = {
494 { 235160420675000ns, {{610.00, 1042.00}} },
495 { 235160428220000ns, {{609.00, 1026.00}} },
496 { 235160436544000ns, {{609.00, 1024.00}} },
497 { 235160441852394ns, {{609.64, 1020.82}} },
498 { 235160444878000ns, {{610.00, 1019.00}} },
499 { 235160452673000ns, {{613.00, 1006.00}} },
500 { 235160458519743ns, {{617.18, 992.06}} },
501 { 235160461061000ns, {{619.00, 986.00}} },
502 { 235160469798000ns, {{627.00, 960.00}} },
503 { 235160475186713ns, {{632.22, 943.02}} },
504 { 235160478051000ns, {{635.00, 934.00}} },
505 { 235160486489000ns, {{644.00, 906.00}} },
506 { 235160491853697ns, {{649.56, 890.56}} },
507 { 235160495177000ns, {{653.00, 881.00}} },
508 { 235160504148000ns, {{662.00, 858.00}} },
509 { 235160509231495ns, {{666.81, 845.37}} },
510 { 235160512603000ns, {{670.00, 837.00}} },
511 { 235160520366000ns, {{679.00, 814.00}} },
512 { 235160520366000ns, {{679.00, 814.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100513 };
Chris Yef8591482020-04-17 11:49:17 -0700514 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
515 1274.141724);
516 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
517 1438.53186);
518 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
519 -3001.4348);
520 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
521 -3695.859619);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100522}
523
524
525TEST_F(VelocityTrackerTest, SailfishFlingUpFaster2) {
526 // Sailfish - fling up - faster - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700527 std::vector<MotionEventEntry> motions = {
528 { 847153808000ns, {{576.00, 1264.00}} },
529 { 847171174000ns, {{576.00, 1262.00}} },
530 { 847179640000ns, {{576.00, 1257.00}} },
531 { 847185187540ns, {{577.41, 1249.22}} },
532 { 847187487000ns, {{578.00, 1246.00}} },
533 { 847195710000ns, {{581.00, 1227.00}} },
534 { 847202027059ns, {{583.93, 1209.40}} },
535 { 847204324000ns, {{585.00, 1203.00}} },
536 { 847212672000ns, {{590.00, 1176.00}} },
537 { 847218861395ns, {{594.36, 1157.11}} },
538 { 847221190000ns, {{596.00, 1150.00}} },
539 { 847230484000ns, {{602.00, 1124.00}} },
540 { 847235701400ns, {{607.56, 1103.83}} },
541 { 847237986000ns, {{610.00, 1095.00}} },
542 { 847237986000ns, {{610.00, 1095.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100543 };
Chris Yef8591482020-04-17 11:49:17 -0700544 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
545 -4280.07959);
546 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
547 -4241.004395);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100548}
549
550
551TEST_F(VelocityTrackerTest, SailfishFlingUpFaster3) {
552 // Sailfish - fling up - faster - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700553 std::vector<MotionEventEntry> motions = {
554 { 235200532789000ns, {{507.00, 1084.00}} },
555 { 235200549221000ns, {{507.00, 1083.00}} },
556 { 235200557841000ns, {{507.00, 1081.00}} },
557 { 235200558051189ns, {{507.00, 1080.95}} },
558 { 235200566314000ns, {{507.00, 1078.00}} },
559 { 235200574876586ns, {{508.97, 1070.12}} },
560 { 235200575006000ns, {{509.00, 1070.00}} },
561 { 235200582900000ns, {{514.00, 1054.00}} },
562 { 235200591276000ns, {{525.00, 1023.00}} },
563 { 235200591701829ns, {{525.56, 1021.42}} },
564 { 235200600064000ns, {{542.00, 976.00}} },
565 { 235200608519000ns, {{563.00, 911.00}} },
566 { 235200608527086ns, {{563.02, 910.94}} },
567 { 235200616933000ns, {{590.00, 844.00}} },
568 { 235200616933000ns, {{590.00, 844.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100569 };
Chris Yef8591482020-04-17 11:49:17 -0700570 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
571 -8715.686523);
572 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
573 -7639.026367);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100574}
575
576
577TEST_F(VelocityTrackerTest, SailfishFlingUpFast1) {
578 // Sailfish - fling up - fast - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700579 std::vector<MotionEventEntry> motions = {
580 { 920922149000ns, {{561.00, 1412.00}} },
581 { 920930185000ns, {{559.00, 1377.00}} },
582 { 920930262463ns, {{558.98, 1376.66}} },
583 { 920938547000ns, {{559.00, 1371.00}} },
584 { 920947096857ns, {{562.91, 1342.68}} },
585 { 920947302000ns, {{563.00, 1342.00}} },
586 { 920955502000ns, {{577.00, 1272.00}} },
587 { 920963931021ns, {{596.87, 1190.54}} },
588 { 920963987000ns, {{597.00, 1190.00}} },
589 { 920972530000ns, {{631.00, 1093.00}} },
590 { 920980765511ns, {{671.31, 994.68}} },
591 { 920980906000ns, {{672.00, 993.00}} },
592 { 920989261000ns, {{715.00, 903.00}} },
593 { 920989261000ns, {{715.00, 903.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100594 };
Chris Yef8591482020-04-17 11:49:17 -0700595 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
596 5670.329102);
597 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
598 5991.866699);
599 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
600 -13021.101562);
601 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
602 -15093.995117);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100603}
604
605
606TEST_F(VelocityTrackerTest, SailfishFlingUpFast2) {
607 // Sailfish - fling up - fast - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700608 std::vector<MotionEventEntry> motions = {
609 { 235247153233000ns, {{518.00, 1168.00}} },
610 { 235247170452000ns, {{517.00, 1167.00}} },
611 { 235247178908000ns, {{515.00, 1159.00}} },
612 { 235247179556213ns, {{514.85, 1158.39}} },
613 { 235247186821000ns, {{515.00, 1125.00}} },
614 { 235247195265000ns, {{521.00, 1051.00}} },
615 { 235247196389476ns, {{521.80, 1041.15}} },
616 { 235247203649000ns, {{538.00, 932.00}} },
617 { 235247212253000ns, {{571.00, 794.00}} },
618 { 235247213222491ns, {{574.72, 778.45}} },
619 { 235247220736000ns, {{620.00, 641.00}} },
620 { 235247220736000ns, {{620.00, 641.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100621 };
Chris Yef8591482020-04-17 11:49:17 -0700622 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
623 -20286.958984);
624 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
625 -20494.587891);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100626}
627
628
629TEST_F(VelocityTrackerTest, SailfishFlingUpFast3) {
630 // Sailfish - fling up - fast - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700631 std::vector<MotionEventEntry> motions = {
632 { 235302568736000ns, {{529.00, 1167.00}} },
633 { 235302576644000ns, {{523.00, 1140.00}} },
634 { 235302579395063ns, {{520.91, 1130.61}} },
635 { 235302585140000ns, {{522.00, 1130.00}} },
636 { 235302593615000ns, {{527.00, 1065.00}} },
637 { 235302596207444ns, {{528.53, 1045.12}} },
638 { 235302602102000ns, {{559.00, 872.00}} },
639 { 235302610545000ns, {{652.00, 605.00}} },
640 { 235302613019881ns, {{679.26, 526.73}} },
641 { 235302613019881ns, {{679.26, 526.73}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100642 };
Chris Yef8591482020-04-17 11:49:17 -0700643 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
644 -39295.941406);
645 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
646 -36461.421875);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100647}
648
649
650TEST_F(VelocityTrackerTest, SailfishFlingDownSlow1) {
651 // Sailfish - fling down - slow - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700652 std::vector<MotionEventEntry> motions = {
653 { 235655749552755ns, {{582.00, 432.49}} },
654 { 235655750638000ns, {{582.00, 433.00}} },
655 { 235655758865000ns, {{582.00, 440.00}} },
656 { 235655766221523ns, {{581.16, 448.43}} },
657 { 235655767594000ns, {{581.00, 450.00}} },
658 { 235655776044000ns, {{580.00, 462.00}} },
659 { 235655782890696ns, {{579.18, 474.35}} },
660 { 235655784360000ns, {{579.00, 477.00}} },
661 { 235655792795000ns, {{578.00, 496.00}} },
662 { 235655799559531ns, {{576.27, 515.04}} },
663 { 235655800612000ns, {{576.00, 518.00}} },
664 { 235655809535000ns, {{574.00, 542.00}} },
665 { 235655816988015ns, {{572.17, 564.86}} },
666 { 235655817685000ns, {{572.00, 567.00}} },
667 { 235655825981000ns, {{569.00, 595.00}} },
668 { 235655833808653ns, {{566.26, 620.60}} },
669 { 235655834541000ns, {{566.00, 623.00}} },
670 { 235655842893000ns, {{563.00, 649.00}} },
671 { 235655842893000ns, {{563.00, 649.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100672 };
Chris Yef8591482020-04-17 11:49:17 -0700673 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
674 -419.749695);
675 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
676 -398.303894);
677 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
678 3309.016357);
679 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
680 3969.099854);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100681}
682
683
684TEST_F(VelocityTrackerTest, SailfishFlingDownSlow2) {
685 // Sailfish - fling down - slow - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700686 std::vector<MotionEventEntry> motions = {
687 { 235671152083370ns, {{485.24, 558.28}} },
688 { 235671154126000ns, {{485.00, 559.00}} },
689 { 235671162497000ns, {{484.00, 566.00}} },
690 { 235671168750511ns, {{483.27, 573.29}} },
691 { 235671171071000ns, {{483.00, 576.00}} },
692 { 235671179390000ns, {{482.00, 588.00}} },
693 { 235671185417210ns, {{481.31, 598.98}} },
694 { 235671188173000ns, {{481.00, 604.00}} },
695 { 235671196371000ns, {{480.00, 624.00}} },
696 { 235671202084196ns, {{479.27, 639.98}} },
697 { 235671204235000ns, {{479.00, 646.00}} },
698 { 235671212554000ns, {{478.00, 673.00}} },
699 { 235671219471011ns, {{476.39, 697.12}} },
700 { 235671221159000ns, {{476.00, 703.00}} },
701 { 235671229592000ns, {{474.00, 734.00}} },
702 { 235671236281462ns, {{472.43, 758.38}} },
703 { 235671238098000ns, {{472.00, 765.00}} },
704 { 235671246532000ns, {{470.00, 799.00}} },
705 { 235671246532000ns, {{470.00, 799.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100706 };
Chris Yef8591482020-04-17 11:49:17 -0700707 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
708 -262.80426);
709 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
710 -243.665344);
711 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
712 4215.682129);
713 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
714 4587.986816);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100715}
716
717
718TEST_F(VelocityTrackerTest, SailfishFlingDownSlow3) {
719 // Sailfish - fling down - slow - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700720 std::vector<MotionEventEntry> motions = {
721 { 170983201000ns, {{557.00, 533.00}} },
722 { 171000668000ns, {{556.00, 534.00}} },
723 { 171007359750ns, {{554.73, 535.27}} },
724 { 171011197000ns, {{554.00, 536.00}} },
725 { 171017660000ns, {{552.00, 540.00}} },
726 { 171024201831ns, {{549.97, 544.73}} },
727 { 171027333000ns, {{549.00, 547.00}} },
728 { 171034603000ns, {{545.00, 557.00}} },
729 { 171041043371ns, {{541.98, 567.55}} },
730 { 171043147000ns, {{541.00, 571.00}} },
731 { 171051052000ns, {{536.00, 586.00}} },
732 { 171051052000ns, {{536.00, 586.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100733 };
Chris Yef8591482020-04-17 11:49:17 -0700734 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
735 -723.413513);
736 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
737 -651.038452);
738 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
739 2091.502441);
740 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
741 1934.517456);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100742}
743
744
745TEST_F(VelocityTrackerTest, SailfishFlingDownFaster1) {
746 // Sailfish - fling down - faster - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700747 std::vector<MotionEventEntry> motions = {
748 { 235695280333000ns, {{558.00, 451.00}} },
749 { 235695283971237ns, {{558.43, 454.45}} },
750 { 235695289038000ns, {{559.00, 462.00}} },
751 { 235695297388000ns, {{561.00, 478.00}} },
752 { 235695300638465ns, {{561.83, 486.25}} },
753 { 235695305265000ns, {{563.00, 498.00}} },
754 { 235695313591000ns, {{564.00, 521.00}} },
755 { 235695317305492ns, {{564.43, 532.68}} },
756 { 235695322181000ns, {{565.00, 548.00}} },
757 { 235695330709000ns, {{565.00, 577.00}} },
758 { 235695333972227ns, {{565.00, 588.10}} },
759 { 235695339250000ns, {{565.00, 609.00}} },
760 { 235695347839000ns, {{565.00, 642.00}} },
761 { 235695351313257ns, {{565.00, 656.18}} },
762 { 235695356412000ns, {{565.00, 677.00}} },
763 { 235695364899000ns, {{563.00, 710.00}} },
764 { 235695368118682ns, {{562.24, 722.52}} },
765 { 235695373403000ns, {{564.00, 744.00}} },
766 { 235695373403000ns, {{564.00, 744.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100767 };
Chris Yef8591482020-04-17 11:49:17 -0700768 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
769 4254.639648);
770 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
771 4698.415039);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100772}
773
774
775TEST_F(VelocityTrackerTest, SailfishFlingDownFaster2) {
776 // Sailfish - fling down - faster - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700777 std::vector<MotionEventEntry> motions = {
778 { 235709624766000ns, {{535.00, 579.00}} },
779 { 235709642256000ns, {{534.00, 580.00}} },
780 { 235709643350278ns, {{533.94, 580.06}} },
781 { 235709650760000ns, {{532.00, 584.00}} },
782 { 235709658615000ns, {{530.00, 593.00}} },
783 { 235709660170495ns, {{529.60, 594.78}} },
784 { 235709667095000ns, {{527.00, 606.00}} },
785 { 235709675616000ns, {{524.00, 628.00}} },
786 { 235709676983261ns, {{523.52, 631.53}} },
787 { 235709684289000ns, {{521.00, 652.00}} },
788 { 235709692763000ns, {{518.00, 682.00}} },
789 { 235709693804993ns, {{517.63, 685.69}} },
790 { 235709701438000ns, {{515.00, 709.00}} },
791 { 235709709830000ns, {{512.00, 739.00}} },
792 { 235709710626776ns, {{511.72, 741.85}} },
793 { 235709710626776ns, {{511.72, 741.85}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100794 };
Chris Yef8591482020-04-17 11:49:17 -0700795 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
796 -430.440247);
797 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
798 -447.600311);
799 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
800 3953.859375);
801 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
802 4316.155273);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100803}
804
805
806TEST_F(VelocityTrackerTest, SailfishFlingDownFaster3) {
807 // Sailfish - fling down - faster - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700808 std::vector<MotionEventEntry> motions = {
809 { 235727628927000ns, {{540.00, 440.00}} },
810 { 235727636810000ns, {{537.00, 454.00}} },
811 { 235727646176000ns, {{536.00, 454.00}} },
812 { 235727653586628ns, {{535.12, 456.65}} },
813 { 235727654557000ns, {{535.00, 457.00}} },
814 { 235727663024000ns, {{534.00, 465.00}} },
815 { 235727670410103ns, {{533.04, 479.45}} },
816 { 235727670691000ns, {{533.00, 480.00}} },
817 { 235727679255000ns, {{531.00, 501.00}} },
818 { 235727687233704ns, {{529.09, 526.73}} },
819 { 235727687628000ns, {{529.00, 528.00}} },
820 { 235727696113000ns, {{526.00, 558.00}} },
821 { 235727704057546ns, {{523.18, 588.98}} },
822 { 235727704576000ns, {{523.00, 591.00}} },
823 { 235727713099000ns, {{520.00, 626.00}} },
824 { 235727720880776ns, {{516.33, 655.36}} },
825 { 235727721580000ns, {{516.00, 658.00}} },
826 { 235727721580000ns, {{516.00, 658.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100827 };
Chris Yef8591482020-04-17 11:49:17 -0700828 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
829 4484.617676);
830 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
831 4927.92627);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100832}
833
834
835TEST_F(VelocityTrackerTest, SailfishFlingDownFast1) {
836 // Sailfish - fling down - fast - 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700837 std::vector<MotionEventEntry> motions = {
838 { 235762352849000ns, {{467.00, 286.00}} },
839 { 235762360250000ns, {{443.00, 344.00}} },
840 { 235762362787412ns, {{434.77, 363.89}} },
841 { 235762368807000ns, {{438.00, 359.00}} },
842 { 235762377220000ns, {{425.00, 423.00}} },
843 { 235762379608561ns, {{421.31, 441.17}} },
844 { 235762385698000ns, {{412.00, 528.00}} },
845 { 235762394133000ns, {{406.00, 648.00}} },
846 { 235762396429369ns, {{404.37, 680.67}} },
847 { 235762396429369ns, {{404.37, 680.67}} }, //ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100848 };
Chris Yef8591482020-04-17 11:49:17 -0700849 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
850 14227.0224);
851 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
852 16064.685547);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100853}
854
855
856TEST_F(VelocityTrackerTest, SailfishFlingDownFast2) {
857 // Sailfish - fling down - fast - 2
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700858 std::vector<MotionEventEntry> motions = {
859 { 235772487188000ns, {{576.00, 204.00}} },
860 { 235772495159000ns, {{553.00, 236.00}} },
861 { 235772503568000ns, {{551.00, 240.00}} },
862 { 235772508192247ns, {{545.55, 254.17}} },
863 { 235772512051000ns, {{541.00, 266.00}} },
864 { 235772520794000ns, {{520.00, 337.00}} },
865 { 235772525015263ns, {{508.92, 394.43}} },
866 { 235772529174000ns, {{498.00, 451.00}} },
867 { 235772537635000ns, {{484.00, 589.00}} },
868 { 235772537635000ns, {{484.00, 589.00}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100869 };
Chris Yef8591482020-04-17 11:49:17 -0700870 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
871 18660.048828);
872 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
873 16918.439453);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100874}
875
876
877TEST_F(VelocityTrackerTest, SailfishFlingDownFast3) {
878 // Sailfish - fling down - fast - 3
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700879 std::vector<MotionEventEntry> motions = {
880 { 507650295000ns, {{628.00, 233.00}} },
881 { 507658234000ns, {{605.00, 269.00}} },
882 { 507666784000ns, {{601.00, 274.00}} },
883 { 507669660483ns, {{599.65, 275.68}} },
884 { 507675427000ns, {{582.00, 308.00}} },
885 { 507683740000ns, {{541.00, 404.00}} },
886 { 507686506238ns, {{527.36, 435.95}} },
887 { 507692220000ns, {{487.00, 581.00}} },
888 { 507700707000ns, {{454.00, 792.00}} },
889 { 507703352649ns, {{443.71, 857.77}} },
890 { 507703352649ns, {{443.71, 857.77}} }, // ACTION_UP
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100891 };
Chris Yef8591482020-04-17 11:49:17 -0700892 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
893 -4111.8173);
894 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X,
895 -6388.48877);
896 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y,
897 29765.908203);
898 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y,
899 28354.796875);
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +0100900}
901
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700902/**
903 * ================== Multiple pointers ============================================================
904 *
905 * Three fingers quickly tap the screen. Since this is a tap, the velocities should be zero.
906 * If the events with POINTER_UP or POINTER_DOWN are not handled correctly (these should not be
907 * part of the fitted data), this can cause large velocity values to be reported instead.
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700908 */
Siarhei Vishniakou346ac6a2019-04-10 09:58:05 -0700909TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_ThreeFingerTap) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700910 std::vector<MotionEventEntry> motions = {
911 { 0us, {{1063, 1128}, {NAN, NAN}, {NAN, NAN}} },
912 { 10800us, {{1063, 1128}, {682, 1318}, {NAN, NAN}} }, // POINTER_DOWN
913 { 10800us, {{1063, 1128}, {682, 1318}, {397, 1747}} }, // POINTER_DOWN
914 { 267300us, {{1063, 1128}, {682, 1318}, {397, 1747}} }, // POINTER_UP
915 { 267300us, {{1063, 1128}, {NAN, NAN}, {397, 1747}} }, // POINTER_UP
916 { 272700us, {{1063, 1128}, {NAN, NAN}, {NAN, NAN}} },
917 };
918
Siarhei Vishniakou346ac6a2019-04-10 09:58:05 -0700919 // Velocity should actually be zero, but we expect 0.016 here instead.
920 // This is close enough to zero, and is likely caused by division by a very small number.
Siarhei Vishniakou9f26fc32022-06-17 22:13:57 +0000921 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 0);
922 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_Y, 0);
Chris Yef8591482020-04-17 11:49:17 -0700923 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 0);
924 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_Y, 0);
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700925}
926
927/**
Siarhei Vishniakou9f26fc32022-06-17 22:13:57 +0000928 * ================= Pointer liftoff ===============================================================
929 */
930
931/**
932 * The last movement of a pointer is always ACTION_POINTER_UP or ACTION_UP. If there's a short delay
933 * between the last ACTION_MOVE and the next ACTION_POINTER_UP or ACTION_UP, velocity should not be
934 * affected by the liftoff.
935 */
936TEST_F(VelocityTrackerTest, ShortDelayBeforeActionUp) {
937 std::vector<MotionEventEntry> motions = {
938 {0ms, {{10, 0}}}, {10ms, {{20, 0}}}, {20ms, {{30, 0}}}, {30ms, {{30, 0}}}, // ACTION_UP
939 };
940 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X,
941 1000);
942 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 1000);
943}
944
945/**
946 * The last movement of a single pointer is ACTION_UP. If there's a long delay between the last
947 * ACTION_MOVE and the final ACTION_UP, velocity should be reported as zero because the pointer
948 * should be assumed to have stopped.
949 */
950TEST_F(VelocityTrackerTest, LongDelayBeforeActionUp) {
951 std::vector<MotionEventEntry> motions = {
952 {0ms, {{10, 0}}},
953 {10ms, {{20, 0}}},
954 {20ms, {{30, 0}}},
955 {3000ms, {{30, 0}}}, // ACTION_UP
956 };
957 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 0);
958 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 0);
959}
960
961/**
962 * The last movement of a pointer is always ACTION_POINTER_UP or ACTION_UP. If there's a long delay
963 * before ACTION_POINTER_UP event, the movement should be assumed to have stopped.
964 * The final velocity should be reported as zero for all pointers.
965 */
966TEST_F(VelocityTrackerTest, LongDelayBeforeActionPointerUp) {
967 std::vector<MotionEventEntry> motions = {
968 {0ms, {{10, 0}}},
969 {10ms, {{20, 0}, {100, 0}}},
970 {20ms, {{30, 0}, {200, 0}}},
971 {30ms, {{30, 0}, {300, 0}}},
972 {40ms, {{30, 0}, {400, 0}}},
973 {3000ms, {{30, 0}}}, // ACTION_POINTER_UP
974 };
975 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 0,
976 /*pointerId*/ 0);
977 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 0,
978 /*pointerId*/ 0);
979 computeAndCheckVelocity(VelocityTracker::Strategy::IMPULSE, motions, AMOTION_EVENT_AXIS_X, 0,
980 /*pointerId*/ 1);
981 computeAndCheckVelocity(VelocityTracker::Strategy::LSQ2, motions, AMOTION_EVENT_AXIS_X, 0,
982 /*pointerId*/ 1);
983}
984
985/**
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -0700986 * ================== Tests for least squares fitting ==============================================
987 *
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -0700988 * Special care must be taken when constructing tests for LeastSquaresVelocityTrackerStrategy
989 * getEstimator function. In particular:
990 * - inside the function, time gets converted from nanoseconds to seconds
991 * before being used in the fit.
992 * - any values that are older than 100 ms are being discarded.
993 * - the newest time gets subtracted from all of the other times before being used in the fit.
994 * So these tests have to be designed with those limitations in mind.
995 *
996 * General approach for the tests below:
997 * We only used timestamps in milliseconds, 0 ms, 1 ms, and 2 ms, to be sure that
998 * we are well within the HORIZON range.
999 * When specifying the expected values of the coefficients, we treat the x values as if
1000 * they were in ms. Then, to adjust for the time units, the coefficients get progressively
1001 * multiplied by powers of 1E3.
1002 * For example:
1003 * data: t(ms), x
1004 * 1 ms, 1
1005 * 2 ms, 4
1006 * 3 ms, 9
1007 * The coefficients are (0, 0, 1).
1008 * In the test, we would convert these coefficients to (0*(1E3)^0, 0*(1E3)^1, 1*(1E3)^2).
1009 */
1010TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_Constant) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001011 std::vector<MotionEventEntry> motions = {
1012 { 0ms, {{1, 1}} }, // 0 s
1013 { 1ms, {{1, 1}} }, // 0.001 s
1014 { 2ms, {{1, 1}} }, // 0.002 s
1015 { 2ms, {{1, 1}} }, // ACTION_UP
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001016 };
1017 // The data used for the fit will be as follows:
1018 // time(s), position
1019 // -0.002, 1
1020 // -0.001, 1
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001021 // -0.ms, 1
1022 computeAndCheckQuadraticEstimate(motions, std::array<float, 3>({1, 0, 0}));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001023}
1024
1025/*
1026 * Straight line y = x :: the constant and quadratic coefficients are zero.
1027 */
1028TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_Linear) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001029 std::vector<MotionEventEntry> motions = {
1030 { 0ms, {{-2, -2}} },
1031 { 1ms, {{-1, -1}} },
1032 { 2ms, {{-0, -0}} },
1033 { 2ms, {{-0, -0}} }, // ACTION_UP
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001034 };
1035 // The data used for the fit will be as follows:
1036 // time(s), position
1037 // -0.002, -2
1038 // -0.001, -1
1039 // -0.000, 0
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001040 computeAndCheckQuadraticEstimate(motions, std::array<float, 3>({0, 1E3, 0}));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001041}
1042
1043/*
1044 * Parabola
1045 */
1046TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_Parabolic) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001047 std::vector<MotionEventEntry> motions = {
1048 { 0ms, {{1, 1}} },
1049 { 1ms, {{4, 4}} },
1050 { 2ms, {{8, 8}} },
1051 { 2ms, {{8, 8}} }, // ACTION_UP
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001052 };
1053 // The data used for the fit will be as follows:
1054 // time(s), position
1055 // -0.002, 1
1056 // -0.001, 4
1057 // -0.000, 8
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001058 computeAndCheckQuadraticEstimate(motions, std::array<float, 3>({8, 4.5E3, 0.5E6}));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001059}
1060
1061/*
1062 * Parabola
1063 */
1064TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_Parabolic2) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001065 std::vector<MotionEventEntry> motions = {
1066 { 0ms, {{1, 1}} },
1067 { 1ms, {{4, 4}} },
1068 { 2ms, {{9, 9}} },
1069 { 2ms, {{9, 9}} }, // ACTION_UP
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001070 };
1071 // The data used for the fit will be as follows:
1072 // time(s), position
1073 // -0.002, 1
1074 // -0.001, 4
1075 // -0.000, 9
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001076 computeAndCheckQuadraticEstimate(motions, std::array<float, 3>({9, 6E3, 1E6}));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001077}
1078
1079/*
1080 * Parabola :: y = x^2 :: the constant and linear coefficients are zero.
1081 */
1082TEST_F(VelocityTrackerTest, LeastSquaresVelocityTrackerStrategyEstimator_Parabolic3) {
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001083 std::vector<MotionEventEntry> motions = {
1084 { 0ms, {{4, 4}} },
1085 { 1ms, {{1, 1}} },
1086 { 2ms, {{0, 0}} },
1087 { 2ms, {{0, 0}} }, // ACTION_UP
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001088 };
1089 // The data used for the fit will be as follows:
1090 // time(s), position
1091 // -0.002, 4
1092 // -0.001, 1
1093 // -0.000, 0
Siarhei Vishniakou651c1ea2019-04-09 14:12:41 -07001094 computeAndCheckQuadraticEstimate(motions, std::array<float, 3>({0, 0E3, 1E6}));
Siarhei Vishniakouf7e2d3e2018-09-07 16:38:18 -07001095}
Siarhei Vishniakoud4b607e2017-06-13 12:21:59 +01001096
1097} // namespace android