CapturedTouchpadEventConverter: fix button reporting

The previous implementation had a couple of issues with reporting
BUTTON_PRESS or _RELEASE events with no pointers, which are invalid.
This occurred when the evdev device reported a button press one sync
before reporting a touch going down (observed when tapping hard and fast
on an Apple Magic Trackpad 2), or when the last touch lifted in the same
evdev sync as the button being released.

Bug: b/281825527
Test: atest inputflinger_tests
Test: manual checking of events reported to a test app capturing the pad
Change-Id: I1676a1ab9281872c745416ad41186c65a44eb581
2 files changed