Suggestions popup must be dismissed before device rotation.

This is a follow up CL for Ia515fc576ddf2127b2f9863cc2652aeb619fff6e
for Bug 5420741, which had basically the same goal to Bug 20158984.

The goal here is to dismiss any popup window opened by the TextView
when the device is about to be rotated.  This is important because
Window Manager and Input Method Manager Service are really sensitive
about which window is focused before and after the device is rotated.

In Ia515fc576ddf2127b2f9863cc2652aeb619fff6e, we tried to distinguish
two kinds of focus-lost. One is the true focus lost where suggestions
pop-up (if any) should be dismissed, and the other is an side effect
of showing the suggestions pop-up itself. We have used isShowingUp()
to distinguish distinguish one from the other. In short, it
indicates whether onWindowFocusChanged() is not called yet or is
called at least once.

In extract edit mode, however, it turned out that
onWindowFocusChanged() is never called (at least in recent builds).
As a result, the popup window is not dismissed when it should be.
One of the smallest solution would checking isShowingUp() only when
the target TextView is not ExtractEditText.

Adding unit test would be handled as Issue #20703391.

BUG: 5420741
BUG: 20158984
BUG: 20703391
Change-Id: I1706cf2ea0b0bdfe8894ab57fc3caa8ff12d8aab
1 file changed