InputDispatcher: Use correct coordinate space when synthesizing down

Input targets for synthesized down events were not created using the
same pipeline as normal dispatching. Due to this, things like window and
display transforms were not being applied to the events. This means the
ACTION_DOWN event did not have the correct coordinates in many cases.

Here, we fix that by attempting to use the same pipeline as normal
dispatching for creating the input target. When it's not possible to do
due to there being no window (e.g. for global monitors), we fall back to
creating the target ourselves.

Bug: 287908447
Test: atest inputflinger_tests
Change-Id: I6987619c91e458249aa7c7be884566e4b21363c4
2 files changed