Poll for isTouchExplorationEnabled

This test could possibly fail if isTouchExplorationEnabled is false and
some setState message has not been processed by
AccessibilityManagerTest. Maybe it's a thread visibility issue though
and the test doesn't see the update.

Bug 6537582

Change-Id: I0c691813a0d5e2ad1312bcb04ded2650ae0c0019
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 92e1363..2ddb4d8 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -22,6 +22,7 @@
     <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
     <classpathentry kind="src" path="cts/tests/src"/>
     <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
+    <classpathentry kind="src" path="cts/tests/tests/accessibility/src"/>
     <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
     <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
     <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
diff --git a/tests/tests/accessibility/Android.mk b/tests/tests/accessibility/Android.mk
index b3453e3..ad8f719 100644
--- a/tests/tests/accessibility/Android.mk
+++ b/tests/tests/accessibility/Android.mk
@@ -26,6 +26,8 @@
 
 LOCAL_PACKAGE_NAME := CtsAccessibilityTestCases
 
+LOCAL_STATIC_JAVA_LIBRARIES := ctsutil
+
 # This test runner sets up/cleans up the device before/after running the tests.
 LOCAL_CTS_TEST_RUNNER := com.android.cts.tradefed.testtype.AccessibilityTestRunner
 
diff --git a/tests/tests/accessibility/src/android/view/accessibility/cts/AccessibilityManagerTest.java b/tests/tests/accessibility/src/android/view/accessibility/cts/AccessibilityManagerTest.java
index 50740e8..9732117 100644
--- a/tests/tests/accessibility/src/android/view/accessibility/cts/AccessibilityManagerTest.java
+++ b/tests/tests/accessibility/src/android/view/accessibility/cts/AccessibilityManagerTest.java
@@ -19,6 +19,7 @@
 import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.Service;
 import android.content.pm.ServiceInfo;
+import android.cts.util.PollingCheck;
 import android.test.AndroidTestCase;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityManager;
@@ -60,7 +61,12 @@
     }
 
     public void testIsTouchExplorationEnabled() throws Exception {
-        assertTrue(mAccessibilityManager.isTouchExplorationEnabled());
+        new PollingCheck() {
+            @Override
+            protected boolean check() {
+                return mAccessibilityManager.isTouchExplorationEnabled();
+            }
+        }.run();
     }
 
     public void testGetInstalledAccessibilityServicesList() throws Exception {