Ensure gamepad events have correct device id when a11y is enabled

When accessibility is enabled, all events are sent to inputfilter, and
then get reinjected into inputdispatcher.

Currently, inputdispatcher sets device id for all injected events to -1
to signify that it's not coming from a real device. However, in majority
of the cases, the events are indeed coming from a real device.

This test enables accessibility and creates a joystick device. It then
injects a button event, and checks that the event's device id is not set
to -1.

Bug: 175069843
Test: atest CtsInputTestCases:android.input.cts.GamepadWithAccessibilityTest
Test: atest AccessibilityGestureDispatchTest

Change-Id: I73a3d809eb13528473af4ca39ce98e3cd6a33641
6 files changed