Address Pointer Capture crash during rapid toggles

If an app has pointer capture enabled, and it rapidly toggles capture
off and on, there is a high likelihood for a system crash. We can
deterministically reproduce this case in the tests, so we address that
use case here.

Bug: 230850070
Test: atest inputflinger_tests
Change-Id: I1ecacf468d48b3def30fd5844d2e25128569e289
2 files changed