Don't store the departing pointer in InputState

Before this CL, InputState stored the pointer that is leaving.
This is a problem when the request to cancel the current gesture comes
in. To cancel the gesture, the currently stored pointers were used. That
means that in a sequence of ACTION_DOWN -> ACTION_POINTER_DOWN ->
ACTION_POINTER_UP -> CANCEL, the cancel event would still be produced
with two pointers.

The correct behaviour to is to cancel the remaining pointer.

The solution here skips the addition of the departing pointer to the
InputState, and modifies the pointerCount appropriately.

Bug: 211379801
Test: m inputflinger_tests && $ANDROID_HOST_OUT/nativetest64/inputflinger_tests/inputflinger_tests --gtest_filter="*CancelAfterPointer0Up*"
Change-Id: I8323cc08a974d0ec880b5570f0cd572ee071522a
2 files changed