Ensure that a11y window state change event is sent on focus change

Currently when the focus changes, an accessibility event of
TYPE_WINDOW_STATE_CHANGED is dispatched from ViewRootImpl. This logic is
implemented in performTraversals(), but the logic depends on the value
mAttachInfo.mHasWindowFocus, which is updated from an input event
handleWindowFocusChanged(). There's no guarantee that always
performTraversals() is called after handleWindowFocusChanged().

As a result, sometimes accessibility event is not dispatched after focus
change.

This change fixes the issue by explicitly dispatching the event in
handleWindowFocusChanged() if needed.

Bug: 260310672
Bug: 214318644
Test: Accessibility CTS
Change-Id: I95cf3a7a9c7951f8b3862713ed7339688a8427d5
1 file changed