diff options
| author | 2025-03-19 14:55:09 +0000 | |
|---|---|---|
| committer | 2025-03-19 15:15:28 +0000 | |
| commit | 3ff756b85efa91d0c2da4b8a3a4fb006142ad1e4 (patch) | |
| tree | 6e970c0f54b8db5ca8ca84e08a6abb2126764662 /libs/androidfw/FileStream.cpp | |
| parent | 1f27f396211bf9ea29dde977ca3dd499facceb94 (diff) | |
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
Diffstat (limited to 'libs/androidfw/FileStream.cpp')
0 files changed, 0 insertions, 0 deletions