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

Commit 3ff756b8 authored by Harry Cutts's avatar Harry Cutts
Browse files

uinput: fix end-of-file handling

Change I69c2cb651cd871ea0ceea9702c66b76abb37285a inadvertently broke
evemu playback from a file, because when getNextEvent() called
CommentAwareReader#isAtEndOfFile(), CommentAwareReader#findNextLine()
hadn't been called, so it hadn't realized it was at the end of the file.
That meant expectLine() failed because acceptLine() returned null.

This wasn't caught because when used in "interactive mode" (e.g. with a
test passing one line at a time and checking the injections), the
parsing exception only occurred at the end, by which time all events had
been injected. When passing a whole recording at once (either by setting
the command-line parameter or piping a file into standard input), the
parsing error occurred before any of the scheduled event injections. The
unit tests for EvemuParser didn't check the behaviour of getNextEvent()
at the end of the recording, something which this change also fixes.

Test: $ adb shell uinput - < some-recording.evemu
Test: $ adb shell uinput /sdcard/some-recording.evemu
Test: make an evemu recording with only an 'N:' line and check the
      special EOF parsing error message shows up
Test: $ atest --host UinputTestsRavenwood
Test: $ atest \
      InputTests:com.android.test.input.UinputRecordingIntegrationTests
Bug: 367419268
Flag: TEST_ONLY
Change-Id: I1f0e185cf42b3d57b0b384718ffeeb78d99248c5
parent 1f27f396
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