Fix spurious ANRs involving window shuffling and non-fullscreen activities

Force the event-target bookkeeping to reset when an app explicitly
acknowledges event receipt.  Furthermore, notify the event dispatcher
whenever a new window is created, even if there is nominally an
existing event target window.

These changes in tandem address a subtle race bug in which the event
dispatcher believes that there is an event recipient that it is still
waiting for even when the event in question has been acknowledged;
this results in a spurious ANR.  There were checks in the existing code
that wound up doing the right thing in the case of windows becoming
hidden, but the case of non-fullscreen activities floating over them
[unavailable for input but still visible] exposed the race condition.

Bug: 2432828
Change-Id: I29fb741aace34736b029f9ba43f2c43184366258
1 file changed