Fix race condition causing CTS failures: bug 6951063

android.widget.cts.AutoCompleteTextViewTest#testPerformCompletion was
failing intermittently. The cause turned out to be a race between the
request to show the dropdown and the button presses to select the item.
Before the fix, fails on 4/10 runs (on Galaxy Nexus), after the fix
no fails seen.

Change-Id: Idc13ae4cd154320803d19ee2eca192fa4ac6a1dd
diff --git a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
index 0198b10..f7cf4d3 100755
--- a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
@@ -520,6 +520,7 @@
                 mAutoCompleteTextView.showDropDown();
             }
         });
+        mInstrumentation.waitForIdleSync();
         mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_DOWN);
         mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
         assertTrue(listener.isOnItemClicked());