Fix window focus change timing issue

The state change of window focus is an asynchronous operation between
system server and its client application. Some related APIs are
highly depending on the window focus state such as
View.onWindowFocusChanged(boolean hasWindowFocus) and
InputMethodManager.isActive(View view). For the instrumentations
below which need to check above conditions they should be waiting
until window focus change is done.

android.view.cts.ViewTest#testInputConnection
android.view.cts.ViewTest#testWindowFocusChanged
android.view.inputmethod.cts.InputMethodManagerTest#testInputMethodManager

Change-Id: I6db9adbbee9ab79fd5ac65b8ff3bd9e215874d97

Conflicts:

	tests/tests/view/src/android/view/cts/ViewTest.java
2 files changed