summaryrefslogtreecommitdiff
path: root/libs/gui/DisplayEventDispatcher.cpp
diff options
context:
space:
mode:
author Siarhei Vishniakou <svv@google.com> 2021-07-09 03:22:42 +0000
committer Siarhei Vishniakou <svv@google.com> 2021-11-08 23:25:29 +0000
commitf9cb2a7f8b960a6046d8cc0fb3371044faed34b5 (patch)
tree86bfc3d73fd122f79b18259ab659c0323cc0cda7 /libs/gui/DisplayEventDispatcher.cpp
parent134b8f0adf2800e71b2d33c066b65f5c52e5a1ce (diff)
Fully delete duplicate entries inside LatencyTracker
Inside LatencyTracker, we use 2 collections that must always be in sync: mTimelines and mEventTimes. However, when duplicate input events are encountered, we do not treat these collections equally. In one of them, we fully remove all data associated with the duplicate inputEventId. In the other one, however, we only remove the entry that matches both the inputEventId and the eventTime. This means that the two collections will get out of sync, because the entry with the mismatching eventTime will be kept in mEventTimes. To fix this, fully remove all entries with the duplicate inputEventId, no matter what the eventTime is. Unfortunately, it means that we have to traverse the entire collection of mEventTimes. However, since this event should not occur often, it should not impact performance. This issue was discovered via the use of the newly added fuzzer for LatencyTracker. The fuzzer would hit this condition in about 2 seconds after the run has started. This issue could have been identified the fuzzer was in place from the start. The removal of api 'reportNow': The api 'reportNow' was added for convenience of writing tests. However, this api has reduced the code coverage, since we would now short-circuit the code around 'trackListener' that was responsible for event reporting. This is why, when the issue was first being worked on, the tests for duplicate events did not yield any crashes. To avoid such problems in the future, fully remove this api and replace with a 'triggerEventReporting' method that's defined in the tests. This way, the api's that are used by production code and by tests are identical. Bug: 169866723 Bug: 205511073 Test: m inputflinger_latencytracker_fuzzer && adb sync data && adb shell /data/fuzz/arm64/inputflinger_latencytracker_fuzzer/inputflinger_latencytracker_fuzzer Test: atest inputflinger_tests:LatencyTrackerTest Change-Id: I04069cf2c9eb1154e3324b25c8c4bdff32d84d3f Merged-In: I04069cf2c9eb1154e3324b25c8c4bdff32d84d3f
Diffstat (limited to 'libs/gui/DisplayEventDispatcher.cpp')
0 files changed, 0 insertions, 0 deletions