Use dynamic event factory in dispatcher tests

This factory allows us to obtain ownership of the returned events. At
the same time, remove LOG(FATAL) from the tests.

Technically, the new factory approach isn't necessary. We could have
simply switched to returning raw unowned pointers instead of references,
and added the null check like in this CL. This would have been
sufficient to remove the fatal log statements. However, since this code is
already being touched here, might as well improve it further by changing
to the owned pointer model.

Without LOG(FATAL) in the tests, tests are allowed to run to completion
when there's a bug in the code. This allows the developer to understand
how many tests are failing, thus providing better signal about the work
in progress CL.

Bug: 308531018
Test: TEST=inputflinger_tests; m $TEST && $ANDROID_HOST_OUT/nativetest64/$TEST/$TEST
Change-Id: Iee88b35e871ef391aac0d68aa8322486287524e9
1 file changed