Protect MotionEvent stream when a11y changes.

I found this hole while looking for a solution to a bug when
magnification was enabled when TalkBack was running. I believe
what was happening was that enabling/disabling magnification
resets the AccessibilityInputFilter. The filter batches MotionEvents
for processing with a choreographer, but the disable/enable cycle
when magnification gets enabled could disrupt the event stream.
This change flushes the batched events before objects using them
are disabled.

I've tried a variety of things, but I'm not able to reproduce the
bug on NYC using the same procedure. I suspect that either the
timing of the events is different, or the newer gesture detection
in TalkBack is protecting it somehow. The hole remains, though,
and could create invalid streams of MotionEvents without this fix.

Bug: 26613222
Change-Id: Ie9f3da459929397596e0a80a61d5c7f191001ee8
1 file changed