Merge "Fix EmojiTest threading issue." into jb-mr2-dev
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index ed155c0..112c8ad 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -31,7 +31,6 @@
 cts_support_packages := \
 	$(PTS_SUPPORT_PACKAGES) \
 	CtsAccelerationTestStubs \
-	CtsDelegatingAccessibilityService \
 	CtsDeviceAdmin \
 	CtsMonkeyApp \
 	CtsMonkeyApp2 \
diff --git a/tests/accessibility/res/xml/speaking_accessibilityservice.xml b/tests/accessibility/res/xml/speaking_accessibilityservice.xml
index d43d3e7..d8eaf55 100644
--- a/tests/accessibility/res/xml/speaking_accessibilityservice.xml
+++ b/tests/accessibility/res/xml/speaking_accessibilityservice.xml
@@ -17,4 +17,5 @@
     android:accessibilityEventTypes="typeAllMask"
     android:accessibilityFeedbackType="feedbackSpoken"
     android:accessibilityFlags="flagDefault|flagRequestTouchExplorationMode"
-    android:canRetrieveWindowContent="true" />
+    android:canRetrieveWindowContent="true"
+    android:canRequestTouchExplorationMode="true" />
diff --git a/tests/accessibility/res/xml/vibrating_accessibilityservice.xml b/tests/accessibility/res/xml/vibrating_accessibilityservice.xml
index c2f8799..2219ee7 100644
--- a/tests/accessibility/res/xml/vibrating_accessibilityservice.xml
+++ b/tests/accessibility/res/xml/vibrating_accessibilityservice.xml
@@ -17,4 +17,5 @@
     android:accessibilityEventTypes="typeAllMask|"
     android:accessibilityFeedbackType="feedbackHaptic"
     android:accessibilityFlags="flagDefault|flagRequestTouchExplorationMode"
-    android:canRetrieveWindowContent="true" />
+    android:canRetrieveWindowContent="true"
+    android:canRequestTouchExplorationMode="true" />
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
deleted file mode 100644
index f9fec93..0000000
--- a/tests/accessibilityservice/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SRC_FILES += \
-  src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl \
-  src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
-
-LOCAL_PACKAGE_NAME := CtsDelegatingAccessibilityService
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
deleted file mode 100644
index 117578e..0000000
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="android.accessibilityservice.delegate">
-
-  <uses-permission android:name="android.permission.CAN_REQUEST_TOUCH_EXPLORATION_MODE"/>
-
-  <application>
-
-    <uses-library android:name="android.test.runner"/>
-
-    <service android:name=".DelegatingAccessibilityService"
-             android:label="@string/title_delegating_accessibility_service"
-             android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
-      <intent-filter>
-        <action android:name="android.accessibilityservice.AccessibilityService"/>
-      </intent-filter>
-      <meta-data android:name="android.accessibilityservice"
-                android:resource="@xml/accessibilityservice" />
-    </service>
-
-    <service android:name=".DelegatingAccessibilityService$DelegatingConnectionService"
-             android:exported="true"/>
-
-  </application>
-
-</manifest>
diff --git a/tests/accessibilityservice/res/xml/accessibilityservice.xml b/tests/accessibilityservice/res/xml/accessibilityservice.xml
deleted file mode 100644
index 6d48f9b..0000000
--- a/tests/accessibilityservice/res/xml/accessibilityservice.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:accessibilityEventTypes="typeAllMask"
-    android:accessibilityFeedbackType="feedbackGeneric"
-    android:accessibilityFlags="flagDefault|flagRequestTouchExplorationMode"
-    android:canRetrieveWindowContent="true"
-    android:notificationTimeout="0"
-    android:settingsActivity="android.accessibilityservice.delegate.SomeActivity"
-    android:description="@string/title_delegating_accessibility_service" />
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl b/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
deleted file mode 100644
index 868bd72..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.accessibilityservice;
-
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * Interface for interacting with the accessibility service mock.
- */
-oneway interface IAccessibilityServiceDelegate {
-
-    /**
-     * Delegate an {@link android.view.accessibility.AccessibilityEvent}.
-     */
-    void onAccessibilityEvent(in AccessibilityEvent event);
-
-    /**
-     * Delegate an interrupt request.
-     */
-    void onInterrupt();
-}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl b/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
deleted file mode 100644
index 253a082..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.accessibilityservice;
-
-import android.os.Bundle;
-import android.os.IBinder;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import java.util.List;
-
-/**
- * Interface for registering an accessibility service delegate
- * and asking it to perform some querying of the window for us.
- */
-interface IAccessibilityServiceDelegateConnection {
-
-    void setAccessibilityServiceDelegate(in IBinder binder);
-
-    List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(in AccessibilityNodeInfo root,
-        String text);
-
-    AccessibilityNodeInfo getParent(in AccessibilityNodeInfo child);
-
-    AccessibilityNodeInfo getChild(in AccessibilityNodeInfo parent, int index);
-
-    AccessibilityNodeInfo findFocus(in AccessibilityNodeInfo root, int focusType);
-
-    AccessibilityNodeInfo focusSearch(in AccessibilityNodeInfo current, int direction);
-
-    boolean performAccessibilityAction(in AccessibilityNodeInfo target, int action,
-           in Bundle arguments);
-
-    AccessibilityNodeInfo getSource(in AccessibilityEvent event);
-
-    void setFetchViewsNotExposedForAccessibility(boolean fetch);
-
-    boolean performGlobalAction(int action);
-
-    AccessibilityNodeInfo getRootInActiveWindow();
-}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java b/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java
deleted file mode 100644
index 4e9aed1..0000000
--- a/tests/accessibilityservice/src/android/accessibilityservice/delegate/DelegatingAccessibilityService.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.accessibilityservice.delegate;
-
-import android.accessibilityservice.AccessibilityService;
-import android.accessibilityservice.AccessibilityServiceInfo;
-import android.accessibilityservice.IAccessibilityServiceDelegate;
-import android.accessibilityservice.IAccessibilityServiceDelegateConnection;
-import android.app.Service;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import java.util.List;
-
-/**
- * This class is an accessibility service mock to which the system is bound and
- * exposes a mock interface to the CTS accessibility tests.
- * </p>
- * Note: The end-to-end test is composed of two APKs, one with a mock accessibility
- * service, another with the instrumented activity and test cases. The
- * motivation for two APKs design is that CTS tests cannot access the secure
- * settings which is required for enabling accessibility and accessibility
- * services. Therefore, manual installation of this package is required. Once
- * the package has been installed accessibility must be enabled (Settings ->
- * Accessibility), the mock service must be enabled (Settings -> Accessibility
- * -> Mock Accessibility Service), and then the CTS tests in this package
- * <strong>CtsAccessibilityServiceTestCases.apk</strong> located in
- * <strong>cts/tests/tests/accessibility</strong> can be successfully run.
- * Further, the mock and tests run in separate processes since the
- * instrumentation restarts the process in which it is running and this breaks
- * the binding between the mock accessibility service and the system.
- */
-public class DelegatingAccessibilityService extends AccessibilityService {
-
-    /**
-     * Tag used for logging.
-     */
-    private static final String LOG_TAG = "AccessibilityServiceDelegate";
-
-    /**
-     * Handle to the instance used by the accessibility service connection.
-     */
-    static DelegatingAccessibilityService sServiceDelegate;
-
-    /**
-     * Interface for delegating events and interrupt requests.
-     */
-    private IAccessibilityServiceDelegate mDelegateInterface;
-
-    @Override
-    protected void onServiceConnected() {
-        // the service is ready to be used only
-        // after the system has bound to it
-        sServiceDelegate = this;
-    }
-
-    @Override
-    public void onAccessibilityEvent(AccessibilityEvent event) {
-        if (mDelegateInterface == null) {
-            return;
-        }
-
-        try {
-            mDelegateInterface.onAccessibilityEvent(event);
-        } catch (RemoteException re) {
-            Log.i(LOG_TAG, "Dead: " + mDelegateInterface.toString() + " cleaning up.");
-            mDelegateInterface = null;
-        }
-    }
-
-    @Override
-    public void onInterrupt() {
-        if (mDelegateInterface == null) {
-            return;
-        }
-
-        try {
-            mDelegateInterface.onInterrupt();
-        } catch (RemoteException re) {
-            Log.i(LOG_TAG, "Dead: " + mDelegateInterface.toString() + " cleaning up.");
-            mDelegateInterface = null;
-        }
-    }
-
-    /**
-     * Sets the interface to which to delegate.
-     *
-     * @param delegateInterface The delegate interface.
-     */
-    private void setDelegateInterface(IAccessibilityServiceDelegate delegateInterface) {
-        mDelegateInterface = delegateInterface;
-    }
-
-    /**
-     * This is a service to which the end-to-end CTS test connects to pass a
-     * delegate interface to which the {@link DelegatingAccessibilityService}
-     * to delegate.
-     */
-    public static class DelegatingConnectionService extends Service {
-
-        @Override
-        public IBinder onBind(Intent intent) {
-            if (sServiceDelegate == null) {
-                return null;
-            }
-            return new AccessibilityServiceDelegateConnection();
-        }
-
-        /**
-         * This class is the connection wrapper passed to the end-to-end CTS
-         * test, so the latter can pass a delegating interface.
-         */
-        private class AccessibilityServiceDelegateConnection extends
-                IAccessibilityServiceDelegateConnection.Stub {
-
-            @Override
-            public void setAccessibilityServiceDelegate(IBinder binder) {
-                sServiceDelegate.setDelegateInterface(IAccessibilityServiceDelegate.Stub
-                        .asInterface(binder));
-            }
-
-            @Override
-            public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(
-                    AccessibilityNodeInfo root, String text) {
-                return root.findAccessibilityNodeInfosByText(text);
-            }
-
-            @Override
-            public AccessibilityNodeInfo getChild(AccessibilityNodeInfo parent, int index) {
-                return parent.getChild(index);
-            }
-
-            @Override
-            public AccessibilityNodeInfo getParent(AccessibilityNodeInfo child) {
-                return child.getParent();
-            }
-
-            @Override
-            public AccessibilityNodeInfo findFocus(AccessibilityNodeInfo root, int focusType) {
-                return root.findFocus(focusType);
-            }
-
-            @Override
-            public AccessibilityNodeInfo focusSearch(AccessibilityNodeInfo current, int direction) {
-                return current.focusSearch(direction);
-            }
-
-            @Override
-            public AccessibilityNodeInfo getSource(AccessibilityEvent event) {
-                return event.getSource();
-            }
-
-            @Override
-            public boolean performAccessibilityAction(AccessibilityNodeInfo target, int action,
-                    Bundle arguments) {
-                return target.performAction(action, arguments);
-            }
-
-            @Override
-            public void setFetchViewsNotExposedForAccessibility(boolean fetch) {
-                AccessibilityServiceInfo info = sServiceDelegate.getServiceInfo();
-                if (fetch) {
-                    info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
-                } else {
-                    info.flags &= ~AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
-                }
-                sServiceDelegate.setServiceInfo(info);
-            }
-
-            @Override
-            public boolean performGlobalAction(int action) {
-                return sServiceDelegate.performGlobalAction(action);
-            }
-
-            @Override
-            public AccessibilityNodeInfo getRootInActiveWindow() {
-                return sServiceDelegate.getRootInActiveWindow();
-            }
-        }
-    }
-}
diff --git a/tests/res/values-v18/strings.xml b/tests/res/values-v18/strings.xml
index 0b84d5e..d03c5cb 100644
--- a/tests/res/values-v18/strings.xml
+++ b/tests/res/values-v18/strings.xml
@@ -16,5 +16,4 @@
 
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="version_cur">v18cur</string>
-   <string name="version_old">v18old</string>
 </resources>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/res/values-v19/strings.xml
similarity index 72%
copy from tests/accessibilityservice/res/values/strings.xml
copy to tests/res/values-v19/strings.xml
index 3730f85..833ca08 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/res/values-v19/strings.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2008 The Android Open Source Project
 
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
@@ -15,9 +14,6 @@
      limitations under the License.
 -->
 
-<resources>
-
-    <!-- String title of the mock accessibility service -->
-    <string name="title_delegating_accessibility_service">Delegating Accessibility Service</string>
-
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v19cur</string>
 </resources>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/res/values-v20/strings.xml
similarity index 72%
copy from tests/accessibilityservice/res/values/strings.xml
copy to tests/res/values-v20/strings.xml
index 3730f85..f47207a 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/res/values-v20/strings.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2008 The Android Open Source Project
 
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
@@ -15,9 +14,6 @@
      limitations under the License.
 -->
 
-<resources>
-
-    <!-- String title of the mock accessibility service -->
-    <string name="title_delegating_accessibility_service">Delegating Accessibility Service</string>
-
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v20cur</string>
 </resources>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/res/values-v21/strings.xml
similarity index 72%
copy from tests/accessibilityservice/res/values/strings.xml
copy to tests/res/values-v21/strings.xml
index 3730f85..ac8f8a7 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/res/values-v21/strings.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2008 The Android Open Source Project
 
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
@@ -15,9 +14,6 @@
      limitations under the License.
 -->
 
-<resources>
-
-    <!-- String title of the mock accessibility service -->
-    <string name="title_delegating_accessibility_service">Delegating Accessibility Service</string>
-
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v21cur</string>
 </resources>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/res/values-v22/strings.xml
similarity index 72%
rename from tests/accessibilityservice/res/values/strings.xml
rename to tests/res/values-v22/strings.xml
index 3730f85..6b51a01 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/res/values-v22/strings.xml
@@ -1,6 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
+<!-- Copyright (C) 2008 The Android Open Source Project
 
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
@@ -15,9 +14,6 @@
      limitations under the License.
 -->
 
-<resources>
-
-    <!-- String title of the mock accessibility service -->
-    <string name="title_delegating_accessibility_service">Delegating Accessibility Service</string>
-
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+   <string name="version_cur">v22cur</string>
 </resources>
diff --git a/tests/src/android/renderscript/cts/global_sync.rs b/tests/src/android/renderscript/cts/global_sync.rs
index c947fa2..e384143 100644
--- a/tests/src/android/renderscript/cts/global_sync.rs
+++ b/tests/src/android/renderscript/cts/global_sync.rs
@@ -6,18 +6,26 @@
 
 rs_allocation aFailed;
 
-void test_global(int expected) {
+void test_read_global(int expected) {
     if (gInt != expected) {
         rsSetElementAt_uchar(aFailed, 1, 0);
     }
 }
 
-void test_static_global(int expected) {
+void test_read_static_global(int expected) {
     if (sInt != expected) {
         rsSetElementAt_uchar(aFailed, 1, 0);
     }
 }
 
+void test_write_global(int i) {
+    gInt = i;
+}
+
+void test_write_static_global(int i) {
+    sInt = i;
+}
+
 void __attribute__((kernel)) write_global(int ain, uint32_t x) {
     if (x == 0) {
         gInt = ain;
@@ -30,3 +38,16 @@
     }
 }
 
+int __attribute__((kernel)) read_global(int ain, uint32_t x) {
+    if (gInt != ain) {
+        return 1;
+    }
+    return 0;
+}
+
+int __attribute__((kernel)) read_static_global(int ain, uint32_t x) {
+    if (sInt != ain) {
+        return 1;
+    }
+    return 0;
+}
diff --git a/tests/src/android/renderscript/cts/sample.rs b/tests/src/android/renderscript/cts/sample.rs
index 3fecf3c..7a8d5bb 100644
--- a/tests/src/android/renderscript/cts/sample.rs
+++ b/tests/src/android/renderscript/cts/sample.rs
@@ -73,7 +73,7 @@
 
     result = rsSample(alloc1D, gMipLinear, location, lod);
     _RS_ASSERT(compare(expected3, result));
-    return failed;
+    return !failed;
 }
 
 static bool sub_test_RGBA_2D(rs_allocation alloc2D, float2 location, float lod,
@@ -90,17 +90,17 @@
 
     result = rsSample(alloc2D, gMipLinear, location, lod);
     _RS_ASSERT(compare(expected3, result));
-    return failed;
+    return !failed;
 }
 
 void test_RGBA(rs_allocation alloc1D, rs_allocation alloc2D) {
     bool failed = false;
     float4 result;
 
-    float4 fLOD0 = convert_float4(lod0Color);
-    float4 fLOD1 = convert_float4(lod1Color);
-    float4 fLOD2 = convert_float4(lod2Color);
-    float4 fLOD3 = convert_float4(lod3Color);
+    float4 fLOD0 = rsUnpackColor8888(lod0Color);
+    float4 fLOD1 = rsUnpackColor8888(lod1Color);
+    float4 fLOD2 = rsUnpackColor8888(lod2Color);
+    float4 fLOD3 = rsUnpackColor8888(lod3Color);
 
     float4 fLOD04 = fLOD0*0.6f + fLOD1*0.4f;
     float4 fLOD06 = fLOD0*0.4f + fLOD1*0.6f;
diff --git a/tests/tests/accessibilityservice/Android.mk b/tests/tests/accessibilityservice/Android.mk
index 029602a..73cd288 100644
--- a/tests/tests/accessibilityservice/Android.mk
+++ b/tests/tests/accessibilityservice/Android.mk
@@ -22,13 +22,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
 
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
-  src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl \
-  src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_PACKAGE_NAME := CtsAccessibilityServiceTestCases
 
-# This test runner sets up/cleans up the device before/after running the tests.
-LOCAL_CTS_TEST_RUNNER := com.android.cts.tradefed.testtype.AccessibilityServiceTestRunner
-
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl b/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
deleted file mode 100644
index 868bd72..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.accessibilityservice;
-
-import android.view.accessibility.AccessibilityEvent;
-
-/**
- * Interface for interacting with the accessibility service mock.
- */
-oneway interface IAccessibilityServiceDelegate {
-
-    /**
-     * Delegate an {@link android.view.accessibility.AccessibilityEvent}.
-     */
-    void onAccessibilityEvent(in AccessibilityEvent event);
-
-    /**
-     * Delegate an interrupt request.
-     */
-    void onInterrupt();
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl b/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
deleted file mode 100644
index 253a082..0000000
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/IAccessibilityServiceDelegateConnection.aidl
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.accessibilityservice;
-
-import android.os.Bundle;
-import android.os.IBinder;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import java.util.List;
-
-/**
- * Interface for registering an accessibility service delegate
- * and asking it to perform some querying of the window for us.
- */
-interface IAccessibilityServiceDelegateConnection {
-
-    void setAccessibilityServiceDelegate(in IBinder binder);
-
-    List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(in AccessibilityNodeInfo root,
-        String text);
-
-    AccessibilityNodeInfo getParent(in AccessibilityNodeInfo child);
-
-    AccessibilityNodeInfo getChild(in AccessibilityNodeInfo parent, int index);
-
-    AccessibilityNodeInfo findFocus(in AccessibilityNodeInfo root, int focusType);
-
-    AccessibilityNodeInfo focusSearch(in AccessibilityNodeInfo current, int direction);
-
-    boolean performAccessibilityAction(in AccessibilityNodeInfo target, int action,
-           in Bundle arguments);
-
-    AccessibilityNodeInfo getSource(in AccessibilityEvent event);
-
-    void setFetchViewsNotExposedForAccessibility(boolean fetch);
-
-    boolean performGlobalAction(int action);
-
-    AccessibilityNodeInfo getRootInActiveWindow();
-}
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityActivityTestCase.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityActivityTestCase.java
index affc9ec..c7e4f4c 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityActivityTestCase.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityActivityTestCase.java
@@ -17,31 +17,10 @@
 package android.accessibilityservice.cts;
 
 import android.accessibilityservice.AccessibilityServiceInfo;
-import android.accessibilityservice.IAccessibilityServiceDelegate;
-import android.accessibilityservice.IAccessibilityServiceDelegateConnection;
 import android.app.Activity;
-import android.app.Service;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.ServiceInfo;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.SystemClock;
+import android.app.UiAutomation;
 import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
 import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
 
 /**
  * Base text case for testing accessibility APIs by instrumenting an Activity.
@@ -49,14 +28,6 @@
 public abstract class AccessibilityActivityTestCase<T extends Activity>
         extends ActivityInstrumentationTestCase2<T> {
 
-    public interface AccessibilityEventFilter {
-        public boolean accept(AccessibilityEvent event);
-    }
-
-    private static final boolean DEBUG = false;
-
-    private static final String LOG_TAG = AccessibilityActivityTestCase.class.getSimpleName();
-
     /**
      * Timeout required for pending Binder calls or event processing to
      * complete.
@@ -64,19 +35,11 @@
     public static final long TIMEOUT_ASYNC_PROCESSING = 5000;
 
     /**
-     * The timeout after the last accessibility event to consider the device idle.
+     * The timeout since the last accessibility event to consider the device idle.
      */
     public static final long TIMEOUT_ACCESSIBILITY_STATE_IDLE = 200;
 
     /**
-     * Instance for detecting the next accessibility event.
-     */
-    private static final NextAccessibilityEventWatcher sNextEventWatcher =
-            new NextAccessibilityEventWatcher();
-
-    private static AccessibilityInteractionBridge sInteractionBridge;
-
-    /**
      * @param activityClass
      */
     public AccessibilityActivityTestCase(Class<T> activityClass) {
@@ -86,22 +49,17 @@
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        waitForAccessibilityStateIdle();
-        startActivityAndWaitForFirstEvent();
-    }
 
-    /**
-     * Gets the bridge for interacting with the view hierarchy via
-     * the accessibility APIs.
-     *
-     * @return The bridge.
-     */
-    public AccessibilityInteractionBridge getInteractionBridge() {
-        if (sInteractionBridge == null) {
-            sInteractionBridge = new AccessibilityInteractionBridge(
-                    getInstrumentation().getContext());
-        }
-        return sInteractionBridge;
+        AccessibilityServiceInfo info = getInstrumentation().getUiAutomation().getServiceInfo();
+        info.flags |= AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE;
+        info.flags &= ~AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
+        getInstrumentation().getUiAutomation().setServiceInfo(info);
+
+        getInstrumentation().getUiAutomation().waitForIdle(
+                TIMEOUT_ACCESSIBILITY_STATE_IDLE,
+                TIMEOUT_ASYNC_PROCESSING);
+
+        startActivityAndWaitForFirstEvent();
     }
 
     /**
@@ -117,7 +75,7 @@
      */
     private void startActivityAndWaitForFirstEvent() throws Exception {
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -125,11 +83,10 @@
                 getInstrumentation().waitForIdleSync();
             }
         },
-                new AccessibilityEventFilter() {
+                new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 final int eventType = event.getEventType();
-                CharSequence packageName = event.getPackageName();
                 // Do not check the package name since an event of this type may
                 // come concurrently from the app and from the IME (since input
                 // focus goes to the first focusable) but we dispatch one event
@@ -141,430 +98,4 @@
         TIMEOUT_ASYNC_PROCESSING);
         assertNotNull(awaitedEvent);
     }
-
-    /**
-     * Waits for idle accessibility state.
-     */
-    private void waitForAccessibilityStateIdle() throws Exception {
-        AccessibilityEvent awaitedEvent = null;
-        try {
-            do {
-                awaitedEvent = getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
-                        sNextEventWatcher, sNextEventWatcher, TIMEOUT_ACCESSIBILITY_STATE_IDLE);
-            } while (awaitedEvent != null);
-        } catch (TimeoutException te) {
-            /* success - no event within the timeout - do nothing */
-        }
-    }
-
-    /**
-     * Dummy implementation that matches every event and does nothing.
-     */
-    private static class NextAccessibilityEventWatcher implements Runnable,
-            AccessibilityEventFilter {
-        @Override
-        public boolean accept(AccessibilityEvent event) {
-            if (DEBUG) {
-                Log.i(LOG_TAG, "Watcher event: " + event);
-            }
-            return true;
-        }
-        @Override
-        public void run() {
-            /* do nothing */
-        }
-    }
-
-    /**
-     * This class serves as a bridge for querying the screen content.
-     * The bride is connected of a delegating accessibility service.
-     */
-    static class AccessibilityInteractionBridge implements ServiceConnection {
-
-        /**
-         * The package of the accessibility service mock interface.
-         */
-        private static final String DELEGATING_SERVICE_PACKAGE =
-            "android.accessibilityservice.delegate";
-
-        /**
-         * The package of the delegating accessibility service interface.
-         */
-        private static final String DELEGATING_SERVICE_CLASS_NAME =
-            "android.accessibilityservice.delegate.DelegatingAccessibilityService";
-
-        /**
-         * The package of the delegating accessibility service connection interface.
-         */
-        private static final String DELEGATING_SERVICE_CONNECTION_CLASS_NAME =
-            "android.accessibilityservice.delegate."
-                + "DelegatingAccessibilityService$DelegatingConnectionService";
-
-        /**
-         * Lock for synchronization.
-         */
-        private final Object mLock = new Object();
-
-        /**
-         * Whether this delegate is initialized.
-         */
-        private boolean mInitialized;
-
-        /**
-         * Query connection to the delegating accessibility service.
-         */
-        private IAccessibilityServiceDelegateConnection mQueryConnection;
-
-        /**
-         * Flag whether we are waiting for a specific event.
-         */
-        private boolean mWaitingForEventDelivery;
-
-        /**
-         * Queue with received events.
-         */
-        private final ArrayList<AccessibilityEvent> mEventQueue =
-            new ArrayList<AccessibilityEvent>(10);
-
-        public AccessibilityInteractionBridge(Context context) {
-            bindToDelegatingAccessibilityService(context);
-        }
-
-        public void onAccessibilityEvent(AccessibilityEvent event) {
-            synchronized (mLock) {
-                mLock.notifyAll();
-                if (mWaitingForEventDelivery) {
-                    mEventQueue.add(AccessibilityEvent.obtain(event));
-                }
-            }
-        }
-
-        /**
-         * Ensures the required setup for the test performed and that it is bound to the
-         * DelegatingAccessibilityService which runs in another process. The setup is
-         * enabling accessibility and installing and enabling the delegating accessibility
-         * service this test binds to.
-         * </p>
-         * Note: Please look at the class description for information why such an
-         *       approach is taken.
-         */
-        public void bindToDelegatingAccessibilityService(Context context) {
-            // check if accessibility is enabled
-            AccessibilityManager accessibilityManager = (AccessibilityManager) context
-                    .getSystemService(Service.ACCESSIBILITY_SERVICE);
-
-            if (!accessibilityManager.isEnabled()) {
-                throw new IllegalStateException("Delegating service not enabled.");
-            }
-
-            // check if the delegating service is running
-            List<AccessibilityServiceInfo> enabledServices =
-                accessibilityManager.getEnabledAccessibilityServiceList(
-                        AccessibilityServiceInfo.FEEDBACK_ALL_MASK);
-            boolean delegatingServiceRunning = false;
-            for (AccessibilityServiceInfo enabledService : enabledServices) {
-                ServiceInfo serviceInfo = enabledService.getResolveInfo().serviceInfo;
-                if (DELEGATING_SERVICE_PACKAGE.equals(serviceInfo.packageName)
-                        && DELEGATING_SERVICE_CLASS_NAME.equals(serviceInfo.name)) {
-                    delegatingServiceRunning = true;
-                    break;
-                }
-            }
-
-            if (!delegatingServiceRunning) {
-                // delegating service not running, so check if it is installed at all
-                try {
-                    PackageManager packageManager = context.getPackageManager();
-                    packageManager.getServiceInfo(new ComponentName(DELEGATING_SERVICE_PACKAGE,
-                            DELEGATING_SERVICE_CLASS_NAME), 0);
-                } catch (NameNotFoundException nnfe) {
-                    throw new IllegalStateException("CtsDelegatingAccessibilityService.apk" +
-                            " not installed.");
-                }
-
-                throw new IllegalStateException("Delegating Accessibility Service not running.");
-            }
-
-            Intent intent = new Intent().setClassName(DELEGATING_SERVICE_PACKAGE,
-                    DELEGATING_SERVICE_CONNECTION_CLASS_NAME);
-            context.bindService(intent, this, Context.BIND_AUTO_CREATE);
-
-            final long beginTime = SystemClock.uptimeMillis();
-            synchronized (mLock) {
-                while (true) {
-                    if (mInitialized) {
-                        return;
-                    }
-                    final long elapsedTime = (SystemClock.uptimeMillis() - beginTime);
-                    final long remainingTime = TIMEOUT_ASYNC_PROCESSING - elapsedTime;
-                    if (remainingTime <= 0) {
-                        if (!mInitialized) {
-                            throw new IllegalStateException("Cound not connect to the delegating"
-                                    + " accessibility service");
-                        }
-                        return;
-                    }
-                    try {
-                        mLock.wait(remainingTime);
-                    } catch (InterruptedException ie) {
-                        /* ignore */
-                    }
-                }
-            }
-        }
-
-        /**
-         * {@inheritDoc ServiceConnection#onServiceConnected(ComponentName,IBinder)}
-         */
-        public void onServiceConnected(ComponentName name, IBinder service) {
-            mQueryConnection = IAccessibilityServiceDelegateConnection.Stub.asInterface(service);
-            try {
-                mQueryConnection.setAccessibilityServiceDelegate(
-                        new IAccessibilityServiceDelegate.Stub() {
-                    @Override
-                    public void onAccessibilityEvent(AccessibilityEvent event) {
-                        AccessibilityInteractionBridge.this.onAccessibilityEvent(event);
-                    }
-                    @Override
-                    public void onInterrupt() {
-                        /* do nothing */
-                    }
-                });
-                synchronized (mLock) {
-                    mInitialized = true;
-                    mLock.notifyAll();
-                }
-            } catch (RemoteException re) {
-                fail("Could not set delegate to the delegating service.");
-            }
-        }
-
-        /**
-         * {@inheritDoc ServiceConnection#onServiceDisconnected(ComponentName)}
-         */
-        public void onServiceDisconnected(ComponentName name) {
-            synchronized (mLock) {
-                mInitialized = false;
-            }
-        }
-
-        /**
-         * Gets the query connection to the delegating accessibility service.
-         *
-         * @return The connection.
-         */
-        public IAccessibilityServiceDelegateConnection getQueryConnection() {
-            return mQueryConnection;
-        }
-
-        /**
-         * Finds the first accessibility info that contains text. The search starts
-         * from the given <code>root</code>
-         *
-         * @param text The searched text.
-         * @return The node with this text or null.
-         */
-        public AccessibilityNodeInfo findAccessibilityNodeInfoByTextFromRoot(String text) {
-            List<AccessibilityNodeInfo> nodes = findAccessibilityNodeInfosByText(text);
-            if (nodes != null && !nodes.isEmpty()) {
-                return nodes.get(0);
-            }
-            return null;
-        }
-
-        public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String text) {
-            AccessibilityNodeInfo root = getRootInActiveWindow();
-            if (root != null) {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo rootClone = AccessibilityNodeInfo.obtain(root);
-                try {
-                     return getQueryConnection().findAccessibilityNodeInfosByText(rootClone, text);
-                } catch (RemoteException re) {
-                    /* ignore */
-                }
-            }
-            return Collections.emptyList();
-        }
-
-        public AccessibilityNodeInfo getParent(AccessibilityNodeInfo child) {
-            try {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo childClone = AccessibilityNodeInfo.obtain(child);
-                return getQueryConnection().getParent(childClone);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public AccessibilityNodeInfo getChild(AccessibilityNodeInfo parent, int index) {
-            try {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo parentClone = AccessibilityNodeInfo.obtain(parent);
-                return getQueryConnection().getChild(parentClone, index);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public boolean performAction(AccessibilityNodeInfo target, int action) {
-            return performAction(target, action, null);
-        }
-
-        public boolean performAction(AccessibilityNodeInfo target, int action, Bundle arguments) {
-            try {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo targetClone = AccessibilityNodeInfo.obtain(target);
-                return getQueryConnection().performAccessibilityAction(targetClone, action,
-                        arguments);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return false;
-        }
-
-        public boolean performGlobalAction(int action) {
-            try {
-                return getQueryConnection().performGlobalAction(action);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return false;
-        }
-
-        public AccessibilityNodeInfo getSource(AccessibilityEvent event) {
-            try {
-                return getQueryConnection().getSource(event);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public AccessibilityNodeInfo findAccessibilityFocus(AccessibilityNodeInfo root) {
-            try {
-                return getQueryConnection().findFocus(root,
-                        AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public AccessibilityNodeInfo findInputFocus(AccessibilityNodeInfo root) {
-            try {
-                return getQueryConnection().findFocus(root, AccessibilityNodeInfo.FOCUS_INPUT);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public AccessibilityNodeInfo accessibilityFocusSearch(AccessibilityNodeInfo current,
-                int direction) {
-            try {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo currentClone = AccessibilityNodeInfo.obtain(current);
-                return getQueryConnection().focusSearch(currentClone, direction);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public AccessibilityNodeInfo inputFocusSearch(AccessibilityNodeInfo current,
-                int direction) {
-            try {
-                // Sending a node info across processes recycles
-                // it so use a clone to avoid losing state
-                AccessibilityNodeInfo currentClone = AccessibilityNodeInfo.obtain(current);
-                return getQueryConnection().focusSearch(currentClone, direction);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        public void setRegardViewsNotImportantForAccessibility(boolean fetch) {
-            try {
-                getQueryConnection().setFetchViewsNotExposedForAccessibility(fetch);
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-        }
-
-        public AccessibilityNodeInfo getRootInActiveWindow() {
-            try {
-                return getQueryConnection().getRootInActiveWindow();
-            } catch (RemoteException re) {
-                /* ignore */
-            }
-            return null;
-        }
-
-        /**
-         * Executes a command and waits for a specific accessibility event type up
-         * to a given timeout.
-         *
-         * @param command The command to execute before starting to wait for the event.
-         * @param filter Filter that recognizes the expected event.
-         * @param timeoutMillis The max wait time in milliseconds.
-         */
-        public AccessibilityEvent executeCommandAndWaitForAccessibilityEvent(Runnable command,
-                AccessibilityEventFilter filter, long timeoutMillis)
-                throws TimeoutException, Exception {
-            synchronized (mLock) {
-                mEventQueue.clear();
-                // Prepare to wait for an event.
-                mWaitingForEventDelivery = true;
-                // We will ignore events from previous interactions.
-                final long executionStartTimeMillis = SystemClock.uptimeMillis();
-                // Execute the command.
-                command.run();
-                try {
-                    // Wait for the event.
-                    final long startTimeMillis = SystemClock.uptimeMillis();
-                    while (true) {
-                        // Drain the event queue
-                        while (!mEventQueue.isEmpty()) {
-                            AccessibilityEvent event = mEventQueue.remove(0);
-
-                            // Ignore events from previous interactions.
-                            if (event.getEventTime() < executionStartTimeMillis) {
-                                continue;
-                            }
-                            if (filter.accept(event)) {
-                                return event;
-                            }
-                            
-                            event.recycle();
-                        }
-                        // Check if timed out and if not wait.
-                        final long elapsedTimeMillis = SystemClock.uptimeMillis() - startTimeMillis;
-                        final long remainingTimeMillis = timeoutMillis - elapsedTimeMillis;
-                        if (remainingTimeMillis <= 0) {
-                            throw new TimeoutException("Expected event not received within: "
-                                    + timeoutMillis + " ms.");
-                        }
-                        mLock.notifyAll();
-                        try {
-                            mLock.wait(remainingTimeMillis);
-                        } catch (InterruptedException ie) {
-                            /* ignore */
-                        }
-                    }
-                } finally {
-                    mWaitingForEventDelivery = false;
-                    mEventQueue.clear();
-                    mLock.notifyAll();
-                }
-            }
-        }
-    }
 }
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
index eedc25f..7e05e32 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
@@ -22,6 +22,7 @@
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
+import android.app.UiAutomation;
 import android.content.Intent;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.text.TextUtils;
@@ -39,17 +40,6 @@
  * This class performs end-to-end testing of the accessibility feature by
  * creating an {@link Activity} and poking around so {@link AccessibilityEvent}s
  * are generated and their correct dispatch verified.
- * <p>
- * Note: The accessibility CTS tests are composed of two APKs, one with delegating
- * accessibility service and another with the instrumented activity and test cases.
- * The delegating service is installed and enabled during test execution. It serves
- * as a proxy to the system used by the tests. This indirection is needed since the
- * test runner stops the package before running the tests. Hence, if the accessibility
- * service is in the test package running the tests would break the binding between
- * the service and the system.  The delegating service is in
- * <strong>CtsDelegatingAccessibilityService.apk</strong> whose source is located at
- * <strong>cts/tests/accessibilityservice</strong>.
- * </p>
  */
 public class AccessibilityEndToEndTest extends
         AccessibilityActivityTestCase<AccessibilityEndToEndActivity> {
@@ -81,7 +71,7 @@
         final ListView listView = (ListView) getActivity().findViewById(R.id.listview);
 
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -93,7 +83,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -117,7 +107,7 @@
         final Button button = (Button) getActivity().findViewById(R.id.button);
 
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -129,7 +119,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -153,7 +143,7 @@
         final Button button = (Button) getActivity().findViewById(R.id.button);
 
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -165,7 +155,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -191,7 +181,7 @@
         final Button button = (Button) getActivity().findViewById(R.id.button);
 
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -203,7 +193,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -220,7 +210,7 @@
         final EditText editText = (EditText) getActivity().findViewById(R.id.edittext);
 
         AccessibilityEvent awaitedFocusEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -232,7 +222,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -259,7 +249,7 @@
         expected.setEnabled(true);
 
         AccessibilityEvent awaitedTextChangeEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -271,7 +261,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -293,10 +283,8 @@
         expected.getText().add(getActivity().getString(R.string.alert_message));
         expected.setEnabled(true);
 
-        final EditText editText = (EditText) getActivity().findViewById(R.id.edittext);
-
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -309,7 +297,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -343,7 +331,7 @@
         expected.setParcelableData(notification);
 
         AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+            getInstrumentation().getUiAutomation().executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
@@ -359,7 +347,7 @@
                     }
                 });
             }},
-            new AccessibilityEventFilter() {
+            new UiAutomation.AccessibilityEventFilter() {
                 // check the received event
                 @Override
                 public boolean accept(AccessibilityEvent event) {
@@ -403,7 +391,6 @@
      */
     private boolean equalsNotificationAsParcelableData(AccessibilityEvent first,
             AccessibilityEvent second) {
-        String message = "parcelableData has incorrect value";
         Notification firstNotification = (Notification) first.getParcelableData();
         Notification secondNotification = (Notification) second.getParcelableData();
         if (firstNotification == null) {
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFocusAndInputFocusSyncTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFocusAndInputFocusSyncTest.java
index 7ae62b3..93b026c 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFocusAndInputFocusSyncTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFocusAndInputFocusSyncTest.java
@@ -17,8 +17,9 @@
 import static android.view.accessibility.AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS;
 import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS;
 
-import android.os.SystemClock;
+import android.app.UiAutomation;
 import android.test.suitebuilder.annotation.MediumTest;
+import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityNodeInfo;
 
 import com.android.cts.accessibilityservice.R;
@@ -31,17 +32,6 @@
  * services. These APIs allow moving accessibility focus in the view tree from
  * an AccessiiblityService. Specifically, this activity is for verifying the the
  * sync between accessibility and input focus.
- * <p>
- * Note: The accessibility CTS tests are composed of two APKs, one with delegating
- * accessibility service and another with the instrumented activity and test cases.
- * The delegating service is installed and enabled during test execution. It serves
- * as a proxy to the system used by the tests. This indirection is needed since the
- * test runner stops the package before running the tests. Hence, if the accessibility
- * service is in the test package running the tests would break the binding between
- * the service and the system.  The delegating service is in
- * <strong>CtsDelegatingAccessibilityService.apk</strong> whose source is located at
- * <strong>cts/tests/accessibilityservice</strong>.
- * </p>
  */
 public class AccessibilityFocusAndInputFocusSyncTest
         extends AccessibilityActivityTestCase<AccessibilityFocusAndInputFocusSyncActivity>{
@@ -53,18 +43,29 @@
     @MediumTest
     public void testFindAccessibilityFocus() throws Exception {
         // Get the view that has input and accessibility focus.
-        AccessibilityNodeInfo expected = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstEditText));
+        final AccessibilityNodeInfo expected = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.firstEditText)).get(0);
         assertNotNull(expected);
         assertFalse(expected.isAccessibilityFocused());
         assertTrue(expected.isFocused());
 
-        // Perform a focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(expected, ACTION_ACCESSIBILITY_FOCUS));
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a focus action and check for success.
+                assertTrue(expected.performAction(ACTION_ACCESSIBILITY_FOCUS));
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
         // Get the second expected node info.
-        AccessibilityNodeInfo received = getInteractionBridge().findAccessibilityFocus(
-                getInteractionBridge().getRootInActiveWindow());
+        AccessibilityNodeInfo received = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
         assertNotNull(received);
         assertTrue(received.isAccessibilityFocused());
 
@@ -75,27 +76,35 @@
     @MediumTest
     public void testInitialStateNoAccessibilityFocus() throws Exception {
         // Get the root which is only accessibility focused.
-        AccessibilityNodeInfo focused = getInteractionBridge().findAccessibilityFocus(
-                getInteractionBridge().getRootInActiveWindow());
+        AccessibilityNodeInfo focused = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findFocus(AccessibilityNodeInfo.FOCUS_ACCESSIBILITY);
         assertNull(focused);
     }
 
     @MediumTest
     public void testActionAccessibilityFocus() throws Exception {
         // Get the root linear layout info.
-        AccessibilityNodeInfo rootLinearLayout = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
+        final AccessibilityNodeInfo rootLinearLayout = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.rootLinearLayout)).get(0);
         assertNotNull(rootLinearLayout);
         assertFalse(rootLinearLayout.isAccessibilityFocused());
 
-        // Perform a focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(rootLinearLayout,
-                ACTION_ACCESSIBILITY_FOCUS));
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a focus action and check for success.
+                assertTrue(rootLinearLayout.performAction(ACTION_ACCESSIBILITY_FOCUS));
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
         // Get the node info again.
-        rootLinearLayout = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
-        assertNotNull(rootLinearLayout);
+        rootLinearLayout.refresh();
 
         // Check if the node info is focused.
         assertTrue(rootLinearLayout.isAccessibilityFocused());
@@ -104,29 +113,46 @@
     @MediumTest
     public void testActionClearAccessibilityFocus() throws Exception {
         // Get the root linear layout info.
-        AccessibilityNodeInfo rootLinearLayout = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
+        final AccessibilityNodeInfo rootLinearLayout = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.rootLinearLayout)).get(0);
         assertNotNull(rootLinearLayout);
 
-        // Perform a focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(rootLinearLayout,
-                ACTION_ACCESSIBILITY_FOCUS));
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a focus action and check for success.
+                assertTrue(rootLinearLayout.performAction(ACTION_ACCESSIBILITY_FOCUS));
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
-        // Get the node info again.
-        rootLinearLayout = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
-        assertNotNull(rootLinearLayout);
+        // Refresh the node info.
+        rootLinearLayout.refresh();
 
         // Check if the node info is focused.
         assertTrue(rootLinearLayout.isAccessibilityFocused());
 
-        // Perform a clear focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(rootLinearLayout,
-                ACTION_CLEAR_ACCESSIBILITY_FOCUS));
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a clear focus action and check for success.
+                assertTrue(rootLinearLayout.performAction(ACTION_CLEAR_ACCESSIBILITY_FOCUS));
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType()
+                        == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
-        // Get the node info again.
-        rootLinearLayout = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
+        // Refresh the node info.
+        rootLinearLayout.refresh();
 
         // Check if the node info is not focused.
         assertFalse(rootLinearLayout.isAccessibilityFocused());
@@ -135,41 +161,55 @@
     @MediumTest
     public void testOnlyOneNodeHasAccessibilityFocus() throws Exception {
         // Get the first not focused edit text.
-        AccessibilityNodeInfo firstEditText = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstEditText));
+        final AccessibilityNodeInfo firstEditText = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.firstEditText)).get(0);
         assertNotNull(firstEditText);
         assertTrue(firstEditText.isFocusable());
         assertTrue(firstEditText.isFocused());
         assertFalse(firstEditText.isAccessibilityFocused());
 
-        // Perform a set focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(firstEditText,
-                ACTION_ACCESSIBILITY_FOCUS));
-
-        // Wait for generated events to propagate and clear the cache.
-        SystemClock.sleep(TIMEOUT_ASYNC_PROCESSING);
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a set focus action and check for success.
+                assertTrue(firstEditText.performAction(ACTION_ACCESSIBILITY_FOCUS));
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
         // Get the second not focused edit text.
-        AccessibilityNodeInfo secondEditText = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondEditText));
+        final AccessibilityNodeInfo secondEditText = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.secondEditText)).get(0);
         assertNotNull(secondEditText);
         assertTrue(secondEditText.isFocusable());
         assertFalse(secondEditText.isFocused());
         assertFalse(secondEditText.isAccessibilityFocused());
 
-        // Perform a set focus action and check for success.
-        assertTrue(getInteractionBridge().performAction(secondEditText,
-                ACTION_ACCESSIBILITY_FOCUS));
-
-        // Wait for generated events to propagate and clear the cache.
-        SystemClock.sleep(TIMEOUT_ASYNC_PROCESSING);
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
+            @Override
+            public void run() {
+                // Perform a set focus action and check for success.
+                assertTrue(secondEditText.performAction(ACTION_ACCESSIBILITY_FOCUS));
+                
+            }
+        }, new UiAutomation.AccessibilityEventFilter() {
+            @Override
+            public boolean accept(AccessibilityEvent event) {
+                return event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
+            }
+        }, TIMEOUT_ASYNC_PROCESSING);
 
         // Get the node info again.
-        secondEditText = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondEditText));
+        secondEditText.refresh();
 
         // Make sure no other node has accessibility focus.
-        AccessibilityNodeInfo root = getInteractionBridge().getRootInActiveWindow();
+        AccessibilityNodeInfo root = getInstrumentation().getUiAutomation().getRootInActiveWindow();
         Queue<AccessibilityNodeInfo> workQueue = new LinkedList<AccessibilityNodeInfo>();
         workQueue.add(root);
         while (!workQueue.isEmpty()) {
@@ -179,8 +219,10 @@
             }
             final int childCount = current.getChildCount();
             for (int i = 0; i < childCount; i++) {
-                AccessibilityNodeInfo child = getInteractionBridge().getChild(current, i);
-                workQueue.offer(child);
+                AccessibilityNodeInfo child = current.getChild(i);
+                if (child != null) {
+                    workQueue.offer(child);
+                }
             }
         }
     }
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java
index ad2dca4..4047f0e 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityServiceInfoTest.java
@@ -92,6 +92,17 @@
     public void testFlagToString() {
         assertEquals("DEFAULT", AccessibilityServiceInfo.flagToString(
                 AccessibilityServiceInfo.DEFAULT));
+        assertEquals("FLAG_INCLUDE_NOT_IMPORTANT_VIEWS", AccessibilityServiceInfo.flagToString(
+                AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS));
+        assertEquals("FLAG_REPORT_VIEW_IDS", AccessibilityServiceInfo.flagToString(
+                AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS));
+        assertEquals("FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY", AccessibilityServiceInfo
+                .flagToString(AccessibilityServiceInfo.FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY));
+        assertEquals("FLAG_REQUEST_FILTER_KEY_EVENTS", AccessibilityServiceInfo.flagToString(
+                AccessibilityServiceInfo.FLAG_REQUEST_FILTER_KEY_EVENTS));
+        assertEquals("FLAG_REQUEST_TOUCH_EXPLORATION_MODE", AccessibilityServiceInfo.flagToString(
+                AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE));
+        
     }
 
     /**
@@ -110,22 +121,21 @@
         AccessibilityServiceInfo speakingService = enabledServices.get(0);
         assertSame(AccessibilityEvent.TYPES_ALL_MASK, speakingService.eventTypes);
         assertSame(AccessibilityServiceInfo.FEEDBACK_GENERIC, speakingService.feedbackType);
-        assertSame(AccessibilityServiceInfo.DEFAULT
-                | AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE,
+        assertSame(AccessibilityServiceInfo.FLAG_REQUEST_TOUCH_EXPLORATION_MODE
+                | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS,
                 speakingService.flags);
         assertSame(0l, speakingService.notificationTimeout);
-        assertEquals("Delegating Accessibility Service", speakingService.getDescription());
+        assertNull(speakingService.getDescription());
         assertNull(speakingService.packageNames /*all packages*/);
         assertNotNull(speakingService.getId());
-        assertTrue(speakingService.getCanRetrieveWindowContent());
-        assertEquals("android.accessibilityservice.delegate.SomeActivity",
-                speakingService.getSettingsActivityName());
-        assertEquals("Delegating Accessibility Service",
-                speakingService.loadDescription(getContext().getPackageManager()));
-        assertEquals("android.accessibilityservice.delegate",
-                speakingService.getResolveInfo().serviceInfo.packageName);
-        assertEquals("android.accessibilityservice.delegate.DelegatingAccessibilityService",
-                speakingService.getResolveInfo().serviceInfo.name);
+        assertSame(speakingService.getCapabilities(),
+                AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
+                | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS
+                | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
+                | AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT);
+        assertNull(speakingService.getSettingsActivityName());
+        assertNull(speakingService.loadDescription(getContext().getPackageManager()));
+        assertNull(speakingService.getResolveInfo());
     }
 
     /**
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
index c8f8a48..4af69fd 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
@@ -14,6 +14,7 @@
 
 package android.accessibilityservice.cts;
 
+import android.app.UiAutomation;
 import android.os.Bundle;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.text.Selection;
@@ -29,17 +30,6 @@
 /**
  * Test cases for testing the accessibility APIs for traversing the text content of
  * a View at several granularities.
- * <p>
- * Note: The accessibility CTS tests are composed of two APKs, one with delegating
- * accessibility service and another with the instrumented activity and test cases.
- * The delegating service is installed and enabled during test execution. It serves
- * as a proxy to the system used by the tests. This indirection is needed since the
- * test runner stops the package before running the tests. Hence, if the accessibility
- * service is in the test package running the tests would break the binding between
- * the service and the system.  The delegating service is in
- * <strong>CtsDelegatingAccessibilityService.apk</strong> whose source is located at
- * <strong>cts/tests/accessibilityservice</strong>.
- * </p>
  */
 public class AccessibilityTextTraversalTest
         extends AccessibilityActivityTestCase<AccessibilityTextTraversalActivity>{
@@ -60,8 +50,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.a_b));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.a_b)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -73,14 +64,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -103,14 +94,14 @@
         assertNotNull(firstExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -133,14 +124,14 @@
         assertNotNull(secondExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -163,18 +154,18 @@
         assertNotNull(thirdExpected);
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
-                AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
+        assertFalse(text.performAction(AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY,
+                arguments));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -197,14 +188,14 @@
         assertNotNull(fourthExpected);
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -227,14 +218,14 @@
         assertNotNull(fifthExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
-                        AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
+                text.performAction(AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY,
+                        arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -257,7 +248,7 @@
         assertNotNull(sixthExpected);
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
     }
 
@@ -273,8 +264,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.foo_bar_baz)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -286,14 +278,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -316,14 +308,14 @@
         assertNotNull(firstExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -346,14 +338,14 @@
         assertNotNull(secondExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -376,18 +368,18 @@
         assertNotNull(thirdExpected);
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -410,14 +402,14 @@
         assertNotNull(fourthExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -440,14 +432,14 @@
         assertNotNull(fifthExpected);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -470,7 +462,7 @@
         assertNotNull(sixthExpected);
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
     }
 
@@ -486,8 +478,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.a_b));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                       getString(R.string.a_b)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -501,14 +494,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -535,14 +528,14 @@
         assertEquals(1, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -569,14 +562,14 @@
         assertEquals(2, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -603,7 +596,7 @@
         assertEquals(3, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -611,14 +604,14 @@
         assertEquals(3, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -645,14 +638,14 @@
         assertEquals(2, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -679,14 +672,14 @@
         assertEquals(1, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent seventhExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent seventhExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -713,7 +706,7 @@
         assertEquals(0, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -734,8 +727,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.a_b));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                       getString(R.string.a_b)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -750,14 +744,14 @@
         arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -784,14 +778,14 @@
         assertEquals(1, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -818,14 +812,14 @@
         assertEquals(2, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -852,7 +846,7 @@
         assertEquals(3, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -872,7 +866,7 @@
         Bundle setSelectionArgs = new Bundle();
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 3);
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 3);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArgs));
 
         // Verify the selection position.
@@ -889,14 +883,14 @@
         });
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -923,14 +917,14 @@
         assertEquals(3, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -957,14 +951,14 @@
         assertEquals(3, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous character and wait for an event.
-        AccessibilityEvent seventhExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent seventhExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -991,7 +985,7 @@
         assertEquals(3, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1010,8 +1004,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.foo_bar_baz)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -1025,14 +1020,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD);
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1059,14 +1054,14 @@
         assertEquals(3, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1093,14 +1088,14 @@
         assertEquals(7, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1127,7 +1122,7 @@
         assertEquals(11, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1135,14 +1130,14 @@
         assertEquals(11, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1169,14 +1164,14 @@
         assertEquals(8, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1203,14 +1198,14 @@
         assertEquals(4, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1237,7 +1232,7 @@
         assertEquals(0, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1259,8 +1254,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.foo_bar_baz)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -1274,14 +1270,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD);
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1309,14 +1305,14 @@
         assertEquals(3, editText.getSelectionEnd());
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1344,14 +1340,14 @@
         assertEquals(7, editText.getSelectionEnd());
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1379,7 +1375,7 @@
         assertEquals(11, editText.getSelectionEnd());
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1387,14 +1383,14 @@
         assertEquals(11, editText.getSelectionEnd());
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1422,14 +1418,14 @@
         assertEquals(8, editText.getSelectionEnd());
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1457,14 +1453,14 @@
         assertEquals(4, editText.getSelectionEnd());
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1492,7 +1488,7 @@
         assertEquals(0, editText.getSelectionEnd());
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1512,8 +1508,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.foo_bar_baz)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -1528,14 +1525,14 @@
         arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1562,14 +1559,14 @@
         assertEquals(3, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1596,14 +1593,14 @@
         assertEquals(7, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1630,7 +1627,7 @@
         assertEquals(11, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Focus the view so we can change selection.
@@ -1646,7 +1643,7 @@
         Bundle setSelectionArgs = new Bundle();
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 11);
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 11);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArgs));
 
         // Verify the selection position.
@@ -1663,14 +1660,14 @@
         });
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1697,14 +1694,14 @@
         assertEquals(11, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next word and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1731,14 +1728,14 @@
         assertEquals(11, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next character and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1765,7 +1762,7 @@
         assertEquals(11, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1784,8 +1781,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki_short));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki_short)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -1799,14 +1797,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE);
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1834,14 +1832,14 @@
         assertEquals(25, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1869,14 +1867,14 @@
         assertEquals(53, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1904,7 +1902,7 @@
         assertEquals(60, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -1912,14 +1910,14 @@
         assertEquals(60, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1947,14 +1945,14 @@
         assertEquals(53, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -1982,14 +1980,14 @@
         assertEquals(25, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2017,7 +2015,7 @@
         assertEquals(0, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2037,8 +2035,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki_short));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki_short)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -2053,14 +2052,14 @@
         arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2088,14 +2087,14 @@
         assertEquals(19, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2123,14 +2122,14 @@
         assertEquals(35, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next line and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2170,7 +2169,7 @@
         Bundle setSelectionArgs = new Bundle();
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 53);
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 53);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArgs));
 
         // Verify the selection position.
@@ -2187,14 +2186,14 @@
         });
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2222,14 +2221,14 @@
         assertEquals(53, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2257,14 +2256,14 @@
         assertEquals(53, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous line and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2292,7 +2291,7 @@
         assertEquals(53, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2312,8 +2311,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -2327,14 +2327,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2362,14 +2362,14 @@
         assertEquals(139, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2397,14 +2397,14 @@
         assertEquals(285, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2432,7 +2432,7 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2440,14 +2440,14 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2475,14 +2475,14 @@
         assertEquals(285, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2510,14 +2510,14 @@
         assertEquals(139, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2545,7 +2545,7 @@
         assertEquals(0, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2565,8 +2565,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -2581,14 +2582,14 @@
         arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2616,14 +2617,14 @@
         assertEquals(139, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2651,14 +2652,14 @@
         assertEquals(285, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next page and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2686,7 +2687,7 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Focus the view so we can change selection.
@@ -2702,7 +2703,7 @@
         Bundle setSelectionArgs = new Bundle();
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 436);
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 436);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArgs));
 
         // Verify the selection position.
@@ -2719,14 +2720,14 @@
         });
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2754,14 +2755,14 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2789,14 +2790,14 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous page and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2824,7 +2825,7 @@
         assertEquals(436, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2843,8 +2844,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki_short));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki_short)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -2858,14 +2860,14 @@
                 AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH);
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2893,14 +2895,14 @@
         assertEquals(104, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2928,14 +2930,14 @@
         assertEquals(267, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -2963,7 +2965,7 @@
         assertEquals(582, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -2971,14 +2973,14 @@
         assertEquals(582, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3006,14 +3008,14 @@
         assertEquals(268, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3041,14 +3043,14 @@
         assertEquals(106, Selection.getSelectionEnd(textView.getText()));
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3076,7 +3078,7 @@
         assertEquals(2, Selection.getSelectionEnd(textView.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -3096,8 +3098,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.android_wiki_short));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                       R.string.android_wiki_short)).get(0);
 
         final int granularities = text.getMovementGranularities();
         assertEquals(granularities, AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
@@ -3112,14 +3115,14 @@
         arguments.putBoolean(AccessibilityNodeInfo.ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN, true);
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent firstExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent firstExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3147,14 +3150,14 @@
         assertEquals(104, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent secondExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent secondExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3182,14 +3185,14 @@
         assertEquals(267, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the next paragraph and wait for an event.
-        AccessibilityEvent thirdExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent thirdExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3217,7 +3220,7 @@
         assertEquals(582, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no next.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_NEXT_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -3237,7 +3240,7 @@
         Bundle setSelectionArgs = new Bundle();
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 582);
         setSelectionArgs.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 582);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, setSelectionArgs));
 
         // Verify the selection position.
@@ -3254,14 +3257,14 @@
         });
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent fourthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fourthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3289,14 +3292,14 @@
         assertEquals(582, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent fifthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent fifthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3324,14 +3327,14 @@
         assertEquals(582, Selection.getSelectionEnd(editText.getText()));
 
         // Move to the previous paragraph and wait for an event.
-        AccessibilityEvent sixthExpected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent sixthExpected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(text,
+                text.performAction(
                         AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return
@@ -3359,7 +3362,7 @@
         assertEquals(582, Selection.getSelectionEnd(editText.getText()));
 
         // Make sure there is no previous.
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY, arguments));
 
         // Verify the selection position.
@@ -3382,19 +3385,20 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                       getString(R.string.foo_bar_baz)).get(0);
 
         // Select all text.
         Bundle arguments = new Bundle();
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 0);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT,
                 editText.getText().length());
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
 
         // Copy the selected text.
-        getInteractionBridge().performAction(text, AccessibilityNodeInfo.ACTION_COPY);
+        text.performAction( AccessibilityNodeInfo.ACTION_COPY);
 
         // Set selection at the end.
         final int textLength = editText.getText().length();
@@ -3403,7 +3407,7 @@
         assertEquals(textLength, Selection.getSelectionEnd(editText.getText()));
 
         // Paste the selected text.
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_PASTE));
 
         // Verify the content.
@@ -3413,11 +3417,11 @@
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 0);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT,
                 editText.getText().length());
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
 
         // Cut the selected text.
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_CUT));
 
         // Verify the content.
@@ -3434,20 +3438,21 @@
             }
         });
 
-        AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                       getString(R.string.foo_bar_baz)).get(0);
 
         // Set the cursor position.
         Bundle arguments = new Bundle();
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 4);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 4);
-        assertTrue(getInteractionBridge().performAction(text,
+        assertTrue(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
 
         // Try and fail to set the selection longer than zero.
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 4);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 5);
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
     }
 
@@ -3461,8 +3466,9 @@
             }
         });
 
-        final AccessibilityNodeInfo text = getInteractionBridge()
-               .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        final AccessibilityNodeInfo text = getInstrumentation().getUiAutomation()
+               .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                       getString(R.string.foo_bar_baz)).get(0);
 
         // Check the initial node properties.
         assertFalse(text.isEditable());
@@ -3470,16 +3476,16 @@
         assertSame(text.getTextSelectionEnd(), -1);
 
         // Set the cursor position.
-        getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        getInstrumentation().getUiAutomation().executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
                 Bundle arguments = new Bundle();
                 arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 4);
                 arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 4);
-                assertTrue(getInteractionBridge().performAction(text,
+                assertTrue(text.performAction(
                         AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return (event.getEventType()
@@ -3488,8 +3494,9 @@
         }, TIMEOUT_ASYNC_PROCESSING);
 
         // Refresh the node.
-        AccessibilityNodeInfo refreshedText = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        AccessibilityNodeInfo refreshedText = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.foo_bar_baz)).get(0);
 
         // Check the related node properties.
         assertFalse(refreshedText.isEditable());
@@ -3500,12 +3507,13 @@
         Bundle arguments = new Bundle();
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, 4);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, 5);
-        assertFalse(getInteractionBridge().performAction(text,
+        assertFalse(text.performAction(
                 AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
 
         // Refresh the node.
-        refreshedText = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.foo_bar_baz));
+        refreshedText = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.foo_bar_baz)).get(0);
 
         // Check the related node properties.
         assertFalse(refreshedText.isEditable());
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
index 7f3a03c..9785ab4 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
@@ -23,17 +23,6 @@
  * Test cases for testing the accessibility focus APIs exposed to accessibility
  * services. This test checks how the view hierarchy is reported to accessibility
  * services.
- * <p>
- * Note: The accessibility CTS tests are composed of two APKs, one with delegating
- * accessibility service and another with the instrumented activity and test cases.
- * The delegating service is installed and enabled during test execution. It serves
- * as a proxy to the system used by the tests. This indirection is needed since the
- * test runner stops the package before running the tests. Hence, if the accessibility
- * service is in the test package running the tests would break the binding between
- * the service and the system.  The delegating service is in
- * <strong>CtsDelegatingAccessibilityService.apk</strong> whose source is located at
- * <strong>cts/tests/accessibilityservice</strong>.
- * </p>
  */
 public class AccessibilityViewTreeReportingTest
         extends AccessibilityActivityTestCase<AccessibilityViewTreeReportingActivity>{
@@ -44,75 +33,88 @@
 
     @MediumTest
     public void testDescendantsOfNotImportantViewReportedInOrder1() throws Exception {
-        AccessibilityNodeInfo firstFrameLayout = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstFrameLayout));
+        AccessibilityNodeInfo firstFrameLayout = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.firstFrameLayout)).get(0);
         assertNotNull(firstFrameLayout);
         assertSame(3, firstFrameLayout.getChildCount());
 
         // Check if the first child is the right one.
-        AccessibilityNodeInfo firstTextView = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstTextView));
-        assertEquals(firstTextView, getInteractionBridge().getChild(firstFrameLayout, 0));
+        AccessibilityNodeInfo firstTextView = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                    R.string.firstTextView)).get(0);
+        assertEquals(firstTextView, firstFrameLayout.getChild(0));
 
         // Check if the second child is the right one.
-        AccessibilityNodeInfo firstEditText = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstEditText));
-        assertEquals(firstEditText, getInteractionBridge().getChild(firstFrameLayout, 1));
+        AccessibilityNodeInfo firstEditText = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(getString(
+                    R.string.firstEditText)).get(0);
+        assertEquals(firstEditText, firstFrameLayout.getChild(1));
 
         // Check if the third child is the right one.
-        AccessibilityNodeInfo firstButton = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstButton));
-        assertEquals(firstButton, getInteractionBridge().getChild(firstFrameLayout, 2));
+        AccessibilityNodeInfo firstButton = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.firstButton)).get(0);
+        assertEquals(firstButton, firstFrameLayout.getChild(2));
     }
 
     @MediumTest
     public void testDescendantsOfNotImportantViewReportedInOrder2() throws Exception {
-        AccessibilityNodeInfo secondFrameLayout = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondFrameLayout));
+        AccessibilityNodeInfo secondFrameLayout = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondFrameLayout)).get(0);
         assertNotNull(secondFrameLayout);
         assertSame(3, secondFrameLayout.getChildCount());
 
         // Check if the first child is the right one.
-        AccessibilityNodeInfo secondTextView = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondTextView));
-        assertEquals(secondTextView, getInteractionBridge().getChild(secondFrameLayout, 0));
+        AccessibilityNodeInfo secondTextView = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondTextView)).get(0);
+        assertEquals(secondTextView, secondFrameLayout.getChild(0));
 
         // Check if the second child is the right one.
-        AccessibilityNodeInfo secondEditText = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondEditText));
-        assertEquals(secondEditText, getInteractionBridge().getChild(secondFrameLayout, 1));
+        AccessibilityNodeInfo secondEditText = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondEditText)).get(0);
+        assertEquals(secondEditText, secondFrameLayout.getChild(1));
 
         // Check if the third child is the right one.
-        AccessibilityNodeInfo secondButton = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondButton));
-        assertEquals(secondButton, getInteractionBridge().getChild(secondFrameLayout, 2));
+        AccessibilityNodeInfo secondButton = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondButton)).get(0);
+        assertEquals(secondButton, secondFrameLayout.getChild(2));
     }
 
     @MediumTest
     public void testDescendantsOfNotImportantViewReportedInOrder3() throws Exception {
-        AccessibilityNodeInfo rootLinearLayout = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.rootLinearLayout));
+        AccessibilityNodeInfo rootLinearLayout = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.rootLinearLayout)).get(0);
         assertNotNull(rootLinearLayout);
         assertSame(4, rootLinearLayout.getChildCount());
 
         // Check if the first child is the right one.
-        AccessibilityNodeInfo firstFrameLayout = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.firstFrameLayout));
-        assertEquals(firstFrameLayout, getInteractionBridge().getChild(rootLinearLayout, 0));
+        AccessibilityNodeInfo firstFrameLayout = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.firstFrameLayout)).get(0);
+        assertEquals(firstFrameLayout, rootLinearLayout.getChild(0));
 
         // Check if the second child is the right one.
-        AccessibilityNodeInfo secondTextView = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondTextView));
-        assertEquals(secondTextView, getInteractionBridge().getChild(rootLinearLayout, 1));
+        AccessibilityNodeInfo secondTextView = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondTextView)).get(0);
+        assertEquals(secondTextView, rootLinearLayout.getChild(1));
 
         // Check if the third child is the right one.
-        AccessibilityNodeInfo secondEditText = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondEditText));
-        assertEquals(secondEditText, getInteractionBridge().getChild(rootLinearLayout, 2));
+        AccessibilityNodeInfo secondEditText = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondEditText)).get(0);
+        assertEquals(secondEditText, rootLinearLayout.getChild(2));
 
         // Check if the fourth child is the right one.
-        AccessibilityNodeInfo secondButton = getInteractionBridge()
-            .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.secondButton));
-        assertEquals(secondButton, getInteractionBridge().getChild(rootLinearLayout, 3));
+        AccessibilityNodeInfo secondButton = getInstrumentation().getUiAutomation()
+            .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                    getString(R.string.secondButton)).get(0);
+        assertEquals(secondButton, rootLinearLayout.getChild(3));
     }
 }
diff --git a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
index f83c35c..0ea9a7f 100644
--- a/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
+++ b/tests/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
@@ -24,6 +24,8 @@
 import static android.view.accessibility.AccessibilityNodeInfo.ACTION_SELECT;
 
 import android.accessibilityservice.AccessibilityService;
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.UiAutomation;
 import android.graphics.Rect;
 import android.os.SystemClock;
 import android.test.suitebuilder.annotation.MediumTest;
@@ -41,17 +43,6 @@
  * Test cases for testing the accessibility APIs for querying of the screen content.
  * These APIs allow exploring the screen and requesting an action to be performed
  * on a given view from an AccessiiblityService.
- * <p>
- * Note: The accessibility CTS tests are composed of two APKs, one with delegating
- * accessibility service and another with the instrumented activity and test cases.
- * The delegating service is installed and enabled during test execution. It serves
- * as a proxy to the system used by the tests. This indirection is needed since the
- * test runner stops the package before running the tests. Hence, if the accessibility
- * service is in the test package running the tests would break the binding between
- * the service and the system.  The delegating service is in
- * <strong>CtsDelegatingAccessibilityService.apk</strong> whose source is located at
- * <strong>cts/tests/accessibilityservice</strong>.
- * </p>
  */
 public class AccessibilityWindowQueryTest
         extends AccessibilityActivityTestCase<AccessibilityWindowQueryActivity> {
@@ -63,23 +54,26 @@
     @MediumTest
     public void testFindByText() throws Exception {
         // find a view by text
-        List<AccessibilityNodeInfo> buttons =
-            getInteractionBridge().findAccessibilityNodeInfosByText("butto");
+        List<AccessibilityNodeInfo> buttons = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText("butto");
         assertEquals(9, buttons.size());
     }
 
     @MediumTest
     public void testFindByContentDescription() throws Exception {
         // find a view by text
-        AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.contentDescription));
+        AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.contentDescription)).get(0);
         assertNotNull(button);
     }
 
     @MediumTest
     public void testTraverseWindow() throws Exception {
         try {
-            getInteractionBridge().setRegardViewsNotImportantForAccessibility(true);
+            AccessibilityServiceInfo info = getInstrumentation().getUiAutomation().getServiceInfo();
+            info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
+            getInstrumentation().getUiAutomation().setServiceInfo(info);
 
             // make list of expected nodes
             List<String> classNameAndTextList = new ArrayList<String>();
@@ -101,7 +95,7 @@
             classNameAndTextList.add("android.widget.ButtonButton9");
 
             Queue<AccessibilityNodeInfo> fringe = new LinkedList<AccessibilityNodeInfo>();
-            fringe.add(getInteractionBridge().getRootInActiveWindow());
+            fringe.add(getInstrumentation().getUiAutomation().getRootInActiveWindow());
 
             // do a BFS traversal and check nodes
             while (!fringe.isEmpty()) {
@@ -117,111 +111,118 @@
 
                 final int childCount = current.getChildCount();
                 for (int i = 0; i < childCount; i++) {
-                    AccessibilityNodeInfo child = getInteractionBridge().getChild(current, i);
+                    AccessibilityNodeInfo child = current.getChild(i);
                     fringe.add(child);
                 }
             }
         } finally {
-            getInteractionBridge().setRegardViewsNotImportantForAccessibility(false);
+            AccessibilityServiceInfo info = getInstrumentation().getUiAutomation().getServiceInfo();
+            info.flags &= ~AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
+            getInstrumentation().getUiAutomation().setServiceInfo(info);
         }
     }
 
     @MediumTest
     public void testPerformActionFocus() throws Exception {
         // find a view and make sure it is not focused
-        AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isFocused());
 
         // focus the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_FOCUS));
+        assertTrue(button.performAction(ACTION_FOCUS));
 
         // find the view again and make sure it is focused
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                getString(R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
         assertTrue(button.isFocused());
     }
 
     @MediumTest
     public void testPerformActionClearFocus() throws Exception {
         // find a view and make sure it is not focused
-        AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isFocused());
 
         // focus the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_FOCUS));
+        assertTrue(button.performAction(ACTION_FOCUS));
 
         // find the view again and make sure it is focused
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                getString(R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
         assertTrue(button.isFocused());
 
         // unfocus the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_CLEAR_FOCUS));
+        assertTrue(button.performAction(ACTION_CLEAR_FOCUS));
 
         // find the view again and make sure it is not focused
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(getString(
-                R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
         assertFalse(button.isFocused());
     }
 
     @MediumTest
     public void testPerformActionSelect() throws Exception {
         // find a view and make sure it is not selected
-        AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
 
         // select the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_SELECT));
+        assertTrue(button.performAction(ACTION_SELECT));
 
         // find the view again and make sure it is selected
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                getString(R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
         assertTrue(button.isSelected());
     }
 
     @MediumTest
     public void testPerformActionClearSelection() throws Exception {
         // find a view and make sure it is not selected
-        AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
 
         // select the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_SELECT));
+        assertTrue(button.performAction(ACTION_SELECT));
 
         // find the view again and make sure it is selected
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                getString(R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
 
         assertTrue(button.isSelected());
 
         // unselect the view
-        assertTrue(getInteractionBridge().performAction(button, ACTION_CLEAR_SELECTION));
+        assertTrue(button.performAction(ACTION_CLEAR_SELECTION));
 
         // find the view again and make sure it is not selected
-        button = getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                getString(R.string.button5));
+        button = getInstrumentation().getUiAutomation().getRootInActiveWindow()
+                .findAccessibilityNodeInfosByText(getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
     }
 
     @MediumTest
     public void testPerformActionClick() throws Exception {
         // find a view and make sure it is not selected
-        final AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        final AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
 
         // Make an action and wait for an event.
-        AccessibilityEvent expected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent expected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(button, ACTION_CLICK);
+                button.performAction(ACTION_CLICK);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return (event.getEventType() == AccessibilityEvent.TYPE_VIEW_CLICKED);
@@ -236,18 +237,19 @@
     @MediumTest
     public void testPerformActionLongClick() throws Exception {
         // find a view and make sure it is not selected
-        final AccessibilityNodeInfo button = getInteractionBridge()
-                .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
+        final AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
 
         // Make an action and wait for an event.
-        AccessibilityEvent expected = getInteractionBridge()
-                .executeCommandAndWaitForAccessibilityEvent(new Runnable() {
+        AccessibilityEvent expected = getInstrumentation().getUiAutomation()
+                .executeAndWaitForEvent(new Runnable() {
             @Override
             public void run() {
-                getInteractionBridge().performAction(button, ACTION_LONG_CLICK);
+                button.performAction(ACTION_LONG_CLICK);
             }
-        }, new AccessibilityEventFilter() {
+        }, new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return (event.getEventType() == AccessibilityEvent.TYPE_VIEW_LONG_CLICKED);
@@ -262,21 +264,21 @@
     @MediumTest
     public void testGetEventSource() throws Exception {
         // find a view and make sure it is not focused
-        final AccessibilityNodeInfo button =
-            getInteractionBridge().findAccessibilityNodeInfoByTextFromRoot(
-                    getString(R.string.button5));
+        final AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                        getString(R.string.button5)).get(0);
         assertFalse(button.isSelected());
 
         // focus and wait for the event
-        AccessibilityEvent awaitedEvent =
-            getInteractionBridge().executeCommandAndWaitForAccessibilityEvent(
+        AccessibilityEvent awaitedEvent = getInstrumentation().getUiAutomation()
+            .executeAndWaitForEvent(
                 new Runnable() {
             @Override
             public void run() {
-                assertTrue(getInteractionBridge().performAction(button, ACTION_FOCUS));
+                assertTrue(button.performAction(ACTION_FOCUS));
             }
         },
-                new AccessibilityEventFilter() {
+                new UiAutomation.AccessibilityEventFilter() {
             @Override
             public boolean accept(AccessibilityEvent event) {
                 return (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED);
@@ -287,7 +289,7 @@
         assertNotNull(awaitedEvent);
 
         // check that last event source
-        AccessibilityNodeInfo source = getInteractionBridge().getSource(awaitedEvent);
+        AccessibilityNodeInfo source = awaitedEvent.getSource();
         assertNotNull(source);
 
         // bounds
@@ -321,7 +323,7 @@
 
     @MediumTest
     public void testPerformGlobalActionBack() throws Exception {
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_BACK));
 
         // Sleep a bit so the UI is settles.
@@ -330,7 +332,7 @@
 
     @MediumTest
     public void testPerformGlobalActionHome() throws Exception {
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_HOME));
 
         // Sleep a bit so the UI is settles.
@@ -340,14 +342,14 @@
     @MediumTest
     public void testPerformGlobalActionRecents() throws Exception {
         // Check whether the action succeeded.
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_RECENTS));
 
         // Sleep a bit so the UI is settles.
         SystemClock.sleep(3000);
 
         // Clean up.
-        getInteractionBridge().performGlobalAction(
+        getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_BACK);
 
         // Sleep a bit so the UI is settles.
@@ -357,14 +359,14 @@
     @MediumTest
     public void testPerformGlobalActionNotifications() throws Exception {
         // Perform the action under test
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS));
 
         // Sleep a bit so the UI is settles.
         SystemClock.sleep(3000);
 
         // Clean up.
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_BACK));
 
         // Sleep a bit so the UI is settles.
@@ -374,14 +376,14 @@
     @MediumTest
     public void testPerformGlobalActionQuickSettings() throws Exception {
         // Check whether the action succeeded.
-        assertTrue(getInteractionBridge().performGlobalAction(
+        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_QUICK_SETTINGS));
 
         // Sleep a bit so the UI is settles.
         SystemClock.sleep(3000);
 
         // Clean up.
-        getInteractionBridge().performGlobalAction(
+        getInstrumentation().getUiAutomation().performGlobalAction(
                 AccessibilityService.GLOBAL_ACTION_BACK);
 
         // Sleep a bit so the UI is settles.
@@ -391,14 +393,18 @@
     @MediumTest
     public void testObjectContract() throws Exception {
         try {
-            getInteractionBridge().setRegardViewsNotImportantForAccessibility(true);
+            AccessibilityServiceInfo info = getInstrumentation().getUiAutomation().getServiceInfo();
+            info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
+            getInstrumentation().getUiAutomation().setServiceInfo(info);
+
             // find a view and make sure it is not focused
-            AccessibilityNodeInfo button = getInteractionBridge()
-                    .findAccessibilityNodeInfoByTextFromRoot(getString(R.string.button5));
-            AccessibilityNodeInfo parent = getInteractionBridge().getParent(button);
+            AccessibilityNodeInfo button = getInstrumentation().getUiAutomation()
+                    .getRootInActiveWindow().findAccessibilityNodeInfosByText(
+                            getString(R.string.button5)).get(0);
+            AccessibilityNodeInfo parent = button.getParent();
             final int childCount = parent.getChildCount();
             for (int i = 0; i < childCount; i++) {
-                AccessibilityNodeInfo child = getInteractionBridge().getChild(parent, i);
+                AccessibilityNodeInfo child = parent.getChild(i);
                 assertNotNull(child);
                 if (child.equals(button)) {
                     assertEquals("Equal objects must have same hasCode.", button.hashCode(),
@@ -408,7 +414,9 @@
             }
             fail("Parent's children do not have the info whose parent is the parent.");
         } finally {
-            getInteractionBridge().setRegardViewsNotImportantForAccessibility(false);
+            AccessibilityServiceInfo info = getInstrumentation().getUiAutomation().getServiceInfo();
+            info.flags &= ~AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS;
+            getInstrumentation().getUiAutomation().setServiceInfo(info);
         }
     }
 
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index ab7410b..0ff9e7d 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -88,13 +88,12 @@
 
     /**
      * @param testinput the file to decode
-     * @param master the "golden master" to compared against
      * @param maxerror the maximum allowed root mean squared error
      * @throws IOException
      */
     private void decode(int testinput, float maxerror) throws IOException {
 
-        short [] decoded = decodeToMemory(testinput);
+        short [] decoded = decodeToMemory(testinput, false);
 
         assertEquals("wrong data size", mMasterBuffer.length, decoded.length);
 
@@ -110,11 +109,17 @@
         long avgErrorSquared = (totalErrorSquared / decoded.length);
         double rmse = Math.sqrt(avgErrorSquared);
         assertTrue("decoding error too big: " + rmse, rmse <= maxerror);
-     }
 
-    private short[] decodeToMemory(int testinput) throws IOException {
+        short [] decoded2 = decodeToMemory(testinput, true);
+        assertEquals("count different with reconfigure", decoded.length, decoded2.length);
+        for (int i = 0; i < decoded.length; i++) {
+            assertEquals("samples don't match", decoded[i], decoded2[i]);
+        }
+    }
 
-        short [] decoded = new short[1024];
+    private short[] decodeToMemory(int testinput, boolean reconfigure) throws IOException {
+
+        short [] decoded = new short[0];
         int decodedIdx = 0;
 
         AssetFileDescriptor testFd = mResources.openRawResourceFd(testinput);
@@ -140,6 +145,14 @@
         codecInputBuffers = codec.getInputBuffers();
         codecOutputBuffers = codec.getOutputBuffers();
 
+        if (reconfigure) {
+            codec.stop();
+            codec.configure(format, null /* surface */, null /* crypto */, 0 /* flags */);
+            codec.start();
+            codecInputBuffers = codec.getInputBuffers();
+            codecOutputBuffers = codec.getOutputBuffers();
+        }
+
         extractor.selectTrack(0);
 
         // start decoding
@@ -183,6 +196,21 @@
             int res = codec.dequeueOutputBuffer(info, kTimeOutUs);
 
             if (res >= 0) {
+                //Log.d(TAG, "got frame, size " + info.size + "/" + info.presentationTimeUs);
+
+                if (info.size > 0 && reconfigure) {
+                    // once we've gotten some data out of the decoder, reconfigure it again
+                    reconfigure = false;
+                    extractor.seekTo(0, MediaExtractor.SEEK_TO_NEXT_SYNC);
+                    sawInputEOS = false;
+                    codec.stop();
+                    codec.configure(format, null /* surface */, null /* crypto */, 0 /* flags */);
+                    codec.start();
+                    codecInputBuffers = codec.getInputBuffers();
+                    codecOutputBuffers = codec.getOutputBuffers();
+                    continue;
+                }
+
                 int outputBufIndex = res;
                 ByteBuffer buf = codecOutputBuffers[outputBufIndex];
 
@@ -208,6 +236,8 @@
                 MediaFormat oformat = codec.getOutputFormat();
 
                 Log.d(TAG, "output format has changed to " + oformat);
+            } else {
+                Log.d(TAG, "dequeueOutputBuffer returned " + res);
             }
         }
 
@@ -750,8 +780,8 @@
         codec.flush();
         short maxvalue2 = getAmplitude(extractor, codec);
 
-        assertTrue(maxvalue1 > 20000);
-        assertTrue(maxvalue2 < 5000);
+        assertTrue("first section amplitude too low", maxvalue1 > 20000);
+        assertTrue("second section amplitude too high", maxvalue2 < 5000);
         codec.stop();
         codec.release();
 
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index c244159..d4bff12 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -113,25 +113,30 @@
     public void testSetNetworkPreference() {
         // verify swtiching between two default networks - need to connectable networks though
         // could use test and whatever the current active network is
-        NetworkInfo active = mCm.getActiveNetworkInfo();
         int originalPref = mCm.getNetworkPreference();
         int currentPref = originalPref;
         for (int type = -1; type <= ConnectivityManager.MAX_NETWORK_TYPE+1; type++) {
             mCm.setNetworkPreference(type);
             NetworkConfig c = mNetworks.get(type);
             boolean expectWorked = (c != null && c.isDefault());
-            try {
-                Thread.currentThread().sleep(100);
-            } catch (InterruptedException e) {}
-            int foundType = mCm.getNetworkPreference();
+            int totalSleep = 0;
+            int foundType = ConnectivityManager.TYPE_NONE;
+            while (totalSleep < 1000) {
+                try {
+                    Thread.currentThread().sleep(100);
+                } catch (InterruptedException e) {}
+                totalSleep += 100;
+                foundType = mCm.getNetworkPreference();
+                if (currentPref != foundType) break;
+            }
             if (expectWorked) {
                 assertTrue("We should have been able to switch prefered type " + type,
                         foundType == type);
-                currentPref = foundType;
             } else {
                 assertTrue("We should not have been able to switch type " + type,
-                        foundType == currentPref);
+                        foundType != type);
             }
+            currentPref = foundType;
         }
         mCm.setNetworkPreference(originalPref);
     }
@@ -171,6 +176,10 @@
             for (NetworkInfo i : ni) {
                 if (i.getType() == type) foundCount++;
             }
+            if (foundCount != desiredFoundCount) {
+                Log.e(TAG, "failure in testGetAllNetworkInfo.  Dump of returned NetworkInfos:");
+                for (NetworkInfo networkInfo : ni) Log.e(TAG, "  " + networkInfo);
+            }
             assertTrue("Unexpected foundCount of " + foundCount + " for type " + type,
                     foundCount == desiredFoundCount);
         }
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/GlobalSync.java b/tests/tests/renderscript/src/android/renderscript/cts/GlobalSync.java
index f895661..c446ba1 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/GlobalSync.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/GlobalSync.java
@@ -40,20 +40,19 @@
         int [] In = new int [1];
         In[0] = v;
         AIn.copyFrom(In);
-
     }
 
     /**
      * Test whether we are properly synchronizing extern global data
-     * when dealing with mixed kernels/invokables.
+     * when going from kernel to invokable.
      */
-    public void testGlobalSync() {
+    public void testKIGlobalSync() {
         ScriptC_global_sync gs = new ScriptC_global_sync(mRS);
 
         int v = 7;
         setupGlobalSync(mRS, gs, v);
         gs.forEach_write_global(AIn);
-        gs.invoke_test_global(v);
+        gs.invoke_test_read_global(v);
 
         AFailed.copyTo(Failed);
         if (Failed[0] != 0) {
@@ -66,15 +65,57 @@
 
     /**
      * Test whether we are properly synchronizing static global data
-     * when dealing with mixed kernels/invokables.
+     * when going from invokable to kernel.
      */
-    public void testStaticGlobalSync() {
+    public void testKIStaticGlobalSync() {
         ScriptC_global_sync gs = new ScriptC_global_sync(mRS);
 
         int v = 9;
         setupGlobalSync(mRS, gs, v);
         gs.forEach_write_static_global(AIn);
-        gs.invoke_test_static_global(v);
+        gs.invoke_test_read_static_global(v);
+
+        AFailed.copyTo(Failed);
+        if (Failed[0] != 0) {
+            FoundError = true;
+        }
+
+        gs.destroy();
+        checkForErrors();
+    }
+
+    /**
+     * Test whether we are properly synchronizing extern global data
+     * when going from invokable to kernel.
+     */
+    public void testIKGlobalSync() {
+        ScriptC_global_sync gs = new ScriptC_global_sync(mRS);
+
+        int v = 7;
+        setupGlobalSync(mRS, gs, v);
+        gs.invoke_test_write_global(v);
+        gs.forEach_read_global(AIn, AFailed);
+
+        AFailed.copyTo(Failed);
+        if (Failed[0] != 0) {
+            FoundError = true;
+        }
+
+        gs.destroy();
+        checkForErrors();
+    }
+
+    /**
+     * Test whether we are properly synchronizing static global data
+     * when going from kernel to invokable.
+     */
+    public void testIKStaticGlobalSync() {
+        ScriptC_global_sync gs = new ScriptC_global_sync(mRS);
+
+        int v = 9;
+        setupGlobalSync(mRS, gs, v);
+        gs.invoke_test_write_static_global(v);
+        gs.forEach_read_static_global(AIn, AFailed);
 
         AFailed.copyTo(Failed);
         if (Failed[0] != 0) {
@@ -85,4 +126,3 @@
         checkForErrors();
     }
 }
-
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
index 75fc599..3c8650d 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
@@ -71,6 +71,9 @@
 
     public void testNearest() {
         mScript.invoke_test_RGBA(mAlloc_RGBA_1D, mAlloc_RGBA_2D);
+        mRS.finish();
+        checkForErrors();
+        waitForMessage();
     }
 }
 
diff --git a/tests/tests/webkit/src/android/webkit/cts/GeolocationTest.java b/tests/tests/webkit/src/android/webkit/cts/GeolocationTest.java
index 1dafd3b..820bc79 100644
--- a/tests/tests/webkit/src/android/webkit/cts/GeolocationTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/GeolocationTest.java
@@ -64,7 +64,7 @@
 
     private static final String JS_INTERFACE_NAME = "Android";
     private static final int POLLING_TIMEOUT = 60 * 1000;
-    private static final String PROVIDER_NAME = "WebKitGeolocationTestLocationProvider";
+    private static final String PROVIDER_NAME = LocationManager.NETWORK_PROVIDER;
 
     // static HTML page always injected instead of the url loaded
     private static final String RAW_HTML =
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/AccessibilityServiceTestRunner.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/AccessibilityServiceTestRunner.java
deleted file mode 100644
index d333943..0000000
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/AccessibilityServiceTestRunner.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.cts.tradefed.testtype;
-
-import com.android.cts.tradefed.build.CtsBuildHelper;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.result.ITestInvocationListener;
-import com.android.tradefed.util.FileUtil;
-
-import junit.framework.TestCase;
-
-import java.io.File;
-
-/**
- * Running the accessibility tests requires modification of secure
- * settings. Secure settings cannot be changed from device CTS tests
- * since system signature permission is required. Such settings can
- * be modified by the shell user, so a host side test is used for
- * installing a package with a delegating accessibility service, enabling
- * this service, running these tests, disabling the service, and removing
- * the delegating accessibility service package.
- */
-public class AccessibilityServiceTestRunner extends InstrumentationApkTest {
-
-    private static final String DELEGATING_ACCESSIBLITY_SERVICE_PACKAGE_NAME =
-        "android.accessibilityservice.delegate";
-
-    private static final String DELEGATING_ACCESSIBLITY_SERVICE_NAME =
-        "android.accessibilityservice.delegate.DelegatingAccessibilityService";
-
-    private static final String DELEGATING_ACCESSIBLITY_SERVICE_APK =
-        "CtsDelegatingAccessibilityService.apk";
-
-    private CtsBuildHelper mCtsBuild;
-
-    @Override
-    public void setBuild(IBuildInfo build) {
-        super.setBuild(build);
-        mCtsBuild  = CtsBuildHelper.createBuildHelper(build);
-    }
-
-    @Override
-    public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
-        beforeTest();
-        super.run(listener);
-        afterTest();
-    }
-
-    private void beforeTest() throws DeviceNotAvailableException {
-        installApkAndAssert(DELEGATING_ACCESSIBLITY_SERVICE_APK);
-        enableAccessibilityAndDelegatingService();
-    }
-
-    private void afterTest() throws DeviceNotAvailableException {
-        AccessibilityTestRunner.disableAccessibilityAndServices(getDevice());
-        uninstallAndAssert(DELEGATING_ACCESSIBLITY_SERVICE_PACKAGE_NAME);
-    }
-
-    private void installApkAndAssert(String apkName) throws DeviceNotAvailableException {
-        File file = FileUtil.getFileForPath(mCtsBuild.getTestCasesDir(), apkName);
-        String errorMessage = getDevice().installPackage(file, true);
-        TestCase.assertNull("Error installing: " + apkName, errorMessage);
-    }
-
-    private void uninstallAndAssert(String packageName) throws DeviceNotAvailableException {
-        String errorMessage = getDevice().uninstallPackage(packageName);
-        TestCase.assertNull("Error uninstalling: " + packageName, errorMessage);
-    }
-
-    private void enableAccessibilityAndDelegatingService() throws DeviceNotAvailableException {
-        String componentName = DELEGATING_ACCESSIBLITY_SERVICE_PACKAGE_NAME + "/"
-            + DELEGATING_ACCESSIBLITY_SERVICE_NAME;
-        AccessibilityTestRunner.enableAccessibilityAndServices(getDevice(),
-                componentName);
-    }
-}
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index 2d11657..59babec 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -48,8 +48,6 @@
     public static final String VM_HOST_TEST = "vmHostTest";
     public static final String ACCESSIBILITY_TEST =
         "com.android.cts.tradefed.testtype.AccessibilityTestRunner";
-    public static final String ACCESSIBILITYSERVICE_TEST =
-        "com.android.cts.tradefed.testtype.AccessibilityServiceTestRunner";
     public static final String DISPLAY_TEST =
             "com.android.cts.tradefed.testtype.DisplayTestRunner";
     public static final String UIAUTOMATOR_TEST = "uiAutomator";
@@ -230,9 +228,6 @@
         } else if (ACCESSIBILITY_TEST.equals(mTestType)) {
             AccessibilityTestRunner test = new AccessibilityTestRunner();
             return setInstrumentationTest(test, testCaseDir);
-        } else if (ACCESSIBILITYSERVICE_TEST.equals(mTestType)) {
-            AccessibilityServiceTestRunner test = new AccessibilityServiceTestRunner();
-            return setInstrumentationTest(test, testCaseDir);
         } else if (DISPLAY_TEST.equals(mTestType)) {
             DisplayTestRunner test = new DisplayTestRunner();
             return setInstrumentationTest(test, testCaseDir);