Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 50582ba7 authored by Cody Heiner's avatar Cody Heiner
Browse files

Fix possible crash in scale-invariant error calculation

The logic for the scale-invariant calculation was quite complex
in the existing code, and depended on some tricky chains of logical
dependence between scale-invariant errors and general errors.

This change firstly eliminates unnecessary nesting by pulling the
scale-invariant error calculation out of the loop – the full calculation
only occurs once per computeAtomFields call, within its own loop.

Secondly, instead of crashing under certain conditions when the
scale-invariant error count is zero, this changes the code to simply not
compute the error in this case. (The complex chain of logic I had
followed to initially add the fatal crash turned out to be fallacious.)

Finally, this adds a testcase that fails without the changes to the
MetricsManager implementation (see ag/26418604). This added testcase
represents skipped/dropped input events, or an input interval greater
than the prediction interval.

Test: atest frameworks/native/libs/input/tests/MotionPredictorMetricsManager_test.cpp
Test: the above test fails without the changes to MotionPredictionMetricsManager.cpp
Test: `statsd_testdrive 718`, then draw with stylus → reported metrics are reasonable

Bug: 325711945

Change-Id: Ic56c0f0c810ec1b85b1906e16a8640824187d1fb
parent e0bd3251
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment