Ensure wallpaper connection is valid before canceling its events

The InputDispatcher function
'synthesizeCancelationEventsForConnectionLocked' expects non-null
connection. Ideally, we would refactor this function to receive
Connection&. However, this connection needs to be passed to other
functions called within, so for simplicity, we are keeping the incoming
parameter as sp<Connection>.

That means that the called must ensure that the connection is not null.
Fix the previous wallpaper CL by checking if the connection is null.

Bug: 206651192
Test: atest inputflinger_tests
Change-Id: Id6d9235144606a629dfbd2614e211412def1a68e
2 files changed